Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: mod_perl and Global Variables

by cadfael (Friar)
on Nov 20, 2000 at 20:56 UTC ( [id://42526]=note: print w/replies, xml ) Need Help??


in reply to mod_perl and Global Variables

I'm not sure exactly what you are asking for here, but when I write scripts using DBI and DBD, I always put the parameters into variables (i.e. user name, password, db, server) so the script can be easily modified.
if(! $U){ $U = "foo"; } if(! $S){ $S = $ENV{"DSQUERY"};} if(! $S){ $S = "sybase"; } if(! $P){ $P = "foo_pw"; } if(! $DB){ $DB = "info"; }

The above is specific to Sybase, which uses an interface file and the DSQUERY environment variable to identify which server to query. The necessary variables default to a particular user name, password, server, and database, and will permit the script to run on a command line as well as a cgi script. If The script needs to query a different database, then all the user needs to do is change the default variables near the beginning of the script.

-----
"Computeri non cogitant, ergo non sunt"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-18 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found