Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: DBI and Constant

by bbfu (Curate)
on Feb 12, 2001 at 14:43 UTC ( [id://57869]=note: print w/replies, xml ) Need Help??


in reply to DBI and Constant

Hrm. I think you'll have to use string concatenation:

use constant DBNAME => "database_test"; ... my $dbh = DBI->connect('DBI:mysql:database=' . DBNAME, 'username', 'pa +ssword') or die "$0: can't connect to DB: " . DBI->errstr . "\n";

The optimizer is probably smart enough to do the concatenation at compile time since it's smart enough to do the function inlining...

bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-25 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found