The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
How can I declare the database connection parameters just once? In general, you can share such data between different scripts by:
Note that here the module option is perhaps best because the module can handle not just shared data but also shared operations such as creating the database connection, handling errors/exceptions, serialising/encoding data, etc. Or you could combine two of them - have a module to handle all this and then that module could read the config file or environment variable, etc. how can I serialize the execution? such that subsequent scripts execute if and only if the first one executes successfully. You can do this in any number of ways, but I wouldn't. It is almost never a smart move to call a Perl script directly from another Perl script. Call it an antipattern if you like. Far better to take the second script and put all of its operations in a module instead. The second script then just becomes a wrapper around that module should you ever want to run it independently. The code in the module can be run from any script (or module) which uses it. Any general wisdom here? General rule: don't shell out from Perl to run Perl. 🦛 In reply to Re: designing a program - your wisdom needed
by hippo
|
|