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 (Abbot) 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.