Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: DBI Application Development

by sundialsvc4 (Abbot)
on Dec 20, 2013 at 22:50 UTC ( #1067998=note: print w/ replies, xml ) Need Help??


in reply to DBI Application Development

Please tell us more about your requirement.   As you know, DBI already handles the “mechanics” of interfacing with Postgres (or any other ...) database, so the question before the house appears to be, “what’s a good way to let the user specify which query he wants to run?”   A command-line parameter value is a fine way to do it.   I would suggest that the main-program chooses among 12 different subroutines to call (thus keeping the main small and simple), and that each of these 12, insofar as possible, calls one or more common subroutines to do whatever turns out to be common among all of them.

This is also a fine time to learn about packages and classes, because these are an excellent way to provide for “common functionality.”   (Maybe, instead of calling a subroutine, the main routine instantiates an instance of one of 12 classes, each of which inherits from a common ancestor, and tells that instance to, say, run().   The specific subclass encompasses what is unique about a particular request, while the parent class from which they all derive encompasses what is common between them all.


Comment on Re: DBI Application Development
Re^2: DBI Application Development
by justsomeguy (Novice) on Dec 23, 2013 at 16:27 UTC

    Both replies show the sort of different approach I'm looking for.

    The application will run remote scans on a group of a few thousand servers. It checks for software version and confirms function. The current monstrosity is written in /bin/sh and lacks a lot of finesse, but did provide the basic remote command set, which I am going to leverage through a new Perl-based foundation code.

    Anyway, the way it will work is this: Command invoked with no flag will initiate a scan of the entire environment of anything not scanned in the last 24 hours. There will need to be command-line switches and/or arguments to specify groups of servers based on admin owner or environment, or date since last scan, or specific result codes kept in the datatabase with the scan record. In any of these cases, it will be necessary to make a call to the database to assemble a list of hosts for scanning.

    So in the case of the user wanting to scan all dev hosts belonging to the Java team that scored less than 400 on the scan and haven't been scanned in one month, the command line might look like:

    Scanner.pl -O java -E dev -R 400 -D 1M <\p>

    Thanks for the suggestions so far. I'm getting inspired.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2014-12-27 21:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls