r27048 - in /branches/upstream/libhook-lexwrap-perl/current: Changes MANIFEST META.yml Makefile.PL lib/Hook/LexWrap.pm t/ t/pod.t t/test.t test.pl
rmayorga-guest at users.alioth.debian.org
rmayorga-guest at users.alioth.debian.org
Sat Nov 22 05:18:49 UTC 2008
Author: rmayorga-guest
Date: Sat Nov 22 05:18:45 2008
New Revision: 27048
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=27048
Log:
[svn-upgrade] Integrating new upstream version, libhook-lexwrap-perl (0.21)
Added:
branches/upstream/libhook-lexwrap-perl/current/META.yml
branches/upstream/libhook-lexwrap-perl/current/t/
branches/upstream/libhook-lexwrap-perl/current/t/pod.t
branches/upstream/libhook-lexwrap-perl/current/t/test.t
Removed:
branches/upstream/libhook-lexwrap-perl/current/test.pl
Modified:
branches/upstream/libhook-lexwrap-perl/current/Changes
branches/upstream/libhook-lexwrap-perl/current/MANIFEST
branches/upstream/libhook-lexwrap-perl/current/Makefile.PL
branches/upstream/libhook-lexwrap-perl/current/lib/Hook/LexWrap.pm
Modified: branches/upstream/libhook-lexwrap-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhook-lexwrap-perl/current/Changes?rev=27048&op=diff
==============================================================================
--- branches/upstream/libhook-lexwrap-perl/current/Changes (original)
+++ branches/upstream/libhook-lexwrap-perl/current/Changes Sat Nov 22 05:18:45 2008
@@ -29,3 +29,15 @@
- Fixed various problems in handling C<wantarray> (thanks Marcel)
- Fixed C<caller> (thanks everyone)
+
+0.21 Nov 6 2008
+
+ - Added 'See also: Sub::Prepend'
+
+ - Makefile.PL rewritten
+
+ - support of 5.6+ only made explicit
+
+ - Moved tests to t/. Silenced warnings.
+
+ - Added pod.t
Modified: branches/upstream/libhook-lexwrap-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhook-lexwrap-perl/current/MANIFEST?rev=27048&op=diff
==============================================================================
--- branches/upstream/libhook-lexwrap-perl/current/MANIFEST (original)
+++ branches/upstream/libhook-lexwrap-perl/current/MANIFEST Sat Nov 22 05:18:45 2008
@@ -3,6 +3,8 @@
Makefile.PL
README
lib/Hook/LexWrap.pm
-test.pl
+t/test.t
+t/pod.t
demo/demo_memo.pl
demo/demo_temp.pl
+META.yml Module meta-data (added by MakeMaker)
Added: branches/upstream/libhook-lexwrap-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhook-lexwrap-perl/current/META.yml?rev=27048&op=file
==============================================================================
--- branches/upstream/libhook-lexwrap-perl/current/META.yml (added)
+++ branches/upstream/libhook-lexwrap-perl/current/META.yml Sat Nov 22 05:18:45 2008
@@ -1,0 +1,20 @@
+--- #YAML:1.0
+name: Hook-LexWrap
+version: 0.21
+abstract: Lexically scoped subroutine wrappers
+author:
+ - Damian Conway (damian at conway.org)
+license: perl
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+requires:
+ perl: 5.006
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.48
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: branches/upstream/libhook-lexwrap-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhook-lexwrap-perl/current/Makefile.PL?rev=27048&op=diff
==============================================================================
--- branches/upstream/libhook-lexwrap-perl/current/Makefile.PL (original)
+++ branches/upstream/libhook-lexwrap-perl/current/Makefile.PL Sat Nov 22 05:18:45 2008
@@ -1,7 +1,19 @@
-
-use ExtUtils::MakeMaker;
-WriteMakefile(
- NAME => 'Hook::LexWrap',
- VERSION => '0.20',
-
- );
+use 5.006;
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Hook::LexWrap',
+ AUTHOR => 'Damian Conway (damian at conway.org)',
+ VERSION_FROM => 'lib/Hook/LexWrap.pm',
+ ABSTRACT_FROM => 'lib/Hook/LexWrap.pm',
+ PL_FILES => {},
+ PREREQ_PM => {
+ },
+ ($ExtUtils::MakeMaker::VERSION ge '6.31'?
+ ('LICENSE' => 'perl', ) : ()),
+ ($ExtUtils::MakeMaker::VERSION ge '6.48'?
+ ('MIN_PERL_VERSION' => 5.006,) : ()),
+ clean => { FILES => 'Hook-LexWrap-*' },
+);
Modified: branches/upstream/libhook-lexwrap-perl/current/lib/Hook/LexWrap.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhook-lexwrap-perl/current/lib/Hook/LexWrap.pm?rev=27048&op=diff
==============================================================================
--- branches/upstream/libhook-lexwrap-perl/current/lib/Hook/LexWrap.pm (original)
+++ branches/upstream/libhook-lexwrap-perl/current/lib/Hook/LexWrap.pm Sat Nov 22 05:18:45 2008
@@ -1,6 +1,6 @@
package Hook::LexWrap;
-our $VERSION = '0.20';
use 5.006;
+our $VERSION = '0.21';
use Carp;
*CORE::GLOBAL::caller = sub {
@@ -31,7 +31,7 @@
qw(pre post);
no warnings 'redefine';
my ($caller, $unwrap) = *CORE::GLOBAL::caller{CODE};
- $imposter = sub {
+ my $imposter = sub {
if ($unwrap) { goto &$original }
my ($return, $prereturn);
if (wantarray) {
@@ -92,8 +92,8 @@
=head1 VERSION
-This document describes version 0.20 of Hook::LexWrap,
-released October 1, 2001.
+This document describes version 0.21 of Hook::LexWrap,
+released November 6, 2008.
=head1 SYNOPSIS
@@ -318,6 +318,10 @@
Bug reports and other feedback are most welcome.
+=head1 SEE ALSO
+
+Sub::Prepend
+
=head1 COPYRIGHT
Copyright (c) 2001, Damian Conway. All Rights Reserved.
Added: branches/upstream/libhook-lexwrap-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhook-lexwrap-perl/current/t/pod.t?rev=27048&op=file
==============================================================================
--- branches/upstream/libhook-lexwrap-perl/current/t/pod.t (added)
+++ branches/upstream/libhook-lexwrap-perl/current/t/pod.t Sat Nov 22 05:18:45 2008
@@ -1,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();
Added: branches/upstream/libhook-lexwrap-perl/current/t/test.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libhook-lexwrap-perl/current/t/test.t?rev=27048&op=file
==============================================================================
--- branches/upstream/libhook-lexwrap-perl/current/t/test.t (added)
+++ branches/upstream/libhook-lexwrap-perl/current/t/test.t Sat Nov 22 05:18:45 2008
@@ -1,0 +1,200 @@
+use Hook::LexWrap;
+print "1..54\n";
+
+sub ok { print "ok $_[0]\n" }
+sub fail(&) { print "not " if $_[0]->() }
+
+sub actual { ok $_[0]; }
+
+
+actual 1;
+
+{
+ my $lexical = wrap actual,
+ pre => sub { ok 2 },
+ post => sub { ok 4 };
+
+ wrap actual, pre => sub { $_[0]++ };
+
+ my $x = 2;
+ actual $x;
+ 1; # delay destruction
+}
+
+wrap *main::actual, post => sub { ok 6 };
+
+actual my $x = 4;
+
+no warnings qw/bareword reserved/;
+eval { wrap other, pre => sub { print "not ok 7\n" } } or ok 7;
+
+eval { wrap actual, pre => 1 } and print "not ";
+ok 8;
+
+eval { wrap actual, post => [] } and print "not ";
+ok 9;
+
+BEGIN { *{CORE::GLOBAL::sqrt} = sub { CORE::sqrt(shift) } }
+wrap 'CORE::GLOBAL::sqrt', pre => sub { $_[0]++ };
+
+$x = 99;
+ok sqrt($x);
+
+sub temp { ok $_[0] };
+
+my $sub = wrap \&temp,
+ pre => sub { ok $_[0]-1 },
+ post => sub { ok $_[0]+1 };
+
+$sub->(12);
+temp(14);
+
+{
+ local $SIG{__WARN__} = sub { ok 15 };
+ eval { wrap \&temp, pre => sub { ok $_[0]-1 }; 1 } and ok 16;
+}
+
+use Carp;
+
+sub wrapped_callee {
+ return join '|', caller;
+}
+
+wrap wrapped_callee,
+ pre =>sub{
+ print "not " unless $_[0] eq join '|', caller;
+ ok 17
+ },
+ post=>sub{
+ print "not " unless $_[0] eq join '|', caller;
+ ok 18
+ };
+
+sub raw_callee {
+ return join '|', caller;
+}
+
+print "not " unless wrapped_callee(scalar raw_callee); ok 19;
+
+sub scalar_return { return 'string' }
+wrap scalar_return, post => sub { $_[-1] .= 'ent' };
+print "not " unless scalar_return eq 'stringent'; ok 20;
+
+sub list_return { return (0..9) }
+wrap list_return, post => sub { @{$_[-1]} = reverse @{$_[-1]} };
+my @result = list_return;
+for (0..9) {
+ print "not " and last unless $_ + $result[$_] == 9;
+}
+ok 21;
+
+sub shorted_scalar { return 2 };
+wrap shorted_scalar, pre => sub { $_[-1] = 1 };
+fail { shorted_scalar != 1 }; ok 22;
+
+sub shorted_list { return (2..9) };
+{
+ my $lexical = wrap shorted_list, pre => sub { $_[-1] = [1..9] };
+ fail { (shorted_list)[0] != 1 }; ok 23;
+}
+{
+ my $lexical = wrap shorted_list, pre => sub { $_[-1] = 1 };
+ fail { (shorted_list)[0] != 1 }; ok 24;
+}
+{
+ my $lexical = wrap shorted_list, pre => sub { @{$_[-1]} = (1..9) };
+ fail { (shorted_list)[0] != 1 }; ok 25;
+}
+{
+ my $lexical = wrap shorted_list, pre => sub { @{$_[-1]} = [1..9] };
+ fail { (shorted_list)[0]->[0] != 1 }; ok 26;
+}
+{
+ my $lexical = wrap shorted_list, post => sub { $_[-1] = [1..9] };
+ fail { (shorted_list)[0] != 1 }; ok 27;
+}
+{
+ my $lexical = wrap shorted_list, post => sub { $_[-1] = 1 };
+ fail { (shorted_list)[0] != 1 }; ok 28;
+}
+{
+ my $lexical = wrap shorted_list, post => sub { @{$_[-1]} = (1..9) };
+ fail { (shorted_list)[0] != 1 }; ok 29;
+}
+{
+ my $lexical = wrap shorted_list, post => sub { @{$_[-1]} = [1..9] };
+ fail { (shorted_list)[0]->[0] != 1 }; ok 30;
+}
+
+sub howmany { ok 32 if @_ == 3 }
+
+wrap howmany,
+ pre => sub { ok 31 if @_ == 4 },
+ post => sub { ok 33 if @_ == 4 };
+
+howmany(1..3);
+
+{
+no warnings 'uninitialized';
+sub wanted {
+ my $expected = $_[3];
+ print 'not ' unless defined wantarray == defined $expected
+ && wantarray eq $expected;
+ ok $_[1]
+}
+
+wrap wanted,
+ pre => sub {
+ my $expected = $_[3];
+ print 'not ' unless defined wantarray == defined $expected
+ && wantarray eq $expected;
+ ok $_[0]
+ },
+ post => sub {
+ my $expected = $_[3];
+ print 'not ' unless defined wantarray == defined $expected
+ && wantarray eq $expected;
+ ok $_[2]
+ };
+
+my @array = wanted(34..36, 1);
+my $scalar = wanted(37..39, "");
+wanted(40..42,undef);
+}
+
+sub caller_test {
+ print "not " unless (caller 0)[3] eq 'main::caller_test'; ok $_[0];
+ print "not " unless (caller 1)[3] eq 'main::caller_outer'; ok $_[0]+1;
+ print "not " unless (caller 2)[3] eq 'main::wrapped'; ok $_[0]+2;
+ print "not " unless (caller 3)[3] eq 'main::inner'; ok $_[0]+3;
+ print "not " unless (caller 4)[3] eq 'main::middle'; ok $_[0]+4;
+ print "not " unless (caller 5)[3] eq 'main::outer'; ok $_[0]+5;
+}
+
+sub caller_outer {
+ caller_test(@_);
+}
+
+sub wrapped {
+ caller_outer(@_);
+}
+
+sub outer { middle(@_) }
+sub middle { inner(@_) }
+sub inner { wrapped(@_) }
+
+outer(43..48);
+
+wrap wrapped,
+ pre => sub {},
+ post => sub {};
+
+wrap wrapped,
+ pre => sub {},
+ post => sub {};
+
+wrap wrapped,
+ pre => sub {},
+ post => sub {};
+
+outer(49..54);
More information about the Pkg-perl-cvs-commits
mailing list