We have a Perl script that is used for maintenance. I needed to change it to handle more tasks. The problem is that the script was compiled and the source was lost a long time ago.
I tried using B :: Deparse to recreate the file, but Deparse is not perfect and the output is broken (and very large - 5000 lines of dewaxed code).
After reading the dewaxed code, I found that I needed to change one function. The compiled script loads the plain-text script module, so I changed the module to override this function and complete the task I need to complete. The problem is that I can’t access the main script "my" variables.
Here is an example:
my $a = 1;
sub call_me {
print "unmodified";
}
use MOD;
call_me;
MOD.pm
package MOD;
main::{'call_me'} = sub {
print "\$main::a = $main::a\n";
}
: "$main::a =" .
.