在 Oct 29, 2006 4:34 PM 時,Richard Hainsworth 寫到:

If I have the following

my $self = "some text";
my $nself = ~eval(q/"self is $self"/,:lang<perl5>);

then surely $nself should be "self is some text".

But it is not. $self is not set inside the eval in pugs.

The lexical pad is not yet shared with Perl 5. Can you commit a test in t/perl5/ to test that?

(I've just sent you a commit bit; please add yourself to AUTHORS first. :-))

If yes, then how can I use content from a scalar inside an eval with perl5?

As a workaround:

my $nself = eval(q/sub { my $self = shift; "self is $self" }/, :lang<perl5>)($self);

Audrey

Reply via email to