Skip Menu |

This queue is for tickets about the Ima-DBI CPAN distribution.

Report information
The Basics
Id: 12070
Status: open
Priority: 0/
Queue: Ima-DBI

People
Owner: Nobody in particular
Requestors: dhoworth [...] mrc-lmb.cam.ac.uk
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 0.33
Fixed in: (no value)



Subject: spurious warning
I am seeing the following warning: Subroutine db_Main redefined at /usr/local/share/perl/5.6.1/Ima/DBI.pm line 282 (#1) (W redefine) You redefined a subroutine. To suppress this warning, say { no warnings; eval "sub name { ... }"; } I suggest the following additional line at line 282: no strict 'refs'; + no warnings 'redefine'; *{ $class . "::db_$db_name" } = $class->_mk_db_closure($data_source, $user, $password, $attr); Cheers, Dave
Date: Thu, 31 Mar 2005 00:13:49 +0100
From: Tony Bowden <tony [...] kasei.com>
To: Guest via RT <bug-Ima-DBI [...] rt.cpan.org>
Subject: Re: [cpan #12070] spurious warning
RT-Send-Cc:
On Wed, Mar 30, 2005 at 07:24:24AM -0500, Guest via RT wrote: Show quoted text
> I am seeing the following warning: > Subroutine db_Main redefined at /usr/local/share/perl/5.6.1/Ima/DBI.pm line 282 (#1)
When you do what? Thanks, Tony
From: shiijaleee [...] yahoo.com
On Wed Mar 30 18:20:40 2005, tony@kasei.com wrote: Show quoted text
> On Wed, Mar 30, 2005 at 07:24:24AM -0500, Guest via RT wrote:
> > I am seeing the following warning: > > Subroutine db_Main redefined at
> /usr/local/share/perl/5.6.1/Ima/DBI.pm line 282 (#1) > > When you do what? > > Thanks, > > Tony
FWIW... I am using Class::DBI::Loader and my error is Subroutine ToRest::Ratings::db_Main redefined at /usr/local/share/perl/5.8.4/Ima/DBI.pm line 278 where ToRest is my namespace, and Ratings is the table in CDBI::Loader sense. however, this error only appears when mod_perl is enabled. okay under plain CGI mode. looks like in Class::DBI::Loader::Generic line 160 $class->connection(@{$self->{_datasource}}); this calls C::D's connection subroutine, calls set_db subrouting in C::D, then calls parents set_db where it calls no strict 'refs'; *{ $class . "::db_$db_name" } = $class->_mk_db_closure($data_source, $user, $password, $attr); Class::DBI v3.0.13 Class::DBI::Loader 0.32 thanks. Qiang
Subject: Re: [rt.cpan.org #12070] spurious warning
Date: Wed, 12 Apr 2006 06:30:41 +0100
To: Guest via RT <bug-Ima-DBI [...] rt.cpan.org>
From: Tony Bowden <tony [...] kasei.com>
On Tue, Apr 11, 2006 at 11:16:40PM -0400, Guest via RT wrote: Show quoted text
> I am using Class::DBI::Loader and my error is > Subroutine ToRest::Ratings::db_Main redefined at > /usr/local/share/perl/5.8.4/Ima/DBI.pm line 278
error? or warning? Show quoted text
> looks like in Class::DBI::Loader::Generic line 160 > $class->connection(@{$self->{_datasource}}); > this calls C::D's connection subroutine, calls set_db subrouting in > C::D, then calls parents set_db where it calls > no strict 'refs'; > *{ $class . "::db_$db_name" } = > $class->_mk_db_closure($data_source, $user, $password, $attr);
Looks to me like it actually *should* warn if there's already a method there. Are you calling this multiple times? Tony
From: shijialeee [...] yahoo.com
On Wed Apr 12 01:31:28 2006, tony@kasei.com wrote: Show quoted text
> On Tue, Apr 11, 2006 at 11:16:40PM -0400, Guest via RT wrote:
> > I am using Class::DBI::Loader and my error is > > Subroutine ToRest::Ratings::db_Main redefined at > > /usr/local/share/perl/5.8.4/Ima/DBI.pm line 278
> > error? or warning? >
it is warning. Show quoted text
> > looks like in Class::DBI::Loader::Generic line 160 > > $class->connection(@{$self->{_datasource}}); > > this calls C::D's connection subroutine, calls set_db subrouting in > > C::D, then calls parents set_db where it calls > > no strict 'refs'; > > *{ $class . "::db_$db_name" } = > > $class->_mk_db_closure($data_source, $user, $password, $attr);
> > Looks to me like it actually *should* warn if there's already a method > there. Are you calling this multiple times? > > Tony
the reason why it generates warnings is because i create instance of Class::DBI::Loader in each request and resulting calling the *{ $class . "::db_$db_name" } multiple times in mod_perl persistent mode. that explains why it runs fine under plain cgi. Qiang
Subject: Re: [rt.cpan.org #12070] spurious warning
Date: Wed, 12 Apr 2006 16:45:59 +0100
To: Guest via RT <bug-Ima-DBI [...] rt.cpan.org>
From: Tony Bowden <tony [...] kasei.com>
On Wed, Apr 12, 2006 at 11:37:25AM -0400, Guest via RT wrote: Show quoted text
> > error? or warning?
> it is warning.
Seems like it's doing its job then... Show quoted text
> the reason why it generates warnings is because i create instance of > Class::DBI::Loader in each request and resulting calling the > *{ $class . "::db_$db_name" } > multiple times in mod_perl persistent mode. that explains why it runs > fine under plain cgi.
I don't think there's a bug here then. I would suggest that you turn off the warnings if you don't like them. Tony