Re: [CDBI] Patch to Class::DBI.pm to avoid warning on stringification

[prev] [thread] [next] [Date index for 2005/11/09]

From: Dave Howorth
Subject: Re: [CDBI] Patch to Class::DBI.pm to avoid warning on stringification
Date: 09:26 on 09 Nov 2005
On Tue, 2005-11-08 at 11:15 -0600, Ken Youens-Clark wrote:
> Hi,
> 
> I'm getting the following error filling up my Apache logs:
> 
> Use of uninitialized value in join or string at /usr/local/lib/perl5/ 
> site_perl/5.8.6/Class/DBI.pm line 47.

Why is it happening? The full code of that sub is:

sub stringify_self {
	my $self = shift;
	return (ref $self || $self) unless $self;    # empty PK
	my @cols = $self->columns('Stringify');
	@cols = $self->primary_columns unless @cols;
	return join "/", $self->get(@cols);
}

which implies that either you have undefined columns in your primary
keys or you have explicitly told it to stringify undefined values??

Cheers, Dave

> This happens on the stringification of classes.  The following patch  
> quiets things down:
> 
> $ diff DBI.pm.orig DBI.pm
> 47c47
> <       return join "/", $self->get(@cols);
> ---
>  >       return join "/", map { defined $_ ? $_ : '' } $self->get 
> (@cols);
> 
> Does that look reasonable?




_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] [OT] Procmail
Philip M. Gollucci 17:28 on 08 Nov 2005

Re: [CDBI] Patch to Class::DBI.pm to avoid warning on stringification
Dave Howorth 09:26 on 09 Nov 2005

Generated at 23:12 on 13 Nov 2005 by mariachi v0.52