in reply to Re: Re: script dies with 'broken pipe'-message, even in eval
in thread script dies with 'broken pipe'-message, even in eval

Ah! I see an issue.
you are using a database handle ($dbh) to execute something. execute is a method for a statement handle ($sth). Also...
How are you setting up your database connection?
Are you setting RaiseError?
$dbh = DBI->connect( 'dbi:Oracle:tnsname', 'userid', 'password', {RaiseError => 1} );
If not you would have to check for an error after every call like ...
$sth->execute(@args) || die $sth->errstr();
Instead of being able to trap errors in an eval

Replies are listed 'Best First'.
Re: Re: Re: Re: script dies with 'broken pipe'-message, even in eval
by eXile (Priest) on May 25, 2004 at 20:42 UTC
    Hi,

    I'm sorry, the '$dbh->execute' was a typo, I fixed it in the original question.

    My $dbh is initialised like this:

    $dbh = DBI->connect($sql_dsn, $sql_schema, $sql_auth); $dbh->{LongReadLen} = $LongReadLen;
    Don't think the LongReadLen has anything to do with this.

    I haven't tried using RaiseError, but then the question still remains why my eval doesn't trap the 'broken pipe' error? I don't want my program to die that easily on me.

      Using eval to try and catch errors with DBI code is useless unless you set RaiseError on.
      Try that and possibly something like...
      local $SIG{PIPE} = sub {die "Unable to execute"};
      before the execute you know is going to fail.