March 2002 | Perl Hardware Store | 13 |
Suppose you want to use a module that exports a function
But the function has the wrong name
use LWP::Simple; # exports 'get' function
sub get { ... } # which is globbered by this 'get'
my $html = get(...); # oops, wrong 'get()'
You can still call LWP::Simple::get if you like
my $html = LWP::Simple::get(...);
But this will save typing:
use LWP::Simple (); # exports nothing BEGIN { *webget = \&LWP::Simple::get }
sub get { ... }
my $html = webget(...);
Here webget actually calls LWP::Simple::get
Next | Copyright © 2002 M-J. Dominus |