in reply to Dynamically Changing Your Namespace

The package code is compiled into is what "scalar caller(0)" would return if it were called. It is determined at compile time, there is nothing you can do at run time to change it.

Anno

Replies are listed 'Best First'.
Re^2: Dynamically Changing Your Namespace
by diotalevi (Canon) on Mar 30, 2007 at 15:54 UTC

    No, code isn't immutable. It's just difficult to change. All you'd have to do is find the pointers off all the COP nodes in the optree and change them to point somewhere else.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

      Ah, so that's what the COP nodes are.

      While true, what you are saying rather stresses my meaning than contradict it. Changing pointers in the op tree isn't something you do in routine Perl programming.

      Anno

      ... and change the bindings of all CVs compiled within that scope, if it's important.