Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 14927
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: cpan [...] steffen-winkler.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: CGI::Carp::croak caller stack missing
If I use Carp croak shoes the caller stack. Then I write a CGI-Application and Carp is different, why? So I can't find errors croak is like die.
On Wed Oct 05 04:55:26 2005, STEFFENW wrote: Show quoted text
> If I use Carp croak shoes the caller stack. > Then I write a CGI-Application and Carp is different, why? > So I can't find errors croak is like die.
I'm sorry it took almost 4 years to get a reply through the bug tracker. I think your experience is due to the interaction between Carp and CGI::Carp. I'm marking this bug as "rejected" for now because no one else has complained in the last 4 years, and I don't think it's a CGI bug. If there's still something you'd like changed in CGI.pm, please submit a Test::More style test case which illustrates it, or other steps to reproduce it. Mark
Subject: Re: [rt.cpan.org #14927] CGI::Carp::croak caller stack missing
Date: Mon, 24 Aug 2009 21:26:37 +0200
To: bug-CGI.pm [...] rt.cpan.org
From: "Steffen Winkler" <steffen.winkler [...] gmx.net>
Code ---- use strict; use warnings; use Carp qw(carp croak confess cluck); sub ca { carp 'carp'} sub cr { eval {croak 'croak'}; print $@ } sub co { eval {confess 'confess'}; print $@ } sub cl { cluck 'cluck' } sub hr { print '-' x 60, "\n" } ca; hr; cr; hr; co; hr; cl; hr; require CGI::Carp; CGI::Carp->import(qw(carp croak)); ca; hr; cr; hr; co; hr; cl; hr; { # workaround for the silent croak no warnings qw(redefine); *croak = \&confess; } cr; hr; __END__ Output ------ carp at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 21 main::ca() called at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 27 ------------------------------------------------------------ croak at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 22 eval {...} called at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 22 main::cr() called at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 29 ------------------------------------------------------------ confess at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 23 eval {...} called at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 23 main::co() called at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 31 ------------------------------------------------------------ cluck at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 24 main::cl() called at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 33 ------------------------------------------------------------ [Mon Aug 24 21:25:02 2009] CGI-Carp.bat: carp at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 21 ------------------------------------------------------------ croak at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 22 ------------------------------------------------------------ confess at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 23 eval {...} called at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 23 main::co() called at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 42 ------------------------------------------------------------ [Mon Aug 24 21:25:02 2009] CGI-Carp.bat: cluck at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 24 [Mon Aug 24 21:25:02 2009] CGI-Carp.bat: main::cl() called at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 44 ------------------------------------------------------------ croak at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 22 eval {...} called at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 22 main::cr() called at C:\Dokumente und Einstellungen\Steffen\Desktop\CGI-Carp.bat line 53 ------------------------------------------------------------ -- steffen.winkler@gmx.net http://steffen-winkler.de/ http://www.xing.com/go/invite/3303102.73f421 Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser
Here is the t-script that does not fail using Carp and not CGI::Carp. --------------------------------------------------------------------- use strict; use warnings; use Test::More tests => 2; use Test::Exception; BEGIN { use_ok('CGI::Carp', qw(croak) ); } sub cr { croak 'croak' } throws_ok( sub { cr() }, qr{\A croak \s at \s .*? \s at \s}xms, 'croak shows the caller stack', );
Here's a refactor of the test that avoids the dependency on Test::Exception: ### use strict; use warnings; use Test::More 'no_plan'; use CGI::Carp 'croak'; eval { croak 'croak' }; like($@, qr{\A croak \s at \s .*? \s at \s}xms, 'croak shows the caller stack'); ### I'm still hoping someone else will provide the actual bug fix.
No one else has expressed interest in this since 2009 or supplied a patch, so I'm marking this as resolved-due-to-old-age.