Carp-Always-0.12/000755 000765 000024 00000000000 12014715500 014514 5ustar00ferreirastaff000000 000000 Carp-Always-0.12/Changes000644 000765 000024 00000004712 12014714410 016012 0ustar00ferreirastaff000000 000000 Revision history for Perl extension Carp::Always. $Id: Changes 1480 2007-07-30 14:35:04Z me $ 0.12 Tue Aug 21 2012 - fix failing t/pod.t due to bad encoding (CPAN #77656) 0.11 Wed Apr 18 2011 - fix test failure with Carp 1.25+ RT#75320 [thanks ANDK and greeneg] - Test::Base is required in BUILD (otherwise we haven't tested anything) 0.10 Fri Aug 19 2011 - fix typo in POD RT#68793 (also reported by Kai Moonbourn) - Carp::Always ate part of errors like 'foo at bar' RT#57385 (fix borrowed from Carp::Always::Color) - deal with non-string exceptions (borrowed from Carp::Always:Color as well) 0.09 Mon Jul 30 2007 - no need for updating - lib/Carp/Indeed.pm was moved to the deprecate Carp-Indeed distribution 0.08 Tue Mar 20 2007 - no need for updating - micro changes (POD, Makefile.PL, README) 0.07 Tue Oct 25 2006 - no real change, no need to upgrade - added taint checking to tests, with shebang "#!perl -T\n" - Always.pm and Indeed.pm moved to lib/Carp/ - "use strict" in Indeed.pm - $Carp::Indeed::VERSION = $Carp::Always::VERSION 0.06 Mon Jul 17 2006 - Carp::Indeed was superseded by Carp::Always - now there is an END block - there is a test for POD coverage 0.05 Tue May 30 2006 - remove @EXPORT_OK and all use of Exporter (which was good for nothing) - a suggestion by Yuval Kogman via CPAN ratings - simplified tests with Test::Base 0.04 Wed Oct 12 2005 (r198, tag) - fixed mistakes at META.yml and t/002basic.t - shortened documentation 0.03 Mon Oct 10 2005 - now using $SIG{__DIE__} and $SIG{__WARN__} to catch perl generated warnings and errors as well - added a test for perl generated warnings - renamed "t/003pod.t" to "t/090pod.t" - shortened "lib/Carp/Indeed.pm" to "Indeed.pm" (as this is a module of an only PM file) 0.02 Thu Aug 5 2005 - POD minor fixes - I should have said "NO_META => 1" in Makefile.PL instead of "NO_META => 0" - "use Carp qw(verbose)" instead of "require Carp; $Carp::Verbose=1" was enough for carp() and croak() to be verbose too 0.01 Thu Aug 4 2005 - first realease to CPAN 0.00 Thu Aug 4 13:07:27 2005 - original version; created by h2xs 1.23 with options -AX -n Carp::Indeed Carp-Always-0.12/lib/000755 000765 000024 00000000000 12014715500 015262 5ustar00ferreirastaff000000 000000 Carp-Always-0.12/Makefile.PL000644 000765 000024 00000001760 11743540047 016504 0ustar00ferreirastaff000000 000000 use 5.006; use ExtUtils::MakeMaker; my $EUMM_VERSION = eval $ExtUtils::MakeMaker::VERSION; WriteMakefile( NAME => 'Carp::Always', VERSION_FROM => 'lib/Carp/Always.pm', PREREQ_PM => { Carp => 0, Test::More => 0, }, ($] >= 5.005 ? ( ABSTRACT_FROM => 'lib/Carp/Always.pm', AUTHOR => 'Adriano R. Ferreira ' ) : ()), ($EUMM_VERSION >= 6.31 ? ( LICENSE => 'perl', ) : ()), ($EUMM_VERSION > 6.4501 ? ( META_MERGE => { recommends => { # optional tests 'Test::Pod' => 0, 'Test::Pod::Coverage' => 0, }, resources => { repository => 'http://github.com/aferreira/cpan-Carp-Always', } }, ) : ()), ($EUMM_VERSION >= 6.5501 ? ( BUILD_REQUIRES => { 'Test::Base' => 0, # gotta test the minimum }, ) : ()), ); Carp-Always-0.12/MANIFEST000644 000765 000024 00000000425 12014715500 015646 0ustar00ferreirastaff000000 000000 Changes Makefile.PL MANIFEST README t/001use.t t/010simple.t t/098pod-coverage.t t/099pod.t lib/Carp/Always.pm META.yml Module meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Carp-Always-0.12/META.json000644 000765 000024 00000002154 12014715500 016137 0ustar00ferreirastaff000000 000000 { "abstract" : "Warns and dies noisily with stack backtraces", "author" : [ "Adriano R. Ferreira " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.113640", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Carp-Always", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "Test::Base" : 0 } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : 0 } }, "runtime" : { "recommends" : { "Test::Pod" : 0, "Test::Pod::Coverage" : 0 }, "requires" : { "Carp" : 0, "Test::More" : 0 } } }, "release_status" : "stable", "resources" : { "repository" : { "url" : "http://github.com/aferreira/cpan-Carp-Always" } }, "version" : "0.12" } Carp-Always-0.12/META.yml000644 000765 000024 00000001171 12014715500 015765 0ustar00ferreirastaff000000 000000 --- abstract: 'Warns and dies noisily with stack backtraces' author: - 'Adriano R. Ferreira ' build_requires: Test::Base: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.62, CPAN::Meta::Converter version 2.113640' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Carp-Always no_index: directory: - t - inc recommends: Test::Pod: 0 Test::Pod::Coverage: 0 requires: Carp: 0 Test::More: 0 resources: repository: http://github.com/aferreira/cpan-Carp-Always version: 0.12 Carp-Always-0.12/README000644 000765 000024 00000002141 11743540631 015403 0ustar00ferreirastaff000000 000000 Carp-Always version 0.11 ======================== Carp::Always can be used to make a script complain loudly with stack traces when warn()ing or die()ing. perl -MCarp::Always script.pl Perl has Carp which is a module as old as Perl 5. It has an option to print errors (from the perspective of caller) with stack backtrace. With a few lines of codes, this module illustrates how to make warn() and die() noisy as well. This module was written as a reaction to Acme::JavaTrace by Sébastien Aperghis-Tramoni. I didn't know Sébastien or or understood its humor at the time. That and more was pointed by Robert Rothenberg at CPAN ratings. But the module idea stood and lives to help you out with debugging your code. INSTALLATION To install this module type the following: perl Makefile.PL make make test make install DEPENDENCIES This module requires these other modules and libraries: Carp but that is a core Perl module. COPYRIGHT AND LICENCE Copyright (C) 2005-2012 by Ferreira This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Carp-Always-0.12/t/000755 000765 000024 00000000000 12014715500 014757 5ustar00ferreirastaff000000 000000 Carp-Always-0.12/t/001use.t000644 000765 000024 00000000220 10517730760 016166 0ustar00ferreirastaff000000 000000 #perl -T use Test::More tests => 1; BEGIN { use_ok('Carp::Always') }; diag( "Testing Carp::Always $Carp::Always::VERSION, Perl $], $^X" ); Carp-Always-0.12/t/010simple.t000644 000765 000024 00000003334 11743536460 016677 0ustar00ferreirastaff000000 000000 #perl -T BEGIN { eval { require Test::Base }; if ($@) { require Test::More; Test::More::plan(skip_all => "Test::Base required for module tests"); } } use Test::Base; use Carp; my $OUTFILE = 'test-block.pl'; my $PERL5OPTS = '-Mblib -MCarp::Always'; sub Test::Base::Filter::exec_perl_stderr { my $self = shift; # The Test::Base::Filter object my $tmpfile = $OUTFILE; $self->_write_to($tmpfile, @_); open my $execution, "$^X $PERL5OPTS $OUTFILE 2>&1 |" or die "Couldn't open subprocess: $!\n"; local $/; my $output = <$execution>; close $execution; unlink($tmpfile) or die "Couldn't unlink $tmpfile: $!\n"; return $output; } sub fixup_stderr { s/\.$//m if $Carp::VERSION < '1.25'; } filters { perl => 'exec_perl_stderr', stderr => 'fixup_stderr' }; run_is_deeply 'perl', 'stderr'; __END__ === basic test --- perl package A; sub f { #line 1 warn "Beware!"; } sub g { #line 2 f(); } package main; #line 3 A::g(); --- stderr Beware! at test-block.pl line 1. A::f() called at test-block.pl line 2 A::g() called at test-block.pl line 3 === interpreter-thrown warnings --- perl package A; sub f { use strict; my $a; #line 1 my @a = @$a; } sub g { #line 2 f(); } package main; #line 3 A::g(); --- stderr Can't use an undefined value as an ARRAY reference at test-block.pl line 1. A::f() called at test-block.pl line 2 A::g() called at test-block.pl line 3 === foo at bar --- perl die "foo at bar" --- stderr foo at bar at test-block.pl line 1. === exception objects --- perl package error; use overload '""' => sub { "Exception: " . shift->{error} . "\n" }; package main; die bless { error => 'bad' }, error; --- stderr Exception: bad Carp-Always-0.12/t/098pod-coverage.t000644 000765 000024 00000000256 10653373514 017777 0ustar00ferreirastaff000000 000000 #perl -T use Test::More; eval "use Test::Pod::Coverage 1.04"; plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; all_pod_coverage_ok(); Carp-Always-0.12/t/099pod.t000644 000765 000024 00000000253 10517731074 016202 0ustar00ferreirastaff000000 000000 #perl -T use strict; use Test::More; eval "use Test::Pod 1.18"; plan skip_all => "Test::Pod 1.18 required for testing POD" if $@; all_pod_files_ok(all_pod_files(".")); Carp-Always-0.12/lib/Carp/000755 000765 000024 00000000000 12014715500 016147 5ustar00ferreirastaff000000 000000 Carp-Always-0.12/lib/Carp/Always.pm000644 000765 000024 00000007230 12014715225 017753 0ustar00ferreirastaff000000 000000 package Carp::Always; use 5.006; use strict; use warnings; our $VERSION = '0.12'; use Carp qw(verbose); # makes carp() cluck and croak() confess sub _warn { if ($_[-1] =~ /\n$/s) { my $arg = pop @_; $arg =~ s/(.*)( at .*? line .*?\n$)/$1/s; push @_, $arg; } warn &Carp::longmess; } sub _die { die @_ if ref($_[0]); if ($_[-1] =~ /\n$/s) { my $arg = pop @_; $arg =~ s/(.*)( at .*? line .*?\n$)/$1/s; push @_, $arg; } die &Carp::longmess; } my %OLD_SIG; BEGIN { @OLD_SIG{qw(__DIE__ __WARN__)} = @SIG{qw(__DIE__ __WARN__)}; $SIG{__DIE__} = \&_die; $SIG{__WARN__} = \&_warn; } END { @SIG{qw(__DIE__ __WARN__)} = @OLD_SIG{qw(__DIE__ __WARN__)}; } 1; __END__ =encoding utf8 =head1 NAME Carp::Always - Warns and dies noisily with stack backtraces =head1 SYNOPSIS use Carp::Always; makes every C and C complains loudly in the calling package and elsewhere. More often used on the command line: perl -MCarp::Always script.pl =head1 DESCRIPTION This module is meant as a debugging aid. It can be used to make a script complain loudly with stack backtraces when warn()ing or die()ing. Here are how stack backtraces produced by this module looks: # it works for explicit die's and warn's $ perl -MCarp::Always -e 'sub f { die "arghh" }; sub g { f }; g' arghh at -e line 1 main::f() called at -e line 1 main::g() called at -e line 1 # it works for interpreter-thrown failures $ perl -MCarp::Always -w -e 'sub f { $a = shift; @a = @$a };' \ -e 'sub g { f(undef) }; g' Use of uninitialized value in array dereference at -e line 1 main::f('undef') called at -e line 2 main::g() called at -e line 2 In the implementation, the C module does the heavy work, through C. The actual implementation sets the signal hooks C<$SIG{__WARN__}> and C<$SIG{__DIE__}> to emit the stack backtraces. Oh, by the way, C and C when requiring/using the C module are also made verbose, behaving like C and C, respectively. =head2 EXPORT Nothing at all is exported. =head1 ACKNOWLEDGMENTS This module was born as a reaction to a release of L by SĂ©bastien Aperghis-Tramoni. SĂ©bastien also has a newer module called L with the same code and fewer flame comments on docs. The pruning of the uselessly long docs of this module were prodded by Michael Schwern. Schwern and others told me "the module name stinked" - it was called C. After thinking long and not getting nowhere, I went with nuffin's suggestion and now it is called C. C which is now deprecate lives in its own distribution (which won't go anywhere but will stay there as a redirection to this module). =head1 SEE ALSO =over 4 =item * L =item * L and L =item * L =item * L =back Please report bugs via CPAN RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=Carp-Always. =head1 BUGS Every (un)deserving module has its own pet bugs. =over 4 =item * This module does not play well with other modules which fusses around with C, C, C<$SIG{'__WARN__'}>, C<$SIG{'__DIE__'}>. =item * Test scripts are good. I should write more of these. =item * I don't know if this module name is still a bug as it was at the time of C. =back =head1 AUTHOR Adriano Ferreira, Eferreira@cpan.orgE =head1 COPYRIGHT AND LICENSE Copyright (C) 2005-2012 by Adriano R. Ferreira This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut