Sandy has asked for the wisdom of the Perl Monks concerning the following question:
I am currently fighting with some legacy code (which I am embarrassed to say that I wrote myself) which cannot be changed.
In this file, I have a code that is equivalent to:
This works because I call foo before the subroutine is processed, so there were no flags years ago to fix it.package Somename; foo(1,2,3,4,5); sub foo($;$$) { my $one = shift; my $two = shift; my $three = shift; my $four = shift; my $five = shift; # long complicated code
Today, I need this function foo in another program, so I do this:
And now this doesn't work because 'foo' is compiled before I call it.use Somename; Somename::foo(1,2,3,4,5);
Is there any chance that I could tell perl to ignore my past foolishness, and just forget that there is '($:$$)'?
Thanks, Sandy
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Fighting sub foo($;$$)
by haukex (Archbishop) on Apr 14, 2023 at 20:47 UTC | |
|
Re: Fighting sub foo($;$$)
by ikegami (Patriarch) on Apr 16, 2023 at 00:03 UTC | |
|
Re: Fighting sub foo($;$$)
by LanX (Saint) on Apr 14, 2023 at 22:17 UTC | |
|
Re: Fighting sub foo($;$$)
by LanX (Saint) on Apr 14, 2023 at 20:38 UTC | |
by haukex (Archbishop) on Apr 14, 2023 at 20:53 UTC | |
by LanX (Saint) on Apr 14, 2023 at 21:47 UTC |