in reply to Re: Refresh a Module
in thread Refresh a Module

> Deleting the Stash entry after the call is compiled doesn't help, because the reference to the typeglob is cached.

Ran a quick test on my phone:

Looks like the typeglob˛ is looked up and the reference is stored in the OP tree. See \&main::t in #4.

That's why further manipulation will produce different results if the original typeglob isn't targeted. °

(Concise is able to backengineer the original name or is doing other introspection)

~ $ perl -MO=Concise -e'sub t {}; t()' 6 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter v ->2 2 <;> nextstate(main 3 -e:1) v:{ ->3 5 <1> entersub vKS ->6 - <1> ex-list K ->5 3 <0> pushmark s ->4 - <1> ex-rv2cv sK/1 ->- 4 <#> gv[IV \&main::t] s ->5 -e syntax OK

For comparison, that's what's happening when the sub is unknown at compile time

gv[*t] which most likely means "look up the symbol t at runtime"...

~ $ perl -MO=Concise -e't();' 6 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter v ->2 2 <;> nextstate(main 1 -e:1) v:{ ->3 5 <1> entersub[t2] vKS/TARG ->6 - <1> ex-list K ->5 3 <0> pushmark s ->4 - <1> ex-rv2cv sK/1 ->- 4 <#> gv[*t] s/EARLYCV ->5 -e syntax OK ~ $

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

°) especially deleting the entry in the namespace prevents the compiler to find the old typeglob.

˛) or is it only the CODE slot? How reliable is concise here???