Ken Fox wrote:
Modifying the caller's environment:
$lexscope = caller().{MY};
$lexscope{'die'} = die_hard;
is especially annoying because it means that I can't
trust lexical variables anymore.
You think you can trust them now? :-)
The PadWalker module (on CPAN) allows a subroutine
Garrett Goebel [EMAIL PROTECTED] wrote
From: Dave Mitchell [mailto:[EMAIL PROTECTED]]
sub Foo::import {
my %m = caller(1).{MY}; # or whatever
%m{'$x'} = 1;
}
...
sub f {
my $x = 9;
use Foo; # does $x become 1, or $x redefined, or runtime
# error, or
can I just clarify something about delete:
my $x = 1;
{
my $x = 2;
delete $MY::{'$x'};
print $x;
$mysub = sub {$x};
}
print $mysub-();
People seem agreed that print $x should do the equivalent of
throw lexical '$x' no longer in scope
rather than printing 1, but what
At 01:45 PM 9/5/2001 +0100, Dave Mitchell wrote:
can I just clarify something about delete:
my $x = 1;
{
my $x = 2;
delete $MY::{'$x'};
print $x;
$mysub = sub {$x};
}
print $mysub-();
People seem agreed that print $x should do the equivalent of
throw lexical '$x'
[EMAIL PROTECTED] wrote:
Clearly caller() isn't what we want here, but I'm not
quite sure what would be the correct incantation.
I've always assumed that a BEGIN block's caller() will
be the compiler. This makes it easy for the compiler to
lie about %MY:: and use the lexical scope being
Hmm is this such a good thing?
my $a = 0;
GORK: while( 1 ) {
print Rin ;
GORK: if ( 1 ) {
print Tin ;
goto GORK if $b ^= 1;
print \n;
next GORK;
}
}
--
Bryan C. Warnock
[EMAIL PROTECTED]
On Wed, Sep 05, 2001 at 09:02:00PM -0400, Bryan C. Warnock wrote:
Hmm is this such a good thing?
Using goto LABEL? No. ;)
Would be nice if Perl warned one about multiple labels of the same
name in the same call stack, though.
my $a = 0;
GORK: while( 1 ) {
print Rin ;
Dave Storrs wrote:
[schnippe]
=head3 Generating Code on the Fly
What's this =head3 stuff? My pod processor barfs on it :)
Aye, here's the rub.
_
Rick Welykochy || Praxis Services Pty Limited
One of the main advantages of the 'dot-bomb' downturn
On Wed, Sep 05, 2001 at 08:32:36PM +1000, Rick Welykochy wrote:
Dave Storrs wrote:
[schnippe]
=head3 Generating Code on the Fly
What's this =head3 stuff? My pod processor barfs on it :)
Then update it. :)
It's still largely incomplete, and getting a little weighty, so v.2 is up
on my web page:
http://members.home.net/bcwarno/Perl6/ref/statements.txt
I'm sure I didn't cover all the corrections from the first go round, so if I
missed anything, gently poke me in the side.
What's been added?
10 matches
Mail list logo