Inherited a venerable project some time ago, full of amazing wonder and delight which dates back to the ancient time of perl 4.036. It's been well cared for over the years, and despite many perl version upgrades has performed successfully in every way, only needing minor tweaks and such to keep it 100% functional. A marvel.
These days, the code has now met its match in terms of syntax, and I guess the looser assumptions of how modules get require'd and how calls get made no longer hold true. An example in really short terms, given a script and its package, main.pl and package.pl.
main.pl: #/usr/bin/perl print "Entry point\n"; log('started'); sub log { # do the usual to open the logile # now print it print LOG @_; # close it }
And now the package:
package.pl: package mutex; sub update { # do something and log it &main'log("can't do something"); } 1;
I'm waaay oversimplifying many lines of code, but you get the idea.
So, in the old days, this would work: The package could call a routine in the calling routine and continue. It seems this worked fine until around perl 5.26 and now we get the "Undefined subroutine &main::log called at". Has the way this once worked before changed? Before anyone asks: There's a lot going on in the log() routine that would make it very hard to locate into its own package, and even then, I'm not sure package calling package will work.
Thanks,
In reply to Perl's changes in the use of packages by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |