Do you know where your variables are? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
You can suggest it, but I don't think it'll be accepted. (Besides which, I doubt it would actually be possible to implement without breaking the "Tiny" philosophy. try gets its block-handling syntax by using a sub prototype of (&;@). To be able to accept a string you'd need to part ways with that prototype which would make using Try::Tiny a lot uglier and would break backwards compatibility for all existing users of Try::Tiny; or you'd need to write a lot of custom parsing code using something like Devel::Declare, and that would make it a lot less tiny.) Stringy eval is usually a sign of code smell (i.e. a sign that you're doing something bizarre that could be handled better another way). Taking your eval "require $module" as an example, you should take a look at Class::Load or Module::Runtime.
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
In reply to Re: Try string, not block
by tobyink
|
|