Perl Monk, Perl Meditation | |
PerlMonks |
Re^4: designing a program - your wisdom neededby Marshall (Canon) |
on Jan 21, 2022 at 20:16 UTC ( [id://11140686]=note: print w/replies, xml ) | Need Help?? |
As I mentioned before, all programs provide the shell with an exit status. No errors is indicated by 0. The simple thing is to make a batch file and stop executing Perl programs when you get a non zero status code (no matter if negative or positive).
You don't mention your OS. For Windows command line: perltest1.pl perltest2.pl running test.bat yields: So testperl1.pl returns code of 2. testperl2.pl never runs. There are all sorts of fancy things that can be done with shell scripts. My advice is to keep things simple. Just automate the running of separate commands for each Perl program. Don't use Perl to run Perl programs. And avoid other tricky module oriented syntax. If you have a bash shell on Unix, then there is an equivalent set of statements which will do the same thing.
Update: Since you are using an Oracle DB, I would just use one of the many INI modules on CPAN to read an INI file with account and password. You will have a small amount of "boiler plate" code to add to each of your programs, but I don't see a problem with that. And I guess you could pass the account and password to each of the programs from the command line. But overall, I think using an INI module is the least complicated way to do what you want.
In Section
Seekers of Perl Wisdom
|
|