in reply to Re: typeglob reference deletes global lexical
in thread typeglob reference deletes global lexical
the typeglob is created, but it doesn't contain anything.
It's not empty. It caches the SUPER(T2::s1) ⇒ T1::s1 relation.
{ package T1; sub s1 { } } { package T2; use base T1; } { package T3; use base T2; sub s1 { shift->SUPER::s1 } } use Devel::Peek qw( Dump ); { warn("T1::s1: ", \&T1::s1, "\n"); warn("T2::s1 (pre):\n"); Dump(*T2::s1); T3->s1; warn("T2::s1 (post):\n"); Dump(*T2::s1); }
>perl script.pl 2>&1 | findstr ": CODE CV" T1::s1: CODE(0x183180c) T2::s1 (pre): CV = 0x0 CVGEN = 0x0 T2::s1 (post): CV = 0x183180c CVGEN = 0x91
SUPER doesn't need to be explicitly mentioned.
{ package T1; sub s1 { } } { package T2; use base T1; } use Devel::Peek qw( Dump ); { warn("T1::s1: ", \&T1::s1, "\n"); warn("T2::s1 (pre):\n"); Dump(*T2::s1); T2->s1; warn("T2::s1 (post):\n"); Dump(*T2::s1); }
>perl script.pl 2>&1 | findstr ": CODE CV" T1::s1: CODE(0x183180c) T2::s1 (pre): CV = 0x0 CVGEN = 0x0 T2::s1 (post): CV = 0x183180c CVGEN = 0x8e
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: typeglob reference deletes global lexical (SUPER:: cache)
by robnagler (Novice) on Nov 08, 2008 at 03:42 UTC |