in reply to Is strict too strict here?

our is lexically scoped, so it's not in view of the eval and thus the code that references $somevar. Fix:
Foo::eval_this('our $somevar; print $somevar;');

Replies are listed 'Best First'.
Re^2: Is strict too strict here?
by saintmike (Vicar) on Jul 12, 2008 at 00:21 UTC
    Fix: Foo::eval_this('our $somevar; print $somevar;');
    Yeah, that would work, but that's unfortunately not an option, since I don't know beforehand which variables are used in the eval'd string (well, I guess I could walk main's symbol table and figure out all the declared globals, then add "our $this; our $that" in front of the string, but that's rather ugly.

    Any other ideas?

      You don't know which variable are used in the evaled string when writing the evaled string?

      Based on your proposed solution, you'd be happy with "no strict;".