Re: URI::URL

Gisle Aas (aas@oslonett.no)
Tue, 11 Jul 1995 20:56:56 +0200


Consider this:

#!/local/bin/perl
require URI::URL;
$url = new URI::URL "http://www.oslonett.no/";
$url->print_on;

when I run this script I get the following message:

Undefined subroutine &URI::URL::_generic::print_on called at ./utest line 6.  

This is not because print_on is undefined, because if I change "print_on" to 
"foo" I get:

Can't locate object method "foo" via package "URI::URL::http" at ./utest line 
6.

If I comment out the "*{"dump"} = \&print_on;" at line 1115 in URI::URL, then 
things work as it should.  The code around line 1115 is:

# Aliases for old method names. To be deleted in a future version.
{   package URI::URL::_generic;
    no strict qw(refs);
    *{"dump"} = \&print_on;
    *{"str"}  = \&as_string;
}

What is going on?  (I use perl5.001m and URI::URL 2.11)

--
Gisle Aas                               <aas@oslonett.no>
Oslonett AS                             http://www.oslonett.no/home/aas/