Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Dynamic DSN w/ Class::DBI Example

by gryphon (Abbot)
on Apr 23, 2004 at 20:46 UTC ( #347744=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package Stuff;
    use base 'Class::DBI::mysql';
    
    ...
    use Stuff ('dbi:mysql:dbname', 'gryphon', 'password');
    my $item = Stuff::Item->retrieve(1);
    print $item->name, "\n";
    
  2. or download this
    use Class::DBI::AutoLoader (
      dsn       => 'dbi:mysql:dbname',
      username  => 'gryphon',
    ...
    );
    my $item = Stuff::Item->retrieve(1);
    print $item->name, "\n";
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://347744]
Approved by Thelonius
Front-paged by broquaint
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2021-03-02 08:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (41 votes). Check out past polls.

    Notices?