Shlomi Fish:
On Tuesday 08 Dec 2009 11:46:59 Jeff Pang wrote:
Shlomi Fish:
Regarding using string eval "" - you can do the same using
UNIVERSAL::can, which would be safer in this case:

<<<<
__PACKAGE__->can("asub")->(@params);
or define a package and use AUTOLOAD method?


How will the AUTOLOAD method help you here?

sub AUTOLOAD {
    our $AUTOLOAD;
    print "I see $AUTOLOAD(@_)\n";
}

asub("abc");  # prints: I see main::asub("abc")


> And AUTOLOAD is almost always not
> a good idea.

Why?

Thanks.

--
Jeff Pang
http://home.arcor.de/pangj/

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to