Re: Passing references to DB handles between main and subs

2005-10-27 Thread David Nicol
On 10/27/05, Mark Knoop <[EMAIL PROTECTED]> wrote: > require Exporter; > my @ISA = qw(Exporter); > my @EXPORT = qw(GetDBHandle); @ISA and @EXPORT are going to be used outside of the file, so they should be C instead of C, if not use vars qw/@ISA @EXPORT/;

RE: Passing references to DB handles between main and subs

2005-10-27 Thread Mark Knoop
> > Your code blurb below is warning about subroutine redefinition > because what > appears to be an attempt at a function prototype is actually a function > definition. I generally don't use function prototypes in Perl. > > Your code blurb below is failing because you are not exporting > your CSAd

Re: Passing references to DB handles between main and subs

2005-10-27 Thread $Bill Luebkert
Mark Knoop wrote: > > Thanks. I now have the module as: > > ## > > package Common::CSAdmin; > > use strict; > use warnings; > > use DBI; > use DBD::ODBC; > > require Exporter; > my @ISA = qw(Exporter); > my @EXPORT = qw(GetDBHandle); Try : our @ISA = qw(Exporter); ou

RE: Passing references to DB handles between main and subs

2005-10-27 Thread Mark Knoop
$Bill Luekbert wrote: > > Either change EXPORT_OK to EXPORT or change the use to : > > use Common::CSAdmin qw(GetDBHandle); > > Delete the return 1; > Thanks. I now have the module as: ## package Common::CSAdmin; use strict; use warnings; use DBI; use DBD::ODBC;

RE: Passing references to DB handles between main and subs

2005-10-27 Thread Charles K. Clarkson
Mark Knoop <> wrote: : I'm looking at something like the following: : : use strict; : use warnings; : use DBI; : use DBD::ODBC; # can this live solely in the module? You don't need this at all. DBI calls the appropriate driver from the connection string. : use Common::CSAdmin; # this is m

Re: Passing references to DB handles between main and subs

2005-10-27 Thread $Bill Luebkert
Mark Knoop wrote: > > Ah was getting confused between exporting and prototybing. Would like to > export it propertly so have removed the prototype and added the following > here (from examples): > > require Exporter; > my @ISA = qw(Exporter); > my @EXPORT_OK = qw(GetDBHandle); > return 1; Either

RE: Passing references to DB handles between main and subs

2005-10-27 Thread Chris Newman
I've done some DBI with mysql and postgresql. Here are my thoughts... First of all, you don't have to use OO to get this done. There are pros and cons to using OO and I won't belabor that here. Second, go straight to your local bookstore and pick up the following 2 O'Reilly books... 1. Programmi

RE: Passing references to DB handles between main and subs

2005-10-27 Thread Mark Knoop
> -Original Message- > From: $Bill Luebkert [mailto:[EMAIL PROTECTED] > Sent: 27 October 2005 17:29 > To: [EMAIL PROTECTED] > Cc: activeperl@listserv.activestate.com > Subject: Re: Passing references to DB handles between main and subs > > > Mark Knoop wrote: > > Hello > > > > I am trying

Re: Passing references to DB handles between main and subs

2005-10-27 Thread $Bill Luebkert
Mark Knoop wrote: > Hello > > I am trying to rationalize some of my code and would like to use a set of > common functions which do database stuff using DBI. > > The most logical way for me to do this would be to create a 'GetDBHandle' > function which passes back a handle to the database connect

Passing references to DB handles between main and subs

2005-10-27 Thread Mark Knoop
Hello I am trying to rationalize some of my code and would like to use a set of common functions which do database stuff using DBI. The most logical way for me to do this would be to create a 'GetDBHandle' function which passes back a handle to the database connection which can then be passed to