Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: designing a program - your wisdom needed

by Corion (Patriarch)
on Jan 20, 2022 at 07:12 UTC ( [id://11140627]=note: print w/replies, xml ) Need Help??


in reply to designing a program - your wisdom needed

If all that's different between your three "workhorse" programs is the SQL, why not read/run the SQL in the main program?

$dbh->do(<<SQL); -- create first temp table SQL $dbh->do(<<SQL); -- create second temp table SQL $dbh->do(<<SQL); -- create third temp table SQL

... or read the SQL from three files and run that SQL:

for my $file ("first.sql", "second.sql", "third.sql") { open my $fh, '<', $file or die "$file: $!"; local $/; my $sql = <$fh>; $dbh->do( $sql ); }

... or, if you prefer a canned solution, take a look at DBIx::RunSQL, which runs SQL from strings or files, and has some (rough) logic to execute multiple SQL statements from a single file.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11140627]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-25 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found