Deep recusrion problem

[prev] [thread] [next] [Date index for 2004/05/07]

From: Drew Taylor
Subject: Deep recusrion problem
Date: 04:36 on 07 May 2004
Hi all,
I've run into a problem with deep recursion using CDBI 0.96 & latest 
Ima::DBI. Nothing fancy - just your everyday cgi script. My apache has 
mod_perl compiled in but the script is running under cgi-handler. I've 
included some minimal code below that might help. Basically, I'm trying 
to update a column value and getting hung. The part I don't understand 
is that I'm using the same $model to successfully update the other 
columns before the photo code below.

package Foo::Model;
__PACKAGE__->table('profile');
__PACKAGE__->columns(Primary=>'id');
__PACKAGE__->columns(Essential=>qw(first last city state zip email year
				   gender training_goal run_hours
				   bike_hours
				   swim_hours run_time bike_time
				   swim_time note has_photo
				  ));
__PACKAGE__->constrain_column(has_photo=>['0','1']);

package Foo::App;
use Foo::Model;

my $q = CGI->new;
my $id = $q->param('id');
my $photo = $q->upload('photo');
if ($photo) {
	$model = Foo::Model->retrieve($id);
	print STDERR "Setting photo column\n";
	$model->has_photo('1');
	print STDERR "Commiting changes to database...\n";
	$model->update;
	print STDERR "DONE!\n";
}

Error messages:
Setting photo column
Commiting changes to database...
Deep recursion on anonymous subroutine at 
/usr/local/lib/perl5/site_perl/5.8.4/Class/DBI.pm line 852.
Deep recursion on subroutine "Class::DBI::get" at 
/usr/local/lib/perl5/site_perl/5.8.3/Class/Accessor.pm line 350.
Deep recursion on subroutine "Class::DBI::_flesh" at 
/usr/local/lib/perl5/site_perl/5.8.4/Class/DBI.pm line 840.

The offending line of Class/DBI.pm appears to be:
@row{@want} = $self->sql_Flesh(join ", ", @want)->select_row($self->id);

Help! I'm going to bed now and hope it fixes itself magically tomorrow. :-)
        -- 
        ---------------------------------------------------------
Drew Taylor          *  Web app development & consulting
drew@xxxxxxxxxx.xxx  *  Site implementation & hosting
www.drewtaylor.com   *  perl/mod_perl/DBI/mysql/postgres
---------------------------------------------------------

Deep recusrion problem
Drew Taylor 04:36 on 07 May 2004

Re: Deep recusrion problem
Tony Bowden 06:01 on 07 May 2004

Re: Deep recusrion problem
Drew Taylor 12:48 on 07 May 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52