SPUG: Using a Duplicate Value Error Message

Fred Morris m3047 at inwa.net
Tue Mar 20 18:17:04 PDT 2007

Golly you're right:

my $rv = $sth->execute();
$an_error = (! $rv);

Of course, reading the documentation would make all this clear.

On Tuesday 20 March 2007 10:20, Colin Meyer wrote:
> On Tue, Mar 20, 2007 at 08:53:10AM -0700, Fred Morris wrote:
> > Hello Will, welcome to the list!
> >
> > Without critiquing style (doesn't this come down to style?), isn't the
> > answer obviously that what you'd normally do at that point in the code is
> > display whatever congratulations page you're planning to send to the user
> > for registering? You have to send something to the user as a success page
> > if they are successful.
> >
> > FIRST: You have to test $sth for success, that is to say
> >   $an_error = (! $sth);
> Note that $sth will have a false value only if $dbh->prepare( $sql )
> failed. If $sth was created successfully, but an error occurred during
> $sth->execute(), then $sth will still hold a true value (which is the
> statement handle object).

More information about the spug-list mailing list