[prev] [thread] [next] [Date index for 2006/02/09]
CDBI'ers: I've started really using Class::DBI (3.0.14) on a development server at work and have been proselytizing my cow-orkers to convert. It's mostly going very well, but it appears that CDBI errors occasionally take down our Apache server. Specifically, since I added the use of CDBI classes to this one CGI script, Apache has been locking up at least once or twice a day. When I look in the error logs just after this happens, I see errors like the following: > Subroutine Gramene::CDBI::Literature::retrieve_all redefined at / > usr/local/lib/perl5/site_perl/5.8.6/Class/DBI/Plugin/RetrieveAll.pm > line 88. > Subroutine Gramene::CDBI::Markers::retrieve_all redefined at /usr/ > local/lib/perl5/site_perl/5.8.6/Class/DBI/Plugin/RetrieveAll.pm > line 88. > Subroutine Gramene::CDBI::retrieve_all redefined at /usr/local/lib/ > perl5/site_perl/5.8.6/Class/DBI/Plugin/RetrieveAll.pm line 88. > Use of uninitialized value in concatenation (.) or string at /usr/ > local/lib/perl5/site_perl/5.8.6/Class/DBI/Relationship.pm line 67. > Use of uninitialized value in concatenation (.) or string at /usr/ > local/lib/perl5/site_perl/5.8.6/Class/DBI/Relationship/HasMany.pm > line 86. > Use of uninitialized value in join or string at /usr/local/lib/ > perl5/site_perl/5.8.6/Class/DBI.pm line 47. > Use of uninitialized value in list assignment at /usr/local/lib/ > perl5/site_perl/5.8.6/Class/DBI/Relationship.pm line 63. > search_count_search_where() already exists at /usr/local/lib/perl5/ > site_perl/5.8.6/Class/DBI/Plugin/AbstractCount.pm line 13 > search_retrieve_all_sorted() already exists at /usr/local/lib/perl5/ > site_perl/5.8.6/Class/DBI/Plugin/RetrieveAll.pm line 64 As this has been happening, I've been hacking the CDBI source to fix what are mostly assumptions about the definedness of variables and the ability to use them as (array|hash) refs, etc. I used Module::Build::Convert to quickly make a Build.PL so I could then do "Build diff" to see all the changes I've made. Here they are: diff /usr/local/lib/perl5/site_perl/5.8.6/Class/DBI/Relationship.pm blib/lib/Class/DBI/Relationship.pm 23c23 < $class->clear_object_index if defined $class; --- > $class->clear_object_index; 42,44c42 < if ( defined $self->class ) { < $self->class->_extend_meta($self->name => $self->accessor => $self); < } --- > $self->class->_extend_meta($self->name => $self->accessor => $self); 64c62 < my $class = $self->class || ''; --- > my $class = $self->class; 67d64 < next unless $method; diff /usr/local/lib/perl5/site_perl/5.8.6/Class/DBI/Relationship/ HasMany.pm blib/lib/Class/DBI/Relationship/HasMany.pm 57,60c57,58 < if ( ref $self->args eq 'HASH' ) { < $self->class->_extend_class_data( < __hasa_list => $self->foreign_class => $self->args-> {foreign_key}); < } --- > $self->class->_extend_class_data( > __hasa_list => $self->foreign_class => $self->args->{foreign_key}); 66,67d63 < return unless ref $self->args eq 'HASH'; < 84c80 < my $accessor = $self->accessor || ''; --- > my $accessor = $self->accessor; 123,137c119,126 < if ( ref $self->args eq 'HASH' < && ref $self->args->{mapping} eq 'ARRAY' < ) { < my @mapping = @{ $self->args->{mapping} }; < return sub { < return $run_search->(@_)->set_mapping_method(@mapping) < unless wantarray; < my @ret = $run_search->(@_); < foreach my $meth (@mapping) { @ret = map $_->$meth(), @ret } < return @ret; < }; < } < else { < return $run_search; < } --- > my @mapping = @{ $self->args->{mapping} } or return $run_search; > return sub { > return $run_search->(@_)->set_mapping_method(@mapping) > unless wantarray; > my @ret = $run_search->(@_); > foreach my $meth (@mapping) { @ret = map $_->$meth(), @ret } > return @ret; > } Do these look like reasonable changes? Does anyone else have such serious problems with CDBI that it crashes Apache (to the point that even static pages cannot be served)? Should I submit these to rt.cpan.org for Tony to integrate? ky _______________________________________________ ClassDBI mailing list ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
[CDBI] Errors with CDBI
|
Re: [CDBI] Errors with CDBI
|
Generated at 23:19 on 12 Feb 2006 by mariachi v0.52