When perl code is compiled, globs for package variables / symbols are scanned (and generated as needed) and refer directly to the compiled code.
So, if you delete the character table entry $pkg::{n} , all the already compiled code that used $pkg::n , @pkg::n , etc., still use the original glob. But do / require 'd code or eval STRING or symbolic links will not.
This code ends with two * n globs; all code compiled before the uninstall will be referenced to the source; all code compiled after that will be referenced to the new one (and symbolic links will be received depending on what is in the symbol table at this point at runtime).
$n = 123; delete $::{n}; eval '$n=456'; print $n; eval 'print $n';
Another example:
$n = 123; sub get_n { $n } BEGIN { delete $::{n} } $n = 456; print get_n(); print $n;
ysth
source share