in reply to What are (popular) modules that access/modify @ARGV?
If you want to do easy restart properties for failed jobs, logging @ARGV will not help you. At least, I have cases where there is a distinct difference, passing time, which makes reusing the exact command line switches unfeasible in my case.
I have lots of "convenience" command line switches, mostly used for crontab entries which select reporting dates:
./my_job --date prev-workday foo bar
Of course, if such a job has failed, restarting it with that command line is not useful as the prev-workday now may well be a different date than what it was when the job failed.
To solve this problem, I have come to the pattern of logging the parameters of the "main subroutine" for the job for restarting. The main subroutine must be called with what I call "effective parameters", that is, no more relative dates but only absolute information:
GetOptions( 'date:s' => \my $reporting_date, ); $reporting_date||= $today; $reporting_date= Corion::Calendar->dwim( $date )->ymd; # convert symbo +lic names to YYYYMMDD generate_report( reporting_date => $reporting_date, ... );
generate_report then logs its parameters for easy restarting, and in the case of an error usually outputs a command line that can be pasted verbatim into a console session verbatim to restart the job.
|
|---|