DBI errors with create_from_cgi ?

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

From: Jesse Sheidlower
Subject: DBI errors with create_from_cgi ?
Date: 22:45 on 19 May 2004
I was trying to write a small patch for one of the drivers for Maypole,
a CDBI-based framework with which some on this list are familiar. But
in one place I've run into a problem I'm not sure how to deal with.

The original code for handling creates or updates is:

    if ($obj) {
        # We have something to edit
        $obj->update_from_cgi($h);
    } else {
        $obj = $self->create_from_cgi($h);
    }
    if (my %errors = $obj->cgi_update_errors) {

This is using FromCGI; I wanted to modify this to allow for
the possibility of required columns, so I changed this to:

    if ($obj) {
        # We have something to edit
        $obj->update_from_cgi($h => {
	   required => $r->{config}{$r->{table}}{required_cols} || [],
				    });
    } else {
        $obj = $self->create_from_cgi($h => {
	   required => $r->{config}{$r->{table}}{required_cols} || [],
				    });
    }
    if (my %errors = $obj->cgi_update_errors) {

(The $r->{config}{$r->{table}}{required_cols} is, of course, supposed to
be an arrayref for required columns.)

When I run this on an existing object, and leave out a required column,
it works as expected: an error gets set and Maypole bounces me back to
the edit page. However, when I try to create a new object, and leave out
a required column, it hangs and eventually dumps acres of:

Out of memory during request for 104 bytes, total sbrk() is 489920512 bytes!
Out of memory during request for 112 bytes, total sbrk() is 489920512 bytes!
Out of memory during request for 112 bytes, total sbrk() is 489920512 bytes!
[...]

into my Apache error logs.

Is there anything I am missing here? Or could this be some nasty underlying
problem? Out-of-memory errors are way beyond me; that's why I use Perl ;-).

Thanks.

Jesse Sheidlower

DBI errors with create_from_cgi ?
Jesse Sheidlower 22:45 on 19 May 2004

Re: DBI errors with create_from_cgi ?
Perrin Harkins 22:58 on 19 May 2004

Re: DBI errors with create_from_cgi ?
Jesse Sheidlower 23:07 on 19 May 2004

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