Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://510971]
and dust plays in a shaft of sunlight...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2018-06-25 08:19 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.