Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: DBIx::Class die on warning

by hippo (Bishop)
on Apr 04, 2020 at 13:58 UTC ( [id://11115043]=note: print w/replies, xml ) Need Help??


in reply to DBIx::Class die on warning

p.s. I could localise __WARN__ to an outer scope but messes up other warn()'s.

So go for best of both worlds?

{ my $obj; local $SIG{__WARN__} = sub { die "died with $_[0], the object was $o +bj" } for $obj (@objstoinsert){ $obj->insert() } }

Replies are listed 'Best First'.
Re^2: DBIx::Class die on warning
by bliako (Monsignor) on Apr 04, 2020 at 14:47 UTC

    thanks, i thought perhaps there was another way... that loop is a simplification, plus there are calls to other subs which also use warn(). So I will have to change using warn() for debug messages to something else which also provides automatic line numbers. Can be confess() perhaps.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-25 14:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found