|Think about Loose Coupling|
designing a program - your wisdom neededby SpaceCowboy (Acolyte)
|on Jan 20, 2022 at 06:18 UTC||Need Help??|
SpaceCowboy has asked for the wisdom of the Perl Monks concerning the following question:
I would like your wisdom and advice on designing on following. I am looking to extract tables from a database and start executing SQL statements in a certain order.
so far, I have four perl programs, primary.pl, first.pl, second.pl, third.pl. primary will be the main program in which i am calling the other three scripts.
primary.pl will call the scripts, first.pl and second.pl will create temp table schema and each will run a huge query that loads data into respective temp table schema. third.pl will join the two temp tables from first and second and load it into third.
my question is,
How can I declare the database connection parameters just once?
when I call the scripts, the first/second/third wont execute without the database connection parameters mentioned in each one of them
how can I serialize the execution? such that subsequent scripts execute if and only if the first one executes successfully.
Is it possible to write multiple statements like dbh->do("create temp schema", "insert table");
Any general wisdom here? am I doing something outlandish?
thank you for your time