here a shorter test, avoiding string evals and concentrating on croak.

(line 72 is inside sub client0)

You can uncomment other cases if needed.

-*- mode: compilation; default-directory: "d:/tmp/job/" -*- Compilation started at Thu Sep 30 19:14:48 C:/Strawberry/perl/bin\perl.exe -w d:/tmp/job/test_carp.pl xxxxxxxxx Perl-Version 5.032001 MSWin32S ********* Setting Verbose to 0 ====== Testing <croak> ... from SAME package error-messageby <croak> from SAME package at d:/tmp/job/test_carp.pl l +ine 54. SAME::throw0("SAME", "croak") called at d:/tmp/job/test_carp.pl li +ne 63 SAME::throw1("SAME", "croak") called at d:/tmp/job/test_carp.pl li +ne 67 SAME::throw2("SAME", "croak") called at d:/tmp/job/test_carp.pl li +ne 82 SAME::client0("SAME", "croak") called at d:/tmp/job/test_carp.pl l +ine 85 SAME::client1("SAME", "croak") called at d:/tmp/job/test_carp.pl l +ine 42 eval {...} called at d:/tmp/job/test_carp.pl line 42 ... from OTHER package error-messageby <croak> from OTHER package at d:/tmp/job/test_carp.pl +line 74. ... from THIRD package error-messageby <croak> from THIRD package at d:/tmp/job/test_carp.pl +line 74. ********* Setting Verbose to 1 ====== Testing <croak> ... from SAME package error-messageby <croak> from SAME package at d:/tmp/job/test_carp.pl l +ine 54. SAME::throw0("SAME", "croak") called at d:/tmp/job/test_carp.pl li +ne 63 SAME::throw1("SAME", "croak") called at d:/tmp/job/test_carp.pl li +ne 67 SAME::throw2("SAME", "croak") called at d:/tmp/job/test_carp.pl li +ne 82 SAME::client0("SAME", "croak") called at d:/tmp/job/test_carp.pl l +ine 85 SAME::client1("SAME", "croak") called at d:/tmp/job/test_carp.pl l +ine 42 eval {...} called at d:/tmp/job/test_carp.pl line 42 ... from OTHER package error-messageby <croak> from OTHER package at d:/tmp/job/test_carp.pl +line 54. SAME::throw0("OTHER", "croak") called at d:/tmp/job/test_carp.pl l +ine 63 SAME::throw1("OTHER", "croak") called at d:/tmp/job/test_carp.pl l +ine 67 SAME::throw2("OTHER", "croak") called at d:/tmp/job/test_carp.pl l +ine 74 OTHER::client0("OTHER", "croak") called at d:/tmp/job/test_carp.pl + line 77 OTHER::client1("OTHER", "croak") called at d:/tmp/job/test_carp.pl + line 42 eval {...} called at d:/tmp/job/test_carp.pl line 42 ... from THIRD package error-messageby <croak> from THIRD package at d:/tmp/job/test_carp.pl +line 54. SAME::throw0("THIRD", "croak") called at d:/tmp/job/test_carp.pl l +ine 63 SAME::throw1("THIRD", "croak") called at d:/tmp/job/test_carp.pl l +ine 67 SAME::throw2("THIRD", "croak") called at d:/tmp/job/test_carp.pl l +ine 74 OTHER::client0("THIRD", "croak") called at d:/tmp/job/test_carp.pl + line 90 THIRD::client0("THIRD", "croak") called at d:/tmp/job/test_carp.pl + line 93 THIRD::client1("THIRD", "croak") called at d:/tmp/job/test_carp.pl + line 42 eval {...} called at d:/tmp/job/test_carp.pl line 42 Compilation finished at Thu Sep 30 19:14:48

use strict; use warnings; package SAME; use Carp; use Data::Dumper; sub out { $_[0] =~ m/^([-.*=]+ )/; my $nl = "\n" x ( length($1//0)/3); warn $nl, @_,"\n" } out "xxxxxxxxx Perl-Version $] $^OS"; #out '========= default $Carp::Verbose = ',$Carp::Verbose; my $err_msg = "error-message"; for my $verbose ( 0, 1, ) { if (defined $verbose) { $Carp::Verbose = $verbose; out "********* Setting Verbose to $verbose"; } no warnings 'redefine'; # --- types of dieing for my $type ( # "die", "croak", # "confess", ) { out "====== Testing <$type>"; for my $PACKAGE (qw/SAME OTHER THIRD/) { out "... from $PACKAGE package"; eval { $PACKAGE->client1($type) } or out $@; } } } sub throw0 { my ($pkg,$type) = @_; my $err_msg = $err_msg . "by <$type> from $pkg package"; eval { goto $type } or die "Testcase '$type' not implemented"; croak: croak $err_msg; die: die $err_msg; confess: confess $err_msg; } sub throw1 { throw0(@_) } sub throw2 { throw1(@_) } package OTHER; sub client0 { SAME::throw2(@_); }; sub client1 { client0(@_); }; package SAME; sub client0 { SAME::throw2(@_); }; sub client1 { client0(@_); }; package THIRD; sub client0 { OTHER::client0(@_); }; sub client1 { client0(@_); };

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery


In reply to Re^2: $Carp::Verbose ? (SOLVED) by LanX
in thread $Carp::Verbose ? (SOLVED) by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.