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/;
>
> 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
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
$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;
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
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
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
> -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
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
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
10 matches
Mail list logo