in reply to Removing CODE slot in typeglob / Reversing "use subs ...;"
use 5.010; use strict; our $FOO; BEGIN { $FOO = 'still foo'; } sub FOO () { 'foo' } BEGIN { *BAR = *FOO; say "in BEGIN (1): \$FOO = '$FOO'"; undef *FOO; say "in BEGIN (2): \$FOO = '$FOO'"; *FOO = *BAR{SCALAR}; undef *BAR; } say defined &FOO ? 'subroutine defined' : 'subroutine undef'; say eval 'my $false; FOO if $false; 1' ? 'FOO allowed' : 'FOO not allowed' ; say $FOO; __END__ in BEGIN (1): $FOO = 'still foo' in BEGIN (2): $FOO = '' subroutine undef FOO not allowed still foo
update: tweaked the code to more closely resemble the OP's.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Removing CODE slot in typeglob / Reversing "use subs ...;"
by stvn (Monsignor) on Jan 03, 2008 at 22:33 UTC | |
by shmem (Chancellor) on Jan 03, 2008 at 23:30 UTC | |
by stvn (Monsignor) on Jan 04, 2008 at 17:10 UTC | |
by Anonymous Monk on Jan 04, 2008 at 10:51 UTC | |
Re^2: Removing CODE slot in typeglob / Reversing "use subs ...;"
by lodin (Hermit) on Jan 04, 2008 at 02:52 UTC |