Humm... why you simply doesn't try

  use strict;

  Inside your eval'ed code?
  I think that even when you use eval, you have a code block, and whenever
you have a code block, you can 'use strict;'.
  Maybe you can solve this with

  $code_snippet = <SLURP_CODE>;
  eval "use strict; $code_snippet";
  die $@ if $@;

  Or maybe you should do

  $code_snippet =  <SLURP_CODE>;
  {
    use strict;
    eval $code_snippet;
    die $@ if $@;
  }

  Of course, maybe someone have a better suggestion. =-]

  Regards.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  Luis Campos de Carvalho
  Computer Science Student
  OCP DBA Oracle & Unix Sys Admin
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

----- Original Message -----
From: "Simon Wistow" <[EMAIL PROTECTED]>
To: "london.pm" <[EMAIL PROTECTED]>
Sent: Friday, February 14, 2003 10:21 AM
Subject: Syntax Checking Anonymous Subrotuines


>
> 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.
>
> 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'.
>
> 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?
>
> I await with baited anticipation.
>
> Simon
>
> --
> the test for truth is still quicker than the addition
>
>
>


Reply via email to