in reply to Take reference and then dereference die() and warn()
$SIG{'__WARN__'} = sub { die @_ } if $die_on_error; warn "foooooo";
Does not quite work if you allow your code to spit out warnings for other reasons. In that case, you have to tag your speacial warnings, e.g.:
$SIG{'__WARN__'} = sub { die @{$_[0]} if ref $_[0] eq 'ARRAY'; warn @_ +; } if $die_on_error; warn "foooooo"; # never dies warn ["foooooo"]; # sometimes dies
|
|---|