Re: Deep recusrion problem

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

From: Tony Bowden
Subject: Re: Deep recusrion problem
Date: 06:01 on 07 May 2004
On Fri, May 07, 2004 at 12:36:17AM -0400, Drew Taylor wrote:
> 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.

I can't replicate this :(

I'm using:

------

package Foo::Model;
use base 'Class::DBI::Test::SQLite';
__PACKAGE__->set_table('profile');
__PACKAGE__->columns(Primary=>'id');
__PACKAGE__->columns(All=>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']);

sub create_sql { q{
  id INTEGER PRIMARY KEY,
  first VARCHAR,
  last VARCHAR,
  city VARCHAR,
  state VARCHAR,
  zip VARCHAR,
  email VARCHAR,
  year VARCHAR,
  gender VARCHAR,
  training_goal VARCHAR,
  run_hours VARCHAR,
  bike_hours VARCHAR,
  swim_hours VARCHAR,
  run_time VARCHAR,
  bike_time VARCHAR,
  swim_time VARCHAR,
  note VARCHAR,
  has_photo VARCHAR
}}

package Foo::App;

my $new = Foo::Model->create({ note => "Boo", has_photo => 0 });
my $id = $new->id;
undef $new;

if ($id) {
        $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";
}


------

Perhaps you could tweak that into something that fails?

(Class::DBI::Test::SQLite, is available at
http://www.tmtm.com/CPAN/SQLite.pm - it will be part of the distribution
in the next version of Class::DBI)

Tony

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