On Fri, 2005-08-05 at 07:42 -0700, Basith Salman wrote:
> 
>  Hi All,
> 
> I was wondering if there is way to suppress the error messages on the stdout
> from a perl dbi execute command, basically  if I do a 
> sth->execute() on a command and say the row cannot be updated then
> I get a err msg to stdout if there is foreign key violation, I want this 
> error message
> to be directed to a log file.

>From perldoc DBI: 

  "PrintError" (boolean, inherited)
      The "PrintError" attribute can be used to force errors to 
      generate warnings (using "warn") in addition to returning 
      error codes in
      the normal way.  When set "on", any method which results in
      an error occuring will cause the DBI to effectively do a
      "warn("$class $method failed: $DBI::errstr")" where $class
      is the driver class and $method is the name of the method
      which failed. E.g.,
...
      By default, "DBI->connect" sets "PrintError" "on".

      If desired, the warnings can be caught and processed using a
$SIG{__WARN__} handler or modules like CGI::Carp and CGI::ErrorWrap.


is this what you want ?

it seems that the error messages go to STDERR, not STDOUT.
maybe a 2> error.log ?

gnari



---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to