----- Original Nachricht ----
Von:     Shlomi Fish <shlo...@iglu.org.il>
An:      beginners@perl.org
Datum:   08.12.2009 12:08
Betreff: Re: Eval scoping question

> On Tuesday 08 Dec 2009 12:18:10 Jeff Pang wrote:
> > 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 how will this help? The OP wanted to call a method by the name of "asub"
> 

Well, the OP said the method name is changing during the running time, so he 
want to eval the method name.
So a AUTOLOAD method is right for him as far as I can think.


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

Es weihnachtet sehr! Vom leckerem Backrezept bis zum leckeren Schneehasen 
finden Sie alles im Weihnachtsspecial von Arcor.de:
http://www.arcor.de/rd/footer.weihnachten
Feliz Navidad, God Yul, Merry X-Mas und ein frohes Fest!

-- 
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