Does Perl use a monkey patch to view patches?

I decapitate the package using the technique at the beginning of “How can I defuse an instance method in Perl?” . The problem I am facing is that the original subroutine used a mypackage-level variable that apparently does not have access to the corrected subroutine, either by the full path specification, or by implicit use.

Is there a way to access the data specified in this way for use in a fixed routine?

+3
source share
3 answers

You can get vocabulary using PadWalker . Evil, but it works.

+7
source

No. What you're wrong - this package is not . A lexical variable is, by definition, limited to its lexical domain, in other words, the block in which it is located.

+5
source

(.. "my" ) ( ), . , .

/, , var, var - .

, " ". . var "", "", .

0
source

Source: https://habr.com/ru/post/1702161/


All Articles