On Fri, Feb 14, 2003 at 12:21:29PM +0000, Simon Wistow wrote:
> Odd question.
> Due to various, err, things, I am in the situation whereby code I have
> written is being transformed from a source file into an anonymous
> subroutines which then gets evaled by something else.

common in cacheing templates....

> The downside of this is that I don't get the benefits of use strict; -
> something that has just led to me spending half an hour searching for
> a bug which was because I mispelt '$names' '$name'.

not entirely surprising...

> Obviously I'm not as good as bK. Perhaps I never will be.
> Until hat day is there any way one can get all the lovely benefits
> strict from within an evaled anonymous sub?

does:

 my $sub=eval "use strict; return sub {...}";
 if($@) {
     # handle the error here....
 }

not work?

I'm sure I did this at one stage...

MBM

-- 
Lusercop.net - LARTing Lusers everywhere since 2002

Reply via email to