carp

Carp reporting from the wrong location with @CARP_NOT (Moose and Method Modifiers)

点点圈 提交于 2019-12-11 14:15:58
问题 This is a followup question to warnings::warnif( 'deprecated' … ) with carp?. here's a snippet of my code from Business::CyberSource on Github note: the previous answer (in the previous question), and adding of @CARP_NOT have demonstrated that warnings::warnif uses carp . I attempted to substitute carp directly, the behavior was exactly the same. our @CARP_NOT = ( __PACKAGE__, qw( Class::MOP::Method::Wrapped ) ); around BUILDARGS => sub { my $orig = shift; my $class = shift; my $args = $class

How can I replace all 'die's with 'confess' in a Perl application?

冷暖自知 提交于 2019-12-04 08:05:35
问题 I'm working in a large Perl application and would like to get stack traces every time 'die' is called. I'm aware of the Carp module, but I would prefer not to search/replace every instance of 'die' with 'confess'. In addition, I would like full stack traces for errors in Perl modules or the Perl interpreter itself, and obviously I can't change those to use Carp. So, is there a way for me to modify the 'die' function at runtime so that it behaves like 'confess'? Or, is there a Perl interpreter

Why should I use Carp instead of warn in Perl?

大城市里の小女人 提交于 2019-12-03 10:45:33
问题 People keep giving me examples with carp instead of warn. Why? What makes carp better than warn? 回答1: carp gives you more info as to where the message comes from (context) #!/usr/bin/perl use Carp; foo(); bar(); baz(); sub foo { warn "foo"; } sub bar { carp "bar"; } sub baz { foo(); bar(); } produces foo at ./foo.pl line 9. bar at ./foo.pl line 13 main::bar() called at ./foo.pl line 6 foo at ./foo.pl line 10. bar at ./foo.pl line 14 main::bar() called at ./foo.pl line 19 main::baz() called at