r31222 - in /trunk/libautodie-perl: ./ debian/ lib/ lib/autodie/ lib/autodie/exception/ t/ t/lib/
angelabad-guest at users.alioth.debian.org
angelabad-guest at users.alioth.debian.org
Sat Feb 28 14:49:39 UTC 2009
Author: angelabad-guest
Date: Sat Feb 28 14:49:33 2009
New Revision: 31222
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=31222
Log:
Release 1.999
Added:
trunk/libautodie-perl/t/caller.t
- copied unchanged from r31221, branches/upstream/libautodie-perl/current/t/caller.t
trunk/libautodie-perl/t/lib/Caller_helper.pm
- copied unchanged from r31221, branches/upstream/libautodie-perl/current/t/lib/Caller_helper.pm
trunk/libautodie-perl/t/user-context.t
- copied unchanged from r31221, branches/upstream/libautodie-perl/current/t/user-context.t
Modified:
trunk/libautodie-perl/Changes
trunk/libautodie-perl/MANIFEST
trunk/libautodie-perl/META.yml
trunk/libautodie-perl/debian/changelog
trunk/libautodie-perl/debian/control
trunk/libautodie-perl/lib/Fatal.pm
trunk/libautodie-perl/lib/autodie.pm
trunk/libautodie-perl/lib/autodie/exception.pm
trunk/libautodie-perl/lib/autodie/exception/system.pm
trunk/libautodie-perl/t/basic_exceptions.t
trunk/libautodie-perl/t/scope_leak.t
Modified: trunk/libautodie-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/Changes?rev=31222&op=diff
==============================================================================
--- trunk/libautodie-perl/Changes (original)
+++ trunk/libautodie-perl/Changes Sat Feb 28 14:49:33 2009
@@ -1,4 +1,42 @@
Revision history for autodie
+
+ * BUGFIX: Autodie now correctly propagates into string evals
+ under 5.10+. Autodie completely fails to propagate into
+ string evals under 5.8. No fix for 5.8 is known.
+
+ * BUGFIX: The caller() method on autodie::exception objects
+ should now always report the correct caller. While it
+ would always get the line, file, and package correct, previously
+ it would sometimes report less-than-helpful callers like
+ '__ANON__' or '(eval)'.
+
+ * BUGFIX: autodie was treating system() as a user-sub, not
+ a built-in. This could tigger extra (unnecessary) work
+ inside autodie, but otherwise had no user impact.
+
+ * DOCUMENTATION: The synopsis for autodie::exception::system
+ previously implied system() was made autodying by default.
+ This was not the case. It must still be enabled with
+ use autodie qw(system).
+
+ * DOCUMENTATION: Noted the 5.8 string eval bug in
+ autodie/BUGS.
+
+ * TEST: Added test for correct caller output on
+ autodie::exception objects. Thanks to Piers Harding
+ for spotting this bug at KiwiFoo.
+
+ * TEST: Added tests for user-defined autodying functions
+ changing behaviour depending upon context. This was
+ reported in http://perlmonks.org/?node_id=744246 .
+
+ * TEST: Tests for autodie propagating into string eval.
+
+ * TEST: Expanded tests to ensure autodie::exception returns
+ the correct line number and caller.
+
+ * TEST: Expanded tests to ensure autodie::exception returns
+ correct information when calling subroutines in external files.
1.998 Sat Jan 3 11:19:53 AUSEDT 2009
Modified: trunk/libautodie-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/MANIFEST?rev=31222&op=diff
==============================================================================
--- trunk/libautodie-perl/MANIFEST (original)
+++ trunk/libautodie-perl/MANIFEST Sat Feb 28 14:49:33 2009
@@ -23,6 +23,7 @@
t/basic_exceptions.t
t/binmode.t
t/boilerplate.t
+t/caller.t
t/context.t
t/context_lexical.t
t/crickey.t
@@ -44,6 +45,7 @@
t/lib/autodie/test/au/exception.pm
t/lib/autodie/test/badname.pm
t/lib/autodie/test/missing.pm
+t/lib/Caller_helper.pm
t/lib/lethal.pm
t/lib/pujHa/ghach.pm
t/lib/pujHa/ghach/Dotlh.pm
@@ -59,6 +61,7 @@
t/system.t
t/truncate.t
t/unlink.t
+t/user-context.t
t/usersub.t
t/version.t
t/version_tag.t
Modified: trunk/libautodie-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/META.yml?rev=31222&op=diff
==============================================================================
--- trunk/libautodie-perl/META.yml (original)
+++ trunk/libautodie-perl/META.yml Sat Feb 28 14:49:33 2009
@@ -24,4 +24,4 @@
bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie
license: http://dev.perl.org/licenses/
repository: http://github.com/pfenwick/autodie/tree/master
-version: 1.998
+version: 1.999
Modified: trunk/libautodie-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/debian/changelog?rev=31222&op=diff
==============================================================================
--- trunk/libautodie-perl/debian/changelog (original)
+++ trunk/libautodie-perl/debian/changelog Sat Feb 28 14:49:33 2009
@@ -1,3 +1,10 @@
+libautodie-perl (1.999-1) unstable; urgency=low
+
+ * New upstream release
+ * Add myself to Uploaders.
+
+ -- Angel Abad (Ikusnet SLL) <angel at grupoikusnet.com> Sat, 28 Feb 2009 15:41:00 +0100
+
libautodie-perl (1.998-1) unstable; urgency=low
* New upstream release
Modified: trunk/libautodie-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/debian/control?rev=31222&op=diff
==============================================================================
--- trunk/libautodie-perl/debian/control (original)
+++ trunk/libautodie-perl/debian/control Sat Feb 28 14:49:33 2009
@@ -7,7 +7,8 @@
libtest-pod-coverage-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
Uploaders: Jeremiah C. Foster <jeremiah at jeremiahfoster.com>,
- Rene Mayorga <rmayorga at debian.org.sv>
+ Rene Mayorga <rmayorga at debian.org.sv>,
+ Angel Abad (Ikusnet SLL) <angel at grupoikusnet.com>
Standards-Version: 3.8.0
Homepage: http://search.cpan.org/dist/autodie/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libautodie-perl/
Modified: trunk/libautodie-perl/lib/Fatal.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/lib/Fatal.pm?rev=31222&op=diff
==============================================================================
--- trunk/libautodie-perl/lib/Fatal.pm (original)
+++ trunk/libautodie-perl/lib/Fatal.pm Sat Feb 28 14:49:33 2009
@@ -31,7 +31,7 @@
use constant MIN_IPC_SYS_SIMPLE_VER => 0.12;
# All the Fatal/autodie modules share the same version number.
-our $VERSION = '1.998';
+our $VERSION = '1.999';
our $Debug ||= 0;
@@ -84,6 +84,7 @@
':1.996' => [qw(:default)],
':1.997' => [qw(:default)],
':1.998' => [qw(:default)],
+ ':1.999' => [qw(:default)],
);
@@ -759,6 +760,7 @@
$call = 'CORE::system';
$name = 'system';
+ $core = 1;
} elsif ($name eq 'exec') {
# Exec doesn't have a prototype. We don't care. This
@@ -861,9 +863,19 @@
sub$real_proto {
+ # If we're inside a string eval, we can end up with a
+ # whacky filename. The following code allows autodie
+ # to propagate correctly into string evals.
+
+ my \$caller_level = 0;
+
+ while ( (caller \$caller_level)[1] =~ m{^\\(eval \\d+\\)\$} ) {
+ \$caller_level++;
+ }
+
# If we're called from the correct file, then use the
# autodying code.
- goto &\$code if ((caller)[1] eq \$filename);
+ goto &\$code if ((caller \$caller_level)[1] eq \$filename);
# Oh bother, we've leaked into another file. Call the
# original code. Note that \$sref may actually be a
Modified: trunk/libautodie-perl/lib/autodie.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/lib/autodie.pm?rev=31222&op=diff
==============================================================================
--- trunk/libautodie-perl/lib/autodie.pm (original)
+++ trunk/libautodie-perl/lib/autodie.pm Sat Feb 28 14:49:33 2009
@@ -8,7 +8,7 @@
our $VERSION;
BEGIN {
- $VERSION = "1.998";
+ $VERSION = "1.999";
}
use constant ERROR_WRONG_FATAL => q{
@@ -307,6 +307,11 @@
is used with package filehandles (eg, C<FILE>). It's strongly recommended
you use scalar filehandles instead.
+Under Perl 5.8 only, C<autodie> I<does not> propagate into string C<eval>
+statements, although it can be explicitly enabled inside a string
+C<eval>. This bug does not affect block C<eval> statements in
+any version of Perl.
+
When using C<autodie> or C<Fatal> with user subroutines, the
declaration of those subroutines must appear before the first use of
C<Fatal> or C<autodie>, or have been exported from a module.
Modified: trunk/libautodie-perl/lib/autodie/exception.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/lib/autodie/exception.pm?rev=31222&op=diff
==============================================================================
--- trunk/libautodie-perl/lib/autodie/exception.pm (original)
+++ trunk/libautodie-perl/lib/autodie/exception.pm Sat Feb 28 14:49:33 2009
@@ -14,7 +14,7 @@
use if ($] >= 5.010), overload => '~~' => "matches";
-our $VERSION = '1.998';
+our $VERSION = '1.999';
my $PACKAGE = __PACKAGE__; # Useful to have a scalar for hash keys.
@@ -628,6 +628,28 @@
}
+ # We now have everything correct, *except* for our subroutine
+ # name. If it's __ANON__ or (eval), then we need to keep on
+ # digging deeper into our stack to find the real name. However we
+ # don't update our other information, since that will be correct
+ # for our current exception.
+
+ my $first_guess_subroutine = $sub;
+
+ while (defined $sub and $sub =~ /^\(eval\)$|::__ANON__$/) {
+ $depth++;
+
+ $sub = (CORE::caller($depth))[3];
+ }
+
+ # If we end up falling out the bottom of our stack, then our
+ # __ANON__ guess is the best we can get. This includes situations
+ # where we were called from thetop level of a program.
+
+ if (not defined $sub) {
+ $sub = $first_guess_subroutine;
+ }
+
$this->{$PACKAGE}{package} = $package;
$this->{$PACKAGE}{file} = $file;
$this->{$PACKAGE}{line} = $line;
Modified: trunk/libautodie-perl/lib/autodie/exception/system.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/lib/autodie/exception/system.pm?rev=31222&op=diff
==============================================================================
--- trunk/libautodie-perl/lib/autodie/exception/system.pm (original)
+++ trunk/libautodie-perl/lib/autodie/exception/system.pm Sat Feb 28 14:49:33 2009
@@ -5,7 +5,7 @@
use base 'autodie::exception';
use Carp qw(croak);
-our $VERSION = '1.998';
+our $VERSION = '1.999';
my $PACKAGE = __PACKAGE__;
@@ -16,7 +16,7 @@
=head1 SYNOPSIS
eval {
- use autodie;
+ use autodie qw(system);
system($cmd, @args);
Modified: trunk/libautodie-perl/t/basic_exceptions.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/t/basic_exceptions.t?rev=31222&op=diff
==============================================================================
--- trunk/libautodie-perl/t/basic_exceptions.t (original)
+++ trunk/libautodie-perl/t/basic_exceptions.t Sat Feb 28 14:49:33 2009
@@ -1,13 +1,15 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 13;
+use Test::More tests => 17;
use constant NO_SUCH_FILE => "this_file_had_better_not_exist";
+my $line;
+
eval {
use autodie ':io';
- open(my $fh, '<', NO_SUCH_FILE);
+ $line = __LINE__; open(my $fh, '<', NO_SUCH_FILE);
};
like($@, qr/Can't open '\w+' for reading: /, "Prety printed open msg");
@@ -21,7 +23,24 @@
is($@->function, 'CORE::open', "Correct dying sub");
is($@->package, __PACKAGE__, "Correct package");
is($@->caller,__PACKAGE__."::__ANON__", "Correct caller");
+is($@->line, $line, "Correct line");
is($@->args->[1], '<', 'Correct mode arg');
is($@->args->[2], NO_SUCH_FILE, 'Correct filename arg');
ok($@->matches('open'), 'Looks like an error from open');
ok($@->matches(':io'), 'Looks like an error from :io');
+
+# Testing of caller info with a real subroutine.
+
+my $line2;
+
+sub xyzzy {
+ use autodie ':io';
+ $line2 = __LINE__; open(my $fh, '<', NO_SUCH_FILE);
+ return;
+};
+
+eval { xyzzy(); };
+
+isa_ok($@, 'autodie::exception');
+is($@->caller, __PACKAGE__."::xyzzy", "Subroutine caller test");
+is($@->line, $line2, "Subroutine line test");
Modified: trunk/libautodie-perl/t/scope_leak.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/t/scope_leak.t?rev=31222&op=diff
==============================================================================
--- trunk/libautodie-perl/t/scope_leak.t (original)
+++ trunk/libautodie-perl/t/scope_leak.t Sat Feb 28 14:49:33 2009
@@ -35,3 +35,44 @@
};
is($@,"","Other package open should be unaffected");
+
+# Due to odd filenames reported when doing string evals,
+# older versions of autodie would not propogate into string evals.
+
+eval q{
+ open(my $fh, '<', NO_SUCH_FILE);
+};
+
+TODO: {
+ local $TODO = "No known way of propagating into string eval in 5.8"
+ if $] < 5.010;
+
+ ok($@, "Failing-open string eval should throw an exception");
+ isa_ok($@, 'autodie::exception');
+}
+
+eval q{
+ no autodie;
+
+ open(my $fh, '<', NO_SUCH_FILE);
+};
+
+is("$@","","disabling autodie in string context should work");
+
+eval {
+ open(my $fh, '<', NO_SUCH_FILE);
+};
+
+ok($@,"...but shouldn't disable it for the calling code.");
+isa_ok($@, 'autodie::exception');
+
+eval q{
+ no autodie;
+
+ use autodie qw(open);
+
+ open(my $fh, '<', NO_SUCH_FILE);
+};
+
+ok($@,"Wacky flipping of autodie in string eval should work too!");
+isa_ok($@, 'autodie::exception');
More information about the Pkg-perl-cvs-commits
mailing list