Jeff Peng wrote: > Hi, > > I have a module, and I wanted to make an alias with a function in that module. > > package abc; >
# declare the sub without defining it sub init_squid_for_reverseproxy; > { # make an alias to another function > no strict 'refs'; > *{__PACKAGE__::init_squid_for_reverseproxy} = \&init_reverseproxy; > } > > But this won't work when calling it: > > my $obj = abc->new; > $obj->init_squid_for_reverseproxy; > > The error says: > Can't locate object method "init_squid_for_reverseproxy" via package "abc" . > > Why? Because the compiler doesn't know that it is a sub. -- Just my 0.00000002 million dollars worth, Shawn Programming is as much about organization and communication as it is about coding. I like Perl; it's the only language where you can bless your thingy. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/