I have some code file beginning like
use my_pck;
BEGIN {
package my_pck;
my(@p) = ();
foreach ( keys(%my_pck::) ) {
push( @p, "\$$_" ) if (defined $$_);
push( @p, "\%$_" ) if (%$_);
push( @p, "\@$_" ) if (@$_);
}
# ... some extra
( @EXPORT = @p, Exporter::import pal ) if ( $#p >= 0 );
}
use strict;
use warnings;
package my_pck;
This part I can't change (except adding something at "some extra").
So now there is a sub called "my_today" in it and because I need to use package my_pck
its available everywhere und used often in the source file. This method gives the current day as numer in the format "YYYYMMDD".
To check some testdata from the previous day, I need to redefine this method to give the previous day too.
I tried to redefined it by
sub my_today {
my $date = my_pck::my_today();
$date = my_datefunc($date, "-", 1) # substracts one day
return $day;
}
But so I get an error:
Subroutine my_today redefined at ./my_file.pl line 123.
Deep recursion on subroutine "my_pck::my_today" at ./my_file.pl line 124.
Out of memory!
How can I solve this? I can't change the whole code cause it's too much.