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

Re^2: Passing a database connection

by aufflick (Deacon)
on Nov 23, 2005 at 00:30 UTC ( #510971=note: print w/replies, xml ) Need Help??


in reply to Re: Passing a database connection
in thread Passing a database connection

If the rest of your code uses OO mechanisms, you might want to recode new() so it will work as a class method rather than calling it as a non OO sub (ie. Main::new). The example below also checks that the passed in var is a valid DBI object. If you had done that in your code, you would have received an error as soon as you called the new method.
package Main; use strict; my $dbh; sub new { my $class = shift; my $dbh = shift; UNIVERSAL::isa($dbh, 'DBI') or die "Main->new() was invoked without a valid DBI object"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://510971]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2017-10-23 18:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (282 votes). Check out past polls.

    Notices?