Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Having problem with handling DBI error in object

by perlCrazy (Monk)
on Jul 19, 2007 at 21:30 UTC ( #627633=note: print w/ replies, xml ) Need Help??


in reply to Re: Having problem with handling DBI error in object
in thread Having problem with handling DBI error in object

Thanks for reply. If any error happens then I don't want to die the program. If any $DBI::error then store and then access that error via calling program.
This is what I want to achieve. Just want to ensure that {ERROR_STR} should not have another error value if calling some other method.


Comment on Re^2: Having problem with handling DBI error in object
Re^3: Having problem with handling DBI error in object
by jZed (Prior) on Jul 19, 2007 at 21:41 UTC
    > If any error happens then I don't want to die the program.

    With RaiseError=0, and PrintError=1, that is just what will happen - the error message will be printed but the program will not die.

    If you run $obj->method1() and store its error message in $obj->{ERROR_MSG} and then run $obj->method2() which also stores its errors in that same place, yes you will overwrite the previous error. If you have that situation, you may need to store the errors in a hash with e.g. a timestamp as the key to the various errors. You might want to look at some of the modules used for DBI logging and tracing.

      Thanks.
      some limitations are here : I am passing the $dbh as handle to this module. so basically DBI::Connect method is getting called from some other place. like this:
      my $obj = module->new($dbh); $obj->getDDL(); $obj->method2();
      Any other problem did you see in getDDL method, sicne I am storing the value from $DBI::error str.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://627633]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2014-08-22 04:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (146 votes), past polls