aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/perl
diff options
context:
space:
mode:
authorRoman I Khimov <khimov@altell.ru>2010-09-20 16:22:21 +0400
committerRoman I Khimov <khimov@altell.ru>2010-09-23 09:49:26 +0400
commit5a52a7761eddaf8f83e7e8be27132df24d1196a9 (patch)
treec6cb61df2d73e2a91031592c0104bc12dd623bd1 /recipes/perl
parentef83636ae755045d8d740e9c3141dd394b0bb794 (diff)
downloadopenembedded-5a52a7761eddaf8f83e7e8be27132df24d1196a9.tar.gz
perl 5.10.1: update patches to Debian's 5.10.1-14
* Debian's source package changed its format in 5.10.1-10, so we can't just apply one patch as it was with initial 5.10.1 release. * fixes CVE-2010-1974 * fixes MD5 on ARM * fixes several other bugs (see changelog from http://packages.debian.org/source/sid/perl) Signed-off-by: Roman I Khimov <khimov@altell.ru>
Diffstat (limited to 'recipes/perl')
-rw-r--r--recipes/perl/perl-5.10.1/abstract-sockets.diff122
-rw-r--r--recipes/perl/perl-5.10.1/anon-tmpfile-dir.diff102
-rw-r--r--recipes/perl/perl-5.10.1/archive-tar-instance-error.diff109
-rw-r--r--recipes/perl/perl-5.10.1/arm-alignment.diff39
-rw-r--r--recipes/perl/perl-5.10.1/arm_thread_stress_timeout.diff23
-rw-r--r--recipes/perl/perl-5.10.1/assorted_docs.diff25
-rw-r--r--recipes/perl/perl-5.10.1/autodie-flock.diff98
-rw-r--r--recipes/perl/perl-5.10.1/cpan_config_path.diff22
-rw-r--r--recipes/perl/perl-5.10.1/cpan_definstalldirs.diff35
-rw-r--r--recipes/perl/perl-5.10.1/cpanplus_config_path.diff43
-rw-r--r--recipes/perl/perl-5.10.1/cpanplus_definstalldirs.diff52
-rw-r--r--recipes/perl/perl-5.10.1/crash-on-undefined-destroy.diff58
-rw-r--r--recipes/perl/perl-5.10.1/db_file_ver.diff32
-rw-r--r--recipes/perl/perl-5.10.1/devel-ppport-ia64-optim.diff32
-rw-r--r--recipes/perl/perl-5.10.1/disable-zlib-bundling.diff29
-rw-r--r--recipes/perl/perl-5.10.1/doc_info.diff55
-rw-r--r--recipes/perl/perl-5.10.1/enc2xs_inc.diff49
-rw-r--r--recipes/perl/perl-5.10.1/errno_ver.diff32
-rw-r--r--recipes/perl/perl-5.10.1/extutils_hacks.diff313
-rw-r--r--recipes/perl/perl-5.10.1/fakeroot.diff43
-rw-r--r--recipes/perl/perl-5.10.1/fcgi-test.diff31
-rw-r--r--recipes/perl/perl-5.10.1/format-write-crash.diff1255
-rw-r--r--recipes/perl/perl-5.10.1/hppa-thread-eagain.diff72
-rw-r--r--recipes/perl/perl-5.10.1/hurd-ccflags.diff26
-rw-r--r--recipes/perl/perl-5.10.1/hurd_cppsymbols.diff25
-rw-r--r--recipes/perl/perl-5.10.1/instmodsh_doc.diff26
-rw-r--r--recipes/perl/perl-5.10.1/kfreebsd-filecopy-pipes.diff68
-rw-r--r--recipes/perl/perl-5.10.1/kfreebsd_cppsymbols.diff28
-rw-r--r--recipes/perl/perl-5.10.1/ld_run_path.diff23
-rw-r--r--recipes/perl/perl-5.10.1/libnet_config_path.diff35
-rw-r--r--recipes/perl/perl-5.10.1/m68k_thread_stress.diff43
-rw-r--r--recipes/perl/perl-5.10.1/mod_paths.diff117
-rw-r--r--recipes/perl/perl-5.10.1/module_build_man_extensions.diff31
-rw-r--r--recipes/perl/perl-5.10.1/net_smtp_docs.diff23
-rw-r--r--recipes/perl/perl-5.10.1/perl_5.10.1-8.diff.gzbin100662 -> 0 bytes
-rw-r--r--recipes/perl/perl-5.10.1/perl_synopsis.diff96
-rw-r--r--recipes/perl/perl-5.10.1/perlivp.diff38
-rw-r--r--recipes/perl/perl-5.10.1/pod2man-index-backslash.diff54
-rw-r--r--recipes/perl/perl-5.10.1/positive-gpos.diff36
-rw-r--r--recipes/perl/perl-5.10.1/processPL.diff43
-rw-r--r--recipes/perl/perl-5.10.1/prune_libs.diff36
-rw-r--r--recipes/perl/perl-5.10.1/safe-upgrade.diff836
-rw-r--r--recipes/perl/perl-5.10.1/tainted-errno.diff85
-rw-r--r--recipes/perl/perl-5.10.1/tell-crash.diff33
-rw-r--r--recipes/perl/perl-5.10.1/trie-logic-match.diff111
-rw-r--r--recipes/perl/perl-5.10.1/use_gdbm.diff39
-rw-r--r--recipes/perl/perl_5.10.1.bb49
47 files changed, 4570 insertions, 2 deletions
diff --git a/recipes/perl/perl-5.10.1/abstract-sockets.diff b/recipes/perl/perl-5.10.1/abstract-sockets.diff
new file mode 100644
index 0000000000..954f9cbb3f
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/abstract-sockets.diff
@@ -0,0 +1,122 @@
+Author: Lubomir Rintel <lkundrak@v3.sk>
+Subject: Add support for Abstract namespace sockets.
+Bug-Debian: http://bugs.debian.org/490660
+Bug-Debian: http://bugs.debian.org/329291
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/99f13d4c3419e967e95c5ac6a3af61e9bb0fd3c0
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/89904c08923161afd23c629d5c2c7472a09c16bb
+
+trivially backported for 5.10.1 by Niko Tyni <ntyni@debian.org>
+
+
+---
+ ext/Socket/Socket.xs | 33 ++++++++++++++++++++++++---------
+ ext/Socket/t/Socket.t | 14 ++++++++++++--
+ 2 files changed, 36 insertions(+), 11 deletions(-)
+
+diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs
+index 076297f..3522303 100644
+--- a/ext/Socket/Socket.xs
++++ b/ext/Socket/Socket.xs
+@@ -303,6 +303,7 @@ pack_sockaddr_un(pathname)
+ struct sockaddr_un sun_ad; /* fear using sun */
+ STRLEN len;
+ char * pathname_pv;
++ int addr_len;
+
+ Zero( &sun_ad, sizeof sun_ad, char );
+ sun_ad.sun_family = AF_UNIX;
+@@ -336,7 +337,17 @@ pack_sockaddr_un(pathname)
+ Copy( pathname_pv, sun_ad.sun_path, len, char );
+ # endif
+ if (0) not_here("dummy");
+- ST(0) = sv_2mortal(newSVpvn((char *)&sun_ad, sizeof sun_ad));
++ if (len > 1 && sun_ad.sun_path[0] == '\0') {
++ /* Linux-style abstract-namespace socket.
++ * The name is not a file name, but an array of arbitrary
++ * character, starting with \0 and possibly including \0s,
++ * therefore the length of the structure must denote the
++ * end of that character array */
++ addr_len = (void *)&sun_ad.sun_path - (void *)&sun_ad + len;
++ } else {
++ addr_len = sizeof sun_ad;
++ }
++ ST(0) = sv_2mortal(newSVpvn((char *)&sun_ad, addr_len));
+ #else
+ ST(0) = (SV *) not_here("pack_sockaddr_un");
+ #endif
+@@ -352,7 +363,7 @@ unpack_sockaddr_un(sun_sv)
+ struct sockaddr_un addr;
+ STRLEN sockaddrlen;
+ char * sun_ad = SvPVbyte(sun_sv,sockaddrlen);
+- char * e;
++ int addr_len;
+ # ifndef __linux__
+ /* On Linux sockaddrlen on sockets returned by accept, recvfrom,
+ getpeername and getsockname is not equal to sizeof(addr). */
+@@ -371,13 +382,17 @@ unpack_sockaddr_un(sun_sv)
+ addr.sun_family,
+ AF_UNIX);
+ }
+- e = (char*)addr.sun_path;
+- /* On Linux, the name of abstract unix domain sockets begins
+- * with a '\0', so allow this. */
+- while ((*e || (e == addr.sun_path && e[1] && sockaddrlen > 1))
+- && e < (char*)addr.sun_path + sizeof addr.sun_path)
+- ++e;
+- ST(0) = sv_2mortal(newSVpvn(addr.sun_path, e - (char*)addr.sun_path));
++
++ if (addr.sun_path[0] == '\0') {
++ /* Linux-style abstract socket address begins with a nul
++ * and can contain nuls. */
++ addr_len = (void *)&addr - (void *)&addr.sun_path + sockaddrlen;
++ } else {
++ for (addr_len = 0; addr.sun_path[addr_len]
++ && addr_len < sizeof addr.sun_path; addr_len++);
++ }
++
++ ST(0) = sv_2mortal(newSVpvn(addr.sun_path, addr_len));
+ #else
+ ST(0) = (SV *) not_here("unpack_sockaddr_un");
+ #endif
+diff --git a/ext/Socket/t/Socket.t b/ext/Socket/t/Socket.t
+index f707999..d1e7447 100755
+--- a/ext/Socket/t/Socket.t
++++ b/ext/Socket/t/Socket.t
+@@ -14,7 +14,7 @@ BEGIN {
+
+ use Socket qw(:all);
+
+-print "1..17\n";
++print "1..18\n";
+
+ $has_echo = $^O ne 'MSWin32';
+ $alarmed = 0;
+@@ -152,7 +152,7 @@ print (($@ =~ /^Bad arg length for Socket::sockaddr_family, length is 0, should
+
+ if ($^O eq 'linux') {
+ # see if we can handle abstract sockets
+- my $test_abstract_socket = chr(0) . '/tmp/test-perl-socket';
++ my $test_abstract_socket = chr(0) . '/org/perl/hello'. chr(0) . 'world';
+ my $addr = sockaddr_un ($test_abstract_socket);
+ my ($path) = sockaddr_un ($addr);
+ if ($test_abstract_socket eq $path) {
+@@ -163,7 +163,17 @@ if ($^O eq 'linux') {
+ print "# got <$path>\n";
+ print "not ok 17\n";
+ }
++
++ # see if we calculate the address structure length correctly
++ if (length ($test_abstract_socket) + 2 == length $addr) {
++ print "ok 18\n";
++ } else {
++ print "# got ".(length $addr)."\n";
++ print "not ok 18\n";
++ }
++
+ } else {
+ # doesn't have abstract socket support
+ print "ok 17 - skipped on this platform\n";
++ print "ok 18 - skipped on this platform\n";
+ }
+--
+tg: (daf8b46..) fixes/abstract-sockets (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/anon-tmpfile-dir.diff b/recipes/perl/perl-5.10.1/anon-tmpfile-dir.diff
new file mode 100644
index 0000000000..a010a6ac9a
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/anon-tmpfile-dir.diff
@@ -0,0 +1,102 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Honor TMPDIR when open()ing an anonymous temporary file
+Bug-Debian: http://bugs.debian.org/528544
+Bug: http://rt.perl.org/rt3/Public/Bug/Display.html?id=66452
+
+[perl #66452]
+
+As reported by Norbert Buchmuller <norbi@nix.hu>, opening an anonymous
+temporary file with the magical open($fh, '+>', undef) ignores TMPDIR.
+
+
+---
+ perlio.c | 20 ++++++++++++++++----
+ t/io/perlio.t | 15 ++++++++++++++-
+ 2 files changed, 30 insertions(+), 5 deletions(-)
+
+diff --git a/perlio.c b/perlio.c
+index 3803247..3ce579f 100644
+--- a/perlio.c
++++ b/perlio.c
+@@ -5167,18 +5167,30 @@ PerlIO_tmpfile(void)
+ f = PerlIO_fdopen(fd, "w+b");
+ #else /* WIN32 */
+ # if defined(HAS_MKSTEMP) && ! defined(VMS) && ! defined(OS2)
+- SV * const sv = newSVpvs("/tmp/PerlIO_XXXXXX");
++ int fd = -1;
++ char tempname[] = "/tmp/PerlIO_XXXXXX";
++ const char * const tmpdir = PL_tainting ? NULL : PerlEnv_getenv("TMPDIR");
++ SV * const sv = tmpdir && *tmpdir ? newSVpv(tmpdir, 0) : NULL;
+ /*
+ * I have no idea how portable mkstemp() is ... NI-S
+ */
+- const int fd = mkstemp(SvPVX(sv));
++ if (sv) {
++ /* if TMPDIR is set and not empty, we try that first */
++ sv_catpv(sv, tempname + 4);
++ fd = mkstemp(SvPVX(sv));
++ }
++ if (fd < 0) {
++ /* else we try /tmp */
++ fd = mkstemp(tempname);
++ }
+ if (fd >= 0) {
+ f = PerlIO_fdopen(fd, "w+");
+ if (f)
+ PerlIOBase(f)->flags |= PERLIO_F_TEMP;
+- PerlLIO_unlink(SvPVX_const(sv));
++ PerlLIO_unlink(sv ? SvPVX_const(sv) : tempname);
+ }
+- SvREFCNT_dec(sv);
++ if (sv)
++ SvREFCNT_dec(sv);
+ # else /* !HAS_MKSTEMP, fallback to stdio tmpfile(). */
+ FILE * const stdio = PerlSIO_tmpfile();
+
+diff --git a/t/io/perlio.t b/t/io/perlio.t
+index c145945..c1eebec 100755
+--- a/t/io/perlio.t
++++ b/t/io/perlio.t
+@@ -8,13 +8,14 @@ BEGIN {
+ }
+ }
+
+-use Test::More tests => 37;
++use Test::More tests => 39;
+
+ use_ok('PerlIO');
+
+ my $txt = "txt$$";
+ my $bin = "bin$$";
+ my $utf = "utf$$";
++my $nonexistent = "nex$$";
+
+ my $txtfh;
+ my $binfh;
+@@ -89,6 +90,17 @@ ok(close($utffh));
+ # report after STDOUT is restored
+ ok($status, ' re-open STDOUT');
+ close OLDOUT;
++
++ SKIP: {
++ skip("TMPDIR not honored on this platform", 2)
++ if !$Config{d_mkstemp}
++ || $^O eq 'VMS' || $^O eq 'MSwin32' || $^O eq 'os2';
++ local $ENV{TMPDIR} = $nonexistent;
++ ok( open(my $x,"+<",undef), 'TMPDIR honored by magic temp file via 3 arg open with undef - works if TMPDIR points to a non-existent dir');
++
++ mkdir $ENV{TMPDIR};
++ ok(open(my $x,"+<",undef), 'TMPDIR honored by magic temp file via 3 arg open with undef - works if TMPDIR points to an existent dir');
++ }
+ }
+
+ # in-memory open
+@@ -136,5 +148,6 @@ END {
+ 1 while unlink $txt;
+ 1 while unlink $bin;
+ 1 while unlink $utf;
++ rmdir $nonexistent;
+ }
+
+--
+tg: (daf8b46..) fixes/anon-tmpfile-dir (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/archive-tar-instance-error.diff b/recipes/perl/perl-5.10.1/archive-tar-instance-error.diff
new file mode 100644
index 0000000000..23c45ef3b7
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/archive-tar-instance-error.diff
@@ -0,0 +1,109 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Separate Archive::Tar instance error strings from each other
+Bug-Debian: http://bugs.debian.org/539355
+Bug: http://rt.cpan.org/Public/Bug/Display.html?id=48879
+
+Included upstream in Archive-Tar-1.54.
+
+
+---
+ lib/Archive/Tar.pm | 17 +++++++++++++++--
+ lib/Archive/Tar/t/06_error.t | 39 +++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 54 insertions(+), 2 deletions(-)
+
+diff --git a/lib/Archive/Tar.pm b/lib/Archive/Tar.pm
+index 022a172..bc97c0e 100644
+--- a/lib/Archive/Tar.pm
++++ b/lib/Archive/Tar.pm
+@@ -117,7 +117,7 @@ sub new {
+
+ ### copying $tmpl here since a shallow copy makes it use the
+ ### same aref, causing for files to remain in memory always.
+- my $obj = bless { _data => [ ], _file => 'Unknown' }, $class;
++ my $obj = bless { _data => [ ], _file => 'Unknown', _error => '' }, $class;
+
+ if (@_) {
+ unless ( $obj->read( @_ ) ) {
+@@ -1445,6 +1445,10 @@ method call instead.
+ my $self = shift;
+ my $msg = $error = shift;
+ $longmess = Carp::longmess($error);
++ if (ref $self) {
++ $self->{_error} = $error;
++ $self->{_longmess} = $longmess;
++ }
+
+ ### set Archive::Tar::WARN to 0 to disable printing
+ ### of errors
+@@ -1457,7 +1461,11 @@ method call instead.
+
+ sub error {
+ my $self = shift;
+- return shift() ? $longmess : $error;
++ if (ref $self) {
++ return shift() ? $self->{_longmess} : $self->{_error};
++ } else {
++ return shift() ? $longmess : $error;
++ }
+ }
+ }
+
+@@ -1817,6 +1825,11 @@ use is very much discouraged. Use the C<error()> method instead:
+
+ warn $tar->error unless $tar->extract;
+
++Note that in older versions of this module, the C<error()> method
++would return an effectively global value even when called an instance
++method as above. This has since been fixed, and multiple instances of
++C<Archive::Tar> now have separate error strings.
++
+ =head2 $Archive::Tar::INSECURE_EXTRACT_MODE
+
+ This variable indicates whether C<Archive::Tar> should allow
+diff --git a/lib/Archive/Tar/t/06_error.t b/lib/Archive/Tar/t/06_error.t
+new file mode 100644
+index 0000000..5c728bc
+--- /dev/null
++++ b/lib/Archive/Tar/t/06_error.t
+@@ -0,0 +1,39 @@
++BEGIN {
++ if( $ENV{PERL_CORE} ) {
++ chdir '../lib/Archive/Tar' if -d '../lib/Archive/Tar';
++ }
++ use lib '../../..';
++}
++
++BEGIN { chdir 't' if -d 't' }
++
++use Test::More 'no_plan';
++use strict;
++use lib '../lib';
++
++use Archive::Tar;
++use File::Spec;
++
++$Archive::Tar::WARN = 0;
++
++my $t1 = Archive::Tar->new;
++my $t2 = Archive::Tar->new;
++
++is($Archive::Tar::error, "", "global error string is empty");
++is($t1->error, "", "error string of object 1 is empty");
++is($t2->error, "", "error string of object 2 is empty");
++
++ok(!$t1->read(), "can't read without a file");
++
++isnt($t1->error, "", "error string of object 1 is set");
++is($Archive::Tar::error, $t1->error, "global error string equals that of object 1");
++is($Archive::Tar::error, Archive::Tar->error, "the class error method returns the global error");
++is($t2->error, "", "error string of object 2 is still empty");
++
++my $src = File::Spec->catfile( qw[src short b] );
++ok(!$t2->read($src), "error when opening $src");
++
++isnt($t2->error, "", "error string of object 1 is set");
++isnt($t2->error, $t1->error, "error strings of objects 1 and 2 differ");
++is($Archive::Tar::error, $t2->error, "global error string equals that of object 2");
++is($Archive::Tar::error, Archive::Tar->error, "the class error method returns the global error");
+--
+tg: (daf8b46..) fixes/archive-tar-instance-error (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/arm-alignment.diff b/recipes/perl/perl-5.10.1/arm-alignment.diff
new file mode 100644
index 0000000000..28038b7115
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/arm-alignment.diff
@@ -0,0 +1,39 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Prevent gcc from optimizing the alignment test away on armel
+Bug-Debian: http://bugs.debian.org/289884
+Author: Marc Pignat <marc.pignat@hevs.ch>
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/f1c7503b9028d20741c9a01345ba8704998ea381
+
+As hunted down by Marc Pignat, gcc optimizations make the check for
+u32align (U32_ALIGNMENT_REQUIRED) a no-op on armel, breaking the MD5
+module.
+
+---
+ Configure | 5 +++--
+ 1 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/Configure b/Configure
+index 01fa3c0..f39b2f9 100755
+--- a/Configure
++++ b/Configure
+@@ -18533,6 +18533,7 @@ $cat <<EOM
+
+ Checking to see whether you can access character data unalignedly...
+ EOM
++: volatile so that the compiler does not optimize the test away
+ case "$d_u32align" in
+ '') $cat >try.c <<EOCP
+ #include <stdio.h>
+@@ -18549,8 +18550,8 @@ $signal_t bletch(int s) { exit(4); }
+ #endif
+ int main() {
+ #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
+- U8 buf[8];
+- U32 *up;
++ $volatile U8 buf[8];
++ $volatile U32 *up;
+ int i;
+
+ if (sizeof(U32) != 4) {
+--
+tg: (daf8b46..) fixes/arm-alignment (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/arm_thread_stress_timeout.diff b/recipes/perl/perl-5.10.1/arm_thread_stress_timeout.diff
new file mode 100644
index 0000000000..785ac46361
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/arm_thread_stress_timeout.diff
@@ -0,0 +1,23 @@
+Subject: Raise the timeout of ext/threads/shared/t/stress.t to accommodate slower build hosts
+Bug-Debian: http://bugs.debian.org/501970
+
+
+---
+ ext/threads-shared/t/stress.t | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/ext/threads-shared/t/stress.t b/ext/threads-shared/t/stress.t
+index e36ab0a..33aa3b8 100755
+--- a/ext/threads-shared/t/stress.t
++++ b/ext/threads-shared/t/stress.t
+@@ -34,7 +34,7 @@ use threads::shared;
+ {
+ my $cnt = 50;
+
+- my $TIMEOUT = 60;
++ my $TIMEOUT = 150;
+
+ my $mutex = 1;
+ share($mutex);
+--
+tg: (daf8b46..) debian/arm_thread_stress_timeout (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/assorted_docs.diff b/recipes/perl/perl-5.10.1/assorted_docs.diff
new file mode 100644
index 0000000000..49c509ff4e
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/assorted_docs.diff
@@ -0,0 +1,25 @@
+Subject: Math::BigInt::CalcEmu documentation grammar fix
+Bug-Debian: http://bugs.debian.org/443733
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/384f06ae49854089e0cf13ffe34560627ea86f8a
+
+This is fixed in blead by change 33129 but was skipped for maint-5.10.
+
+---
+ lib/Math/BigInt/CalcEmu.pm | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/lib/Math/BigInt/CalcEmu.pm b/lib/Math/BigInt/CalcEmu.pm
+index 79efac6..5810f5d 100644
+--- a/lib/Math/BigInt/CalcEmu.pm
++++ b/lib/Math/BigInt/CalcEmu.pm
+@@ -295,7 +295,7 @@ Math::BigInt::CalcEmu - Emulate low-level math with BigInt code
+ =head1 DESCRIPTION
+
+ Contains routines that emulate low-level math functions in BigInt, e.g.
+-optional routines the low-level math package does not provide on it's own.
++optional routines the low-level math package does not provide on its own.
+
+ Will be loaded on demand and called automatically by BigInt.
+
+--
+tg: (daf8b46..) fixes/assorted_docs (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/autodie-flock.diff b/recipes/perl/perl-5.10.1/autodie-flock.diff
new file mode 100644
index 0000000000..19ea3aae67
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/autodie-flock.diff
@@ -0,0 +1,98 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Allow for flock returning EAGAIN instead of EWOULDBLOCK on linux/parisc
+Bug-Debian: http://bugs.debian.org/543731
+Origin: upstream, http://github.com/pfenwick/autodie/commit/037738e11a6097734b0e1dabdd77b92e5fe35219
+
+
+---
+ lib/Fatal.pm | 14 +++++++++++++-
+ lib/autodie/t/flock.t | 12 ++++++++++--
+ 2 files changed, 23 insertions(+), 3 deletions(-)
+
+diff --git a/lib/Fatal.pm b/lib/Fatal.pm
+old mode 100644
+new mode 100755
+index 18e71ed..c17a257
+--- a/lib/Fatal.pm
++++ b/lib/Fatal.pm
+@@ -5,6 +5,7 @@ use Carp;
+ use strict;
+ use warnings;
+ use Tie::RefHash; # To cache subroutine refs
++use Config;
+
+ use constant PERL510 => ( $] >= 5.010 );
+
+@@ -52,6 +53,10 @@ our %_EWOULDBLOCK = (
+ MSWin32 => 33,
+ );
+
++# the linux parisc port has separate EAGAIN and EWOULDBLOCK,
++# and the kernel returns EAGAIN
++my $try_EAGAIN = ($^O eq 'linux' and $Config{archname} =~ /hppa|parisc/) ? 1 : 0;
++
+ # We have some tags that can be passed in for use with import.
+ # These are all assumed to be CORE::
+
+@@ -720,6 +725,11 @@ sub _one_invocation {
+ my $EWOULDBLOCK = eval { POSIX::EWOULDBLOCK(); }
+ || $_EWOULDBLOCK{$^O}
+ || _autocroak("Internal error - can't overload flock - EWOULDBLOCK not defined on this system.");
++ my $EAGAIN = $EWOULDBLOCK;
++ if ($try_EAGAIN) {
++ $EAGAIN = eval { POSIX::EAGAIN(); }
++ || _autocroak("Internal error - can't overload flock - EAGAIN not defined on this system.");
++ }
+
+ require Fcntl; # For Fcntl::LOCK_NB
+
+@@ -735,7 +745,9 @@ sub _one_invocation {
+ # If we failed, but we're using LOCK_NB and
+ # returned EWOULDBLOCK, it's not a real error.
+
+- if (\$_[1] & Fcntl::LOCK_NB() and \$! == $EWOULDBLOCK ) {
++ if (\$_[1] & Fcntl::LOCK_NB() and
++ (\$! == $EWOULDBLOCK or
++ ($try_EAGAIN and \$! == $EAGAIN ))) {
+ return \$retval;
+ }
+
+diff --git a/lib/autodie/t/flock.t b/lib/autodie/t/flock.t
+index a7550ba..6421a56 100755
+--- a/lib/autodie/t/flock.t
++++ b/lib/autodie/t/flock.t
+@@ -2,7 +2,8 @@
+ use strict;
+ use Test::More;
+ use Fcntl qw(:flock);
+-use POSIX qw(EWOULDBLOCK);
++use POSIX qw(EWOULDBLOCK EAGAIN);
++use Config;
+
+ require Fatal;
+
+@@ -10,6 +11,9 @@ my $EWOULDBLOCK = eval { EWOULDBLOCK() }
+ || $Fatal::_EWOULDBLOCK{$^O}
+ || plan skip_all => "EWOULDBLOCK not defined on this system";
+
++my $try_EAGAIN = ($^O eq 'linux' and $Config{archname} =~ /hppa|parisc/) ? 1 : 0;
++my $EAGAIN = eval { EAGAIN() };
++
+ my ($self_fh, $self_fh2);
+
+ eval {
+@@ -55,7 +59,11 @@ eval {
+ $return = flock($self_fh2, LOCK_EX | LOCK_NB);
+ };
+
+-is($!+0, $EWOULDBLOCK, "Double-flocking should be EWOULDBLOCK");
++if (!$try_EAGAIN) {
++ is($!+0, $EWOULDBLOCK, "Double-flocking should be EWOULDBLOCK");
++} else {
++ ok($!+0 == $EWOULDBLOCK || $!+0 == $EAGAIN, "Double-flocking should be EWOULDBLOCK or EAGAIN");
++}
+ ok(!$return, "flocking a file twice should fail");
+ is($@, "", "Non-blocking flock should not fail on EWOULDBLOCK");
+
+--
+tg: (daf8b46..) fixes/autodie-flock (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/cpan_config_path.diff b/recipes/perl/perl-5.10.1/cpan_config_path.diff
new file mode 100644
index 0000000000..c4f161977c
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/cpan_config_path.diff
@@ -0,0 +1,22 @@
+Subject: Set location of CPAN::Config to /etc/perl as /usr may not be writable.
+
+
+---
+ lib/CPAN/HandleConfig.pm | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/lib/CPAN/HandleConfig.pm b/lib/CPAN/HandleConfig.pm
+index 903b414..ba7dae8 100644
+--- a/lib/CPAN/HandleConfig.pm
++++ b/lib/CPAN/HandleConfig.pm
+@@ -541,7 +541,7 @@ sub load {
+ $configpm = $INC{"CPAN/MyConfig.pm"};
+ $redo++;
+ } else {
+- my($path_to_cpan) = File::Basename::dirname($INC{"CPAN.pm"});
++ my($path_to_cpan) = '/etc/perl';
+ my($configpmdir) = File::Spec->catdir($path_to_cpan,"CPAN");
+ my($configpmtest) = File::Spec->catfile($configpmdir,"Config.pm");
+ my $inc_key;
+--
+tg: (daf8b46..) debian/cpan_config_path (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/cpan_definstalldirs.diff b/recipes/perl/perl-5.10.1/cpan_definstalldirs.diff
new file mode 100644
index 0000000000..1b306aba12
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/cpan_definstalldirs.diff
@@ -0,0 +1,35 @@
+Subject: Provide a sensible INSTALLDIRS default for modules installed from CPAN.
+
+Some modules which are included in core set INSTALLDIRS => 'perl'
+explicitly in Makefile.PL or Build.PL. This makes sense for the normal @INC
+ordering, but not ours.
+
+
+---
+ lib/CPAN/FirstTime.pm | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/CPAN/FirstTime.pm b/lib/CPAN/FirstTime.pm
+index 50bebc3..0136fef 100644
+--- a/lib/CPAN/FirstTime.pm
++++ b/lib/CPAN/FirstTime.pm
+@@ -952,7 +952,7 @@ sub init {
+ my_prompt_loop(prefer_installer => 'MB', $matcher, 'MB|EUMM|RAND');
+
+ if (!$matcher or 'makepl_arg make_arg' =~ /$matcher/) {
+- my_dflt_prompt(makepl_arg => "", $matcher);
++ my_dflt_prompt(makepl_arg => "INSTALLDIRS=site", $matcher);
+ my_dflt_prompt(make_arg => "", $matcher);
+ if ( $CPAN::Config->{makepl_arg} =~ /LIBS=|INC=/ ) {
+ $CPAN::Frontend->mywarn(
+@@ -974,7 +974,7 @@ sub init {
+ my_dflt_prompt(make_install_arg => $CPAN::Config->{make_arg} || "",
+ $matcher);
+
+- my_dflt_prompt(mbuildpl_arg => "", $matcher);
++ my_dflt_prompt(mbuildpl_arg => "--installdirs site", $matcher);
+ my_dflt_prompt(mbuild_arg => "", $matcher);
+
+ if (exists $CPAN::HandleConfig::keys{mbuild_install_build_command}
+--
+tg: (daf8b46..) debian/cpan_definstalldirs (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/cpanplus_config_path.diff b/recipes/perl/perl-5.10.1/cpanplus_config_path.diff
new file mode 100644
index 0000000000..321ac451d2
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/cpanplus_config_path.diff
@@ -0,0 +1,43 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Save local versions of CPANPLUS::Config::System into /etc/perl.
+
+This is a configuration file and needs to go in /etc by policy.
+Besides, /usr may not even be writable.
+
+This mirrors the Debian setup of CPAN.pm in debian/cpan_config_path.
+
+See #533707.
+
+---
+ lib/CPANPLUS/Configure.pm | 1 +
+ lib/CPANPLUS/Internals/Constants.pm | 3 +++
+ 2 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/lib/CPANPLUS/Configure.pm b/lib/CPANPLUS/Configure.pm
+index 2d249e5..bbed1b8 100644
+--- a/lib/CPANPLUS/Configure.pm
++++ b/lib/CPANPLUS/Configure.pm
+@@ -276,6 +276,7 @@ Saves the configuration to the package name you provided.
+ If this package is not C<CPANPLUS::Config::System>, it will
+ be saved in your C<.cpanplus> directory, otherwise it will
+ be attempted to be saved in the system wide directory.
++(On Debian systems, this system wide directory is /etc/perl.)
+
+ If no argument is provided, it will default to your personal
+ config.
+diff --git a/lib/CPANPLUS/Internals/Constants.pm b/lib/CPANPLUS/Internals/Constants.pm
+index 1d05c98..7a5cef8 100644
+--- a/lib/CPANPLUS/Internals/Constants.pm
++++ b/lib/CPANPLUS/Internals/Constants.pm
+@@ -194,6 +194,9 @@ use constant CONFIG_USER_FILE => sub {
+ ) . '.pm';
+ };
+ use constant CONFIG_SYSTEM_FILE => sub {
++ # Debian-specific shortcut
++ return '/etc/perl/CPANPLUS/Config/System.pm';
++
+ require CPANPLUS::Internals;
+ require File::Basename;
+ my $dir = File::Basename::dirname(
+--
+tg: (daf8b46..) debian/cpanplus_config_path (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/cpanplus_definstalldirs.diff b/recipes/perl/perl-5.10.1/cpanplus_definstalldirs.diff
new file mode 100644
index 0000000000..eeeff4347f
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/cpanplus_definstalldirs.diff
@@ -0,0 +1,52 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Configure CPANPLUS to use the site directories by default.
+Closes: 533707
+
+The core modules usually default to INSTALLDIRS=perl (ExtUtils::MakeMaker)
+or installdirs=core (Module::Build), so we need to explicitly ask for
+the site destination to get upgraded versions into /usr/local.
+
+See also the sister patch, debian/cpan_definstalldirs .
+
+---
+ lib/CPANPLUS/Config/System.pm | 30 ++++++++++++++++++++++++++++++
+ 1 files changed, 30 insertions(+), 0 deletions(-)
+
+diff --git a/lib/CPANPLUS/Config/System.pm b/lib/CPANPLUS/Config/System.pm
+new file mode 100644
+index 0000000..5e6e11e
+--- /dev/null
++++ b/lib/CPANPLUS/Config/System.pm
+@@ -0,0 +1,30 @@
++### minimal pod, so you can find it with perldoc -l, etc
++=pod
++
++=head1 NAME
++
++CPANPLUS::Config::System
++
++=head1 DESCRIPTION
++
++This is a CPANPLUS configuration file that sets appropriate default
++settings on Debian systems.
++
++The only preconfigured settings are C<makemakerflags> (set to
++C<INSTALLDIRS=site>) and C<buildflags> (set to C<--installdirs site>).
++
++These settings will not have any effect if
++C</etc/perl/CPANPLUS/Config/System.pm> is present.
++
++=cut
++
++
++package CPANPLUS::Config::System;
++
++sub setup {
++ my $conf = shift;
++ $conf->set_conf( makemakerflags => 'INSTALLDIRS=site' );
++ $conf->set_conf( buildflags => '--installdirs site' );
++}
++
++1;
+--
+tg: (daf8b46..) debian/cpanplus_definstalldirs (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/crash-on-undefined-destroy.diff b/recipes/perl/perl-5.10.1/crash-on-undefined-destroy.diff
new file mode 100644
index 0000000000..6991140cd1
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/crash-on-undefined-destroy.diff
@@ -0,0 +1,58 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Fix a NULL pointer dereference when looking for a DESTROY method
+Bug-Debian: http://bugs.debian.org/564074
+Bug: http://rt.perl.org/rt3/Public/Bug/Display.html?id=71952
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/1f15e670edb515b744e9021b4a42a7955da83093
+
+The empty DESTROY method optimization introduced by upstream commit
+fbb3ee5af3d would crash the interpreter if a DESTROY method was declared
+but not actually defined.
+
+
+---
+ sv.c | 3 ++-
+ t/op/method.t | 11 ++++++++++-
+ 2 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/sv.c b/sv.c
+index d2fcb0c..ec1ac82 100644
+--- a/sv.c
++++ b/sv.c
+@@ -5419,7 +5419,8 @@ Perl_sv_clear(pTHX_ register SV *sv)
+ if (destructor
+ /* Don't bother calling an empty destructor */
+ && (CvISXSUB(destructor)
+- || CvSTART(destructor)->op_next->op_type != OP_LEAVESUB))
++ || (CvSTART(destructor)
++ && (CvSTART(destructor)->op_next->op_type != OP_LEAVESUB))))
+ {
+ SV* const tmpref = newRV(sv);
+ SvREADONLY_on(tmpref); /* DESTROY() could be naughty */
+diff --git a/t/op/method.t b/t/op/method.t
+index 46c4642..8e91c48 100755
+--- a/t/op/method.t
++++ b/t/op/method.t
+@@ -10,7 +10,7 @@ BEGIN {
+ require "test.pl";
+ }
+
+-print "1..78\n";
++print "1..79\n";
+
+ @A::ISA = 'B';
+ @B::ISA = 'C';
+@@ -293,3 +293,12 @@ EOT
+ "check if UNIVERSAL::AUTOLOAD works",
+ );
+ }
++{
++ fresh_perl_is(<<'EOT',
++sub M::DESTROY; bless {}, "M" ; print "survived\n";
++EOT
++ "survived",
++ {},
++ "no crash with a declared but missing DESTROY method"
++ );
++}
+--
+tg: (daf8b46..) fixes/crash-on-undefined-destroy (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/db_file_ver.diff b/recipes/perl/perl-5.10.1/db_file_ver.diff
new file mode 100644
index 0000000000..921942901c
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/db_file_ver.diff
@@ -0,0 +1,32 @@
+Subject: Remove overly restrictive DB_File version check.
+Bug-Debian: http://bugs.debian.org/340047
+
+Package dependencies ensure the correct library is linked at run-time.
+
+
+---
+ ext/DB_File/version.c | 2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/ext/DB_File/version.c b/ext/DB_File/version.c
+index 47158d3..67ccdff 100644
+--- a/ext/DB_File/version.c
++++ b/ext/DB_File/version.c
+@@ -48,6 +48,7 @@ __getBerkeleyDBInfo()
+
+ (void)db_version(&Major, &Minor, &Patch) ;
+
++#ifndef DEBIAN
+ /* Check that the versions of db.h and libdb.a are the same */
+ if (Major != DB_VERSION_MAJOR || Minor != DB_VERSION_MINOR )
+ /* || Patch != DB_VERSION_PATCH) */
+@@ -55,6 +56,7 @@ __getBerkeleyDBInfo()
+ croak("\nDB_File was build with libdb version %d.%d.%d,\nbut you are attempting to run it with libdb version %d.%d.%d\n",
+ DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
+ Major, Minor, Patch) ;
++#endif /* DEBIAN */
+
+ /* check that libdb is recent enough -- we need 2.3.4 or greater */
+ if (Major == 2 && (Minor < 3 || (Minor == 3 && Patch < 4)))
+--
+tg: (daf8b46..) debian/db_file_ver (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/devel-ppport-ia64-optim.diff b/recipes/perl/perl-5.10.1/devel-ppport-ia64-optim.diff
new file mode 100644
index 0000000000..98bdc109bf
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/devel-ppport-ia64-optim.diff
@@ -0,0 +1,32 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Work around an ICE on ia64
+Closes: 548943
+
+Temporarily work around an internal compiler error in Devel::PPPort
+on ia64+gcc-4.3.
+
+
+---
+ ext/Devel-PPPort/Makefile.PL | 7 +++++++
+ 1 files changed, 7 insertions(+), 0 deletions(-)
+
+diff --git a/ext/Devel-PPPort/Makefile.PL b/ext/Devel-PPPort/Makefile.PL
+index 67eebc1..f1ef7a2 100644
+--- a/ext/Devel-PPPort/Makefile.PL
++++ b/ext/Devel-PPPort/Makefile.PL
+@@ -75,6 +75,13 @@ sub configure
+ push @moreopts, INSTALLDIRS => ($] >= 5.007003 ? 'perl' : 'site');
+ }
+
++
++ # temporary Debian hack, see http://bugs.debian.org/548943
++ require Config;
++ if ($Config::Config{archname} =~ /^ia64/) {
++ push @moreopts, OPTIMIZE => '-g -O0';
++ }
++
+ if ($opt{'apicheck'}) {
+ $PL_FILES{'apicheck_c.PL'} = 'apicheck.c';
+ push @C_FILES, qw{ apicheck.c };
+--
+tg: (daf8b46..) debian/devel-ppport-ia64-optim (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/disable-zlib-bundling.diff b/recipes/perl/perl-5.10.1/disable-zlib-bundling.diff
new file mode 100644
index 0000000000..0a3e6d1a22
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/disable-zlib-bundling.diff
@@ -0,0 +1,29 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Disable zlib bundling in Compress::Raw::Zlib
+
+Compress::Raw::Zlib statically links its bundled version of zlib
+by default, but we use the system library instead.
+
+---
+ ext/Compress-Raw-Zlib/config.in | 6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/ext/Compress-Raw-Zlib/config.in b/ext/Compress-Raw-Zlib/config.in
+index c56cc03..2c6659b 100644
+--- a/ext/Compress-Raw-Zlib/config.in
++++ b/ext/Compress-Raw-Zlib/config.in
+@@ -16,9 +16,9 @@
+ # Setting the Gzip OS Code
+ #
+
+-BUILD_ZLIB = True
+-INCLUDE = ./zlib-src
+-LIB = ./zlib-src
++BUILD_ZLIB = False
++INCLUDE = /usr/include
++LIB = /usr/lib
+
+ OLD_ZLIB = False
+ GZIP_OS_CODE = AUTO_DETECT
+--
+tg: (daf8b46..) debian/disable-zlib-bundling (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/doc_info.diff b/recipes/perl/perl-5.10.1/doc_info.diff
new file mode 100644
index 0000000000..14d872ca55
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/doc_info.diff
@@ -0,0 +1,55 @@
+Subject: Replace generic man(1) instructions with Debian-specific information.
+
+Indicate that the user needs to install the perl-doc package.
+
+
+---
+ pod/perl.pod | 30 +++++++-----------------------
+ 1 files changed, 7 insertions(+), 23 deletions(-)
+
+diff --git a/pod/perl.pod b/pod/perl.pod
+index 939c683..134bb77 100644
+--- a/pod/perl.pod
++++ b/pod/perl.pod
+@@ -227,32 +227,16 @@ For ease of access, the Perl manual has been split up into several sections.
+ perlwin32 Perl notes for Windows
+
+
+-By default, the manpages listed above are installed in the
+-F</usr/local/man/> directory.
++On Debian systems, you need to install the B<perl-doc> package which
++contains the majority of the standard Perl documentation and the
++F<perldoc> program.
+
+-Extensive additional documentation for Perl modules is available. The
+-default configuration for perl will place this additional documentation
+-in the F</usr/local/lib/perl5/man> directory (or else in the F<man>
+-subdirectory of the Perl library directory). Some of this additional
+-documentation is distributed standard with Perl, but you'll also find
+-documentation for third-party modules there.
++Extensive additional documentation for Perl modules is available, both
++those distributed with Perl and third-party modules which are packaged
++or locally installed.
+
+ You should be able to view Perl's documentation with your man(1)
+-program by including the proper directories in the appropriate start-up
+-files, or in the MANPATH environment variable. To find out where the
+-configuration has installed the manpages, type:
+-
+- perl -V:man.dir
+-
+-If the directories have a common stem, such as F</usr/local/man/man1>
+-and F</usr/local/man/man3>, you need only to add that stem
+-(F</usr/local/man>) to your man(1) configuration files or your MANPATH
+-environment variable. If they do not share a stem, you'll have to add
+-both stems.
+-
+-If that doesn't work for some reason, you can still use the
+-supplied F<perldoc> script to view module information. You might
+-also look into getting a replacement man program.
++program or perldoc(1).
+
+ If something strange has gone wrong with your program and you're not
+ sure where you should look for help, try the B<-w> switch first. It
+--
+tg: (daf8b46..) debian/doc_info (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/enc2xs_inc.diff b/recipes/perl/perl-5.10.1/enc2xs_inc.diff
new file mode 100644
index 0000000000..57cee24f39
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/enc2xs_inc.diff
@@ -0,0 +1,49 @@
+Subject: Tweak enc2xs to follow symlinks and ignore missing @INC directories.
+Bug-Debian: http://bugs.debian.org/290336
+
+- ignore missing directories,
+- follow symlinks (/usr/share/perl/5.8 -> 5.8.4).
+
+
+---
+ ext/Encode/bin/enc2xs | 8 ++++----
+ 1 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/ext/Encode/bin/enc2xs b/ext/Encode/bin/enc2xs
+index 233ca54..502baec 100644
+--- a/ext/Encode/bin/enc2xs
++++ b/ext/Encode/bin/enc2xs
+@@ -924,11 +924,11 @@ use vars qw(
+ sub find_e2x{
+ eval { require File::Find; };
+ my (@inc, %e2x_dir);
+- for my $inc (@INC){
++ for my $inc (grep -d, @INC){
+ push @inc, $inc unless $inc eq '.'; #skip current dir
+ }
+ File::Find::find(
+- sub {
++ { wanted => sub {
+ my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
+ $atime,$mtime,$ctime,$blksize,$blocks)
+ = lstat($_) or return;
+@@ -938,7 +938,7 @@ sub find_e2x{
+ $e2x_dir{$File::Find::dir} ||= $mtime;
+ }
+ return;
+- }, @inc);
++ }, follow => 1}, @inc);
+ warn join("\n", keys %e2x_dir), "\n";
+ for my $d (sort {$e2x_dir{$a} <=> $e2x_dir{$b}} keys %e2x_dir){
+ $_E2X = $d;
+@@ -1005,7 +1005,7 @@ sub make_configlocal_pm {
+ $LocalMod{$enc} ||= $mod;
+ }
+ };
+- File::Find::find({wanted => $wanted}, @INC);
++ File::Find::find({wanted => $wanted, follow => 1}, grep -d, @INC);
+ $_ModLines = "";
+ for my $enc ( sort keys %LocalMod ) {
+ $_ModLines .=
+--
+tg: (daf8b46..) debian/enc2xs_inc (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/errno_ver.diff b/recipes/perl/perl-5.10.1/errno_ver.diff
new file mode 100644
index 0000000000..49c4901c63
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/errno_ver.diff
@@ -0,0 +1,32 @@
+Subject: Remove Errno version check due to upgrade problems with long-running processes.
+Bug-Debian: http://bugs.debian.org/343351
+
+Remove version check which can cause problems for long running
+processes embedding perl when upgrading to a newer version,
+compatible, but built on a different machine.
+
+
+---
+ ext/Errno/Errno_pm.PL | 5 -----
+ 1 files changed, 0 insertions(+), 5 deletions(-)
+
+diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
+index 124b8fc..b554cd4 100644
+--- a/ext/Errno/Errno_pm.PL
++++ b/ext/Errno/Errno_pm.PL
+@@ -341,13 +341,8 @@ EOF
+ package Errno;
+ our (\@EXPORT_OK,\%EXPORT_TAGS,\@ISA,\$VERSION,\%errno,\$AUTOLOAD);
+ use Exporter ();
+-use Config;
+ use strict;
+
+-"\$Config{'archname'}-\$Config{'osvers'}" eq
+-"$Config{'archname'}-$Config{'osvers'}" or
+- die "Errno architecture ($Config{'archname'}-$Config{'osvers'}) does not match executable architecture (\$Config{'archname'}-\$Config{'osvers'})";
+-
+ \$VERSION = "$VERSION";
+ \$VERSION = eval \$VERSION;
+ \@ISA = qw(Exporter);
+--
+tg: (daf8b46..) debian/errno_ver (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/extutils_hacks.diff b/recipes/perl/perl-5.10.1/extutils_hacks.diff
new file mode 100644
index 0000000000..94120cb1c8
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/extutils_hacks.diff
@@ -0,0 +1,313 @@
+Subject: Various debian-specific ExtUtils changes
+
+ * Respect umask during installation, and set as appropriate for each of
+ perl, vendor and site (policy requires group writable site dirs).
+
+ * Don't install .packlist or perllocal.pod for perl or vendor.
+ * Fiddle with *PREFIX and variables written to the makefile so that
+ install directories may be changed when make is run by passing
+ PREFIX= to the "make install" command (used when packaging
+ modules).
+
+ * Set location of libperl.a to /usr/lib.
+ * Note that libperl-dev package is required for embedded linking.
+ * Change install target dependencies to facilitate parallel makes.
+
+
+---
+ lib/ExtUtils/Embed.pm | 3 ++
+ lib/ExtUtils/Install.pm | 18 ++++++++--------
+ lib/ExtUtils/MM_Any.pm | 12 +++++-----
+ lib/ExtUtils/MM_Unix.pm | 44 +++++++++--------------------------------
+ lib/ExtUtils/t/INST.t | 4 +--
+ lib/ExtUtils/t/INST_PREFIX.t | 10 ++++----
+ 6 files changed, 34 insertions(+), 57 deletions(-)
+
+diff --git a/lib/ExtUtils/Embed.pm b/lib/ExtUtils/Embed.pm
+index 24ae909..12d421d 100644
+--- a/lib/ExtUtils/Embed.pm
++++ b/lib/ExtUtils/Embed.pm
+@@ -305,6 +305,9 @@ and extensions in your C/C++ applications.
+ Typically, an application B<Makefile> will invoke ExtUtils::Embed
+ functions while building your application.
+
++Note that on Debian systems the B<libperl-dev> package is required for
++compiling applications which embed an interpreter.
++
+ =head1 @EXPORT
+
+ ExtUtils::Embed exports the following functions:
+diff --git a/lib/ExtUtils/Install.pm b/lib/ExtUtils/Install.pm
+index c886c69..7a0c24e 100644
+--- a/lib/ExtUtils/Install.pm
++++ b/lib/ExtUtils/Install.pm
+@@ -457,7 +457,7 @@ sub _can_write_dir {
+
+ =pod
+
+-=item _mkpath($dir,$show,$mode,$verbose,$dry_run)
++=item _mkpath($dir,$show,$verbose,$dry_run)
+
+ Wrapper around File::Path::mkpath() to handle errors.
+
+@@ -474,13 +474,13 @@ writable.
+ =cut
+
+ sub _mkpath {
+- my ($dir,$show,$mode,$verbose,$dry_run)=@_;
++ my ($dir,$show,$verbose,$dry_run)=@_;
+ if ( $verbose && $verbose > 1 && ! -d $dir) {
+ $show= 1;
+- printf "mkpath(%s,%d,%#o)\n", $dir, $show, $mode;
++ printf "mkpath(%s,%d)\n", $dir, $show;
+ }
+ if (!$dry_run) {
+- if ( ! eval { File::Path::mkpath($dir,$show,$mode); 1 } ) {
++ if ( ! eval { File::Path::mkpath($dir,$show); 1 } ) {
+ _choke("Can't create '$dir'","$@");
+ }
+
+@@ -787,7 +787,7 @@ sub install { #XXX OS-SPECIFIC
+ _chdir($cwd);
+ }
+ foreach my $targetdir (sort keys %check_dirs) {
+- _mkpath( $targetdir, 0, 0755, $verbose, $dry_run );
++ _mkpath( $targetdir, 0, $verbose, $dry_run );
+ }
+ foreach my $found (@found_files) {
+ my ($diff, $ffd, $origfile, $mode, $size, $atime, $mtime,
+@@ -801,7 +801,7 @@ sub install { #XXX OS-SPECIFIC
+ $targetfile= _unlink_or_rename( $targetfile, 'tryhard', 'install' )
+ unless $dry_run;
+ } elsif ( ! -d $targetdir ) {
+- _mkpath( $targetdir, 0, 0755, $verbose, $dry_run );
++ _mkpath( $targetdir, 0, $verbose, $dry_run );
+ }
+ print "Installing $targetfile\n";
+
+@@ -841,7 +841,7 @@ sub install { #XXX OS-SPECIFIC
+
+ if ($pack{'write'}) {
+ $dir = install_rooted_dir(dirname($pack{'write'}));
+- _mkpath( $dir, 0, 0755, $verbose, $dry_run );
++ _mkpath( $dir, 0, $verbose, $dry_run );
+ print "Writing $pack{'write'}\n" if $verbose;
+ $packlist->write(install_rooted_file($pack{'write'})) unless $dry_run;
+ }
+@@ -1181,7 +1181,7 @@ be prepended as a directory to each installed file (and directory).
+ sub pm_to_blib {
+ my($fromto,$autodir,$pm_filter) = @_;
+
+- _mkpath($autodir,0,0755);
++ _mkpath($autodir,0);
+ while(my($from, $to) = each %$fromto) {
+ if( -f $to && -s $from == -s $to && -M $to < -M $from ) {
+ print "Skip $to (unchanged)\n";
+@@ -1204,7 +1204,7 @@ sub pm_to_blib {
+ # we wont try hard here. its too likely to mess things up.
+ forceunlink($to);
+ } else {
+- _mkpath(dirname($to),0,0755);
++ _mkpath(dirname($to),0);
+ }
+ if ($need_filtering) {
+ run_filter($pm_filter, $from, $to);
+diff --git a/lib/ExtUtils/MM_Any.pm b/lib/ExtUtils/MM_Any.pm
+index a7afe20..402e0c0 100644
+--- a/lib/ExtUtils/MM_Any.pm
++++ b/lib/ExtUtils/MM_Any.pm
+@@ -701,8 +701,6 @@ all POD files in MAN1PODS and MAN3PODS.
+ sub manifypods_target {
+ my($self) = shift;
+
+- my $man1pods = '';
+- my $man3pods = '';
+ my $dependencies = '';
+
+ # populate manXpods & dependencies:
+@@ -718,7 +716,7 @@ END
+ foreach my $section (qw(1 3)) {
+ my $pods = $self->{"MAN${section}PODS"};
+ push @man_cmds, $self->split_command(<<CMD, %$pods);
+- \$(NOECHO) \$(POD2MAN) --section=$section --perm_rw=\$(PERM_RW)
++ \$(NOECHO) \$(POD2MAN) --section=\$(MAN${section}EXT) --perm_rw=\$(PERM_RW)
+ CMD
+ }
+
+@@ -1428,9 +1426,11 @@ sub init_INSTALL_from_PREFIX {
+ $self->{SITEPREFIX} ||= $sprefix;
+ $self->{VENDORPREFIX} ||= $vprefix;
+
+- # Lots of MM extension authors like to use $(PREFIX) so we
+- # put something sensible in there no matter what.
+- $self->{PREFIX} = '$('.uc $self->{INSTALLDIRS}.'PREFIX)';
++ my $p = $self->{PREFIX} = $self->{PERLPREFIX};
++ for my $t (qw/PERL SITE VENDOR/)
++ {
++ $self->{"${t}PREFIX"} =~ s!^\Q$p\E(?=/|$)!\$(PREFIX)!;
++ }
+ }
+
+ my $arch = $Config{archname};
+diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm
+index ad28b22..c3504b6 100644
+--- a/lib/ExtUtils/MM_Unix.pm
++++ b/lib/ExtUtils/MM_Unix.pm
+@@ -2046,9 +2046,7 @@ doc__install : doc_site_install
+ $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
+
+ pure_perl_install :: all
+- $(NOECHO) $(MOD_INSTALL) \
+- read }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
+- write }.$self->catfile('$(DESTINSTALLARCHLIB)','auto','$(FULLEXT)','.packlist').q{ \
++ $(NOECHO) umask 022; $(MOD_INSTALL) \
+ $(INST_LIB) $(DESTINSTALLPRIVLIB) \
+ $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \
+ $(INST_BIN) $(DESTINSTALLBIN) \
+@@ -2060,7 +2058,7 @@ pure_perl_install :: all
+
+
+ pure_site_install :: all
+- $(NOECHO) $(MOD_INSTALL) \
++ $(NOECHO) umask 02; $(MOD_INSTALL) \
+ read }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \
+ write }.$self->catfile('$(DESTINSTALLSITEARCH)','auto','$(FULLEXT)','.packlist').q{ \
+ $(INST_LIB) $(DESTINSTALLSITELIB) \
+@@ -2073,9 +2071,7 @@ pure_site_install :: all
+ }.$self->catdir('$(PERL_ARCHLIB)','auto','$(FULLEXT)').q{
+
+ pure_vendor_install :: all
+- $(NOECHO) $(MOD_INSTALL) \
+- read }.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{ \
+- write }.$self->catfile('$(DESTINSTALLVENDORARCH)','auto','$(FULLEXT)','.packlist').q{ \
++ $(NOECHO) umask 022; $(MOD_INSTALL) \
+ $(INST_LIB) $(DESTINSTALLVENDORLIB) \
+ $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \
+ $(INST_BIN) $(DESTINSTALLVENDORBIN) \
+@@ -2084,37 +2080,19 @@ pure_vendor_install :: all
+ $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR)
+
+ doc_perl_install :: all
+- $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+- -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+- -$(NOECHO) $(DOC_INSTALL) \
+- "Module" "$(NAME)" \
+- "installed into" "$(INSTALLPRIVLIB)" \
+- LINKTYPE "$(LINKTYPE)" \
+- VERSION "$(VERSION)" \
+- EXE_FILES "$(EXE_FILES)" \
+- >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
+
+ doc_site_install :: all
+- $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+- -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+- -$(NOECHO) $(DOC_INSTALL) \
++ $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLSITEARCH)/perllocal.pod
++ -$(NOECHO) umask 02; $(MKPATH) $(DESTINSTALLSITEARCH)
++ -$(NOECHO) umask 02; $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLSITELIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+ VERSION "$(VERSION)" \
+ EXE_FILES "$(EXE_FILES)" \
+- >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
++ >> }.$self->catfile('$(DESTINSTALLSITEARCH)','perllocal.pod').q{
+
+ doc_vendor_install :: all
+- $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+- -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+- -$(NOECHO) $(DOC_INSTALL) \
+- "Module" "$(NAME)" \
+- "installed into" "$(INSTALLVENDORLIB)" \
+- LINKTYPE "$(LINKTYPE)" \
+- VERSION "$(VERSION)" \
+- EXE_FILES "$(EXE_FILES)" \
+- >> }.$self->catfile('$(DESTINSTALLARCHLIB)','perllocal.pod').q{
+
+ };
+
+@@ -2123,13 +2101,12 @@ uninstall :: uninstall_from_$(INSTALLDIRS)dirs
+ $(NOECHO) $(NOOP)
+
+ uninstall_from_perldirs ::
+- $(NOECHO) $(UNINSTALL) }.$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist').q{
+
+ uninstall_from_sitedirs ::
+ $(NOECHO) $(UNINSTALL) }.$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist').q{
+
+ uninstall_from_vendordirs ::
+- $(NOECHO) $(UNINSTALL) }.$self->catfile('$(VENDORARCHEXP)','auto','$(FULLEXT)','.packlist').q{
++
+ };
+
+ join("",@m);
+@@ -2402,7 +2379,7 @@ MAP_PRELIBS = $Config{perllibs} $Config{cryptlib}
+ ($lperl = $libperl) =~ s/\$\(A\)/$self->{LIB_EXT}/;
+ }
+ unless ($libperl && -f $lperl) { # Ilya's code...
+- my $dir = $self->{PERL_SRC} || "$self->{PERL_ARCHLIB}/CORE";
++ my $dir = $self->{PERL_SRC} || "/usr/lib";
+ $dir = "$self->{PERL_ARCHLIB}/.." if $self->{UNINSTALLED_PERL};
+ $libperl ||= "libperl$self->{LIB_EXT}";
+ $libperl = "$dir/$libperl";
+@@ -2986,8 +2963,7 @@ sub prefixify {
+ print STDERR " prefixify $var => $path\n" if $Verbose >= 2;
+ print STDERR " from $sprefix to $rprefix\n" if $Verbose >= 2;
+
+- if( $self->{ARGS}{PREFIX} &&
+- $path !~ s{^\Q$sprefix\E\b}{$rprefix}s )
++ if( $path !~ s{^\Q$sprefix\E\b}{$rprefix}s && $self->{ARGS}{PREFIX} )
+ {
+
+ print STDERR " cannot prefix, using default.\n" if $Verbose >= 2;
+diff --git a/lib/ExtUtils/t/INST.t b/lib/ExtUtils/t/INST.t
+index 49938cb..562e3de 100755
+--- a/lib/ExtUtils/t/INST.t
++++ b/lib/ExtUtils/t/INST.t
+@@ -65,9 +65,7 @@ isa_ok( $mm, 'ExtUtils::MakeMaker' );
+ is( $mm->{NAME}, 'Big::Dummy', 'NAME' );
+ is( $mm->{VERSION}, 0.01, 'VERSION' );
+
+-my $config_prefix = $Config{installprefixexp} || $Config{installprefix} ||
+- $Config{prefixexp} || $Config{prefix};
+-is( $mm->{PERLPREFIX}, $config_prefix, 'PERLPREFIX' );
++is( $mm->{PERLPREFIX}, '$(PREFIX)', 'PERLPREFIX' );
+
+ is( !!$mm->{PERL_CORE}, !!$ENV{PERL_CORE}, 'PERL_CORE' );
+
+diff --git a/lib/ExtUtils/t/INST_PREFIX.t b/lib/ExtUtils/t/INST_PREFIX.t
+index 57e7eb2..337c3b8 100755
+--- a/lib/ExtUtils/t/INST_PREFIX.t
++++ b/lib/ExtUtils/t/INST_PREFIX.t
+@@ -16,7 +16,7 @@ BEGIN {
+ }
+
+ use strict;
+-use Test::More tests => 52;
++use Test::More tests => 47;
+ use MakeMaker::Test::Utils;
+ use MakeMaker::Test::Setup::BFD;
+ use ExtUtils::MakeMaker;
+@@ -62,16 +62,16 @@ like( $stdout->read, qr{
+ Writing\ $Makefile\ for\ Big::Dummy\n
+ }x );
+
+-is( $mm->{PREFIX}, '$(SITEPREFIX)', 'PREFIX set based on INSTALLDIRS' );
++#is( $mm->{PREFIX}, '$(SITEPREFIX)', 'PREFIX set based on INSTALLDIRS' );
+
+ isa_ok( $mm, 'ExtUtils::MakeMaker' );
+
+ is( $mm->{NAME}, 'Big::Dummy', 'NAME' );
+ is( $mm->{VERSION}, 0.01, 'VERSION' );
+
+-foreach my $prefix (qw(PREFIX PERLPREFIX SITEPREFIX VENDORPREFIX)) {
+- unlike( $mm->{$prefix}, qr/\$\(PREFIX\)/ );
+-}
++#foreach my $prefix (qw(PREFIX PERLPREFIX SITEPREFIX VENDORPREFIX)) {
++# unlike( $mm->{$prefix}, qr/\$\(PREFIX\)/ );
++#}
+
+
+ my $PREFIX = File::Spec->catdir('foo', 'bar');
+--
+tg: (daf8b46..) debian/extutils_hacks (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/fakeroot.diff b/recipes/perl/perl-5.10.1/fakeroot.diff
new file mode 100644
index 0000000000..806f38ea39
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/fakeroot.diff
@@ -0,0 +1,43 @@
+Subject: Postpone LD_LIBRARY_PATH evaluation to the binary targets.
+
+Modify the setting of LD_LIBRARY_PATH to append pre-existing values at the
+time the rule is evaluated rather than when the Makefile is created.
+
+This is required when building packages with dpkg-buildpackage and fakeroot,
+since fakeroot (which now sets LD_LIBRARY_PATH) is not used for the "build"
+rule where the Makefile is created, but is for the clean/binary* targets.
+
+
+---
+ Makefile.SH | 9 ++-------
+ 1 files changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/Makefile.SH b/Makefile.SH
+index 12d84ff..2eb7109 100755
+--- a/Makefile.SH
++++ b/Makefile.SH
+@@ -56,12 +56,7 @@ case "$useshrplib" in
+ true)
+ # Prefix all runs of 'miniperl' and 'perl' with
+ # $ldlibpth so that ./perl finds *this* shared libperl.
+- case "$LD_LIBRARY_PATH" in
+- '')
+- ldlibpth="LD_LIBRARY_PATH=`pwd`";;
+- *)
+- ldlibpth="LD_LIBRARY_PATH=`pwd`:${LD_LIBRARY_PATH}";;
+- esac
++ ldlibpth=LD_LIBRARY_PATH=`pwd`'$${LD_LIBRARY_PATH:+:}$$LD_LIBRARY_PATH'
+
+ pldlflags="$cccdlflags"
+ static_ldflags=''
+@@ -132,7 +127,7 @@ true)
+ ;;
+ esac
+ case "$ldlibpthname" in
+- '') ;;
++ ''|LD_LIBRARY_PATH) ;;
+ *)
+ case "$osname" in
+ os2)
+--
+tg: (daf8b46..) debian/fakeroot (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/fcgi-test.diff b/recipes/perl/perl-5.10.1/fcgi-test.diff
new file mode 100644
index 0000000000..740547011c
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/fcgi-test.diff
@@ -0,0 +1,31 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Fix a failure in CGI/t/fast.t when FCGI is installed
+Origin: upstream
+
+Cherry picked from CGI-3.48.
+
+The test is skipped in clean build environments because FCGI is not in
+the core.
+
+Upstream has dropped the whole test from the Perl core distribution for
+the 5.12 series because it relies on external modules. Possibly we should
+do that instead.
+
+---
+ lib/CGI/t/fast.t | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/lib/CGI/t/fast.t b/lib/CGI/t/fast.t
+index 45f8e12..264e047 100755
+--- a/lib/CGI/t/fast.t
++++ b/lib/CGI/t/fast.t
+@@ -32,6 +32,6 @@ SKIP: {
+
+ # if this is false, the package var will be empty
+ $ENV{FCGI_SOCKET_PATH} = 0;
+- is( $CGI::Fast::Ext_Request, '', 'checking no active request' );
++ is( $CGI::Fast::Ext_Request, undef, 'checking no active request' );
+
+ }
+--
+tg: (daf8b46..) fixes/fcgi-test (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/format-write-crash.diff b/recipes/perl/perl-5.10.1/format-write-crash.diff
new file mode 100644
index 0000000000..946f5f1ff5
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/format-write-crash.diff
@@ -0,0 +1,1255 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Fix a crash in format/write
+Bug-Debian: http://bugs.debian.org/579537
+Bug: http://rt.perl.org/rt3/Public/Bug/Display.html?id=22977
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/421f30ed1e95009450bdc7905bf3433ee806ea4f
+
+The perly.act and perly.tab changes were generated with flex 2.5.35-6
+and bison 1:2.3.dfsg-5 from Debian Lenny to avoid unnecessary changes.
+
+---
+ MANIFEST | 1 +
+ perly.act | 284 ++++++++++++++++++++++++++-------------------------
+ perly.tab | 30 +++---
+ perly.y | 8 ++-
+ t/comp/form_scope.t | 18 ++++
+ 5 files changed, 186 insertions(+), 155 deletions(-)
+
+diff --git a/MANIFEST b/MANIFEST
+index 2b5a968..15ce1c7 100644
+--- a/MANIFEST
++++ b/MANIFEST
+@@ -3944,6 +3944,7 @@ t/comp/cpp.aux main file for cpp.t
+ t/comp/cpp.t See if C preprocessor works
+ t/comp/decl.t See if declarations work
+ t/comp/fold.t See if constant folding works
++t/comp/form_scope.t See if format scoping works
+ t/comp/hints.t See if %^H works
+ t/comp/multiline.t See if multiline strings work
+ t/comp/opsubs.t See if q() etc. are not parsed as functions
+diff --git a/perly.act b/perly.act
+index b610294..e426f9e 100644
+--- a/perly.act
++++ b/perly.act
+@@ -450,7 +450,9 @@ case 2:
+
+ case 60:
+ #line 509 "perly.y"
+- { SvREFCNT_inc_simple_void(PL_compcv);
++ {
++ CV *fmtcv = PL_compcv;
++ SvREFCNT_inc_simple_void(PL_compcv);
+ #ifdef MAD
+ (yyval.opval) = newFORM((ps[(2) - (4)].val.ival), (ps[(3) - (4)].val.opval), (ps[(4) - (4)].val.opval));
+ prepend_madprops((ps[(1) - (4)].val.i_tkval)->tk_mad, (yyval.opval), 'F');
+@@ -460,21 +462,25 @@ case 2:
+ newFORM((ps[(2) - (4)].val.ival), (ps[(3) - (4)].val.opval), (ps[(4) - (4)].val.opval));
+ (yyval.opval) = (OP*)NULL;
+ #endif
++ if (CvOUTSIDE(fmtcv) && !CvUNIQUE(CvOUTSIDE(fmtcv))) {
++ SvREFCNT_inc_simple_void(fmtcv);
++ pad_add_anon((SV*)fmtcv, OP_NULL);
++ }
+ ;}
+ break;
+
+ case 61:
+-#line 522 "perly.y"
++#line 528 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 62:
+-#line 523 "perly.y"
++#line 529 "perly.y"
+ { (yyval.opval) = (OP*)NULL; ;}
+ break;
+
+ case 63:
+-#line 528 "perly.y"
++#line 534 "perly.y"
+ { SvREFCNT_inc_simple_void(PL_compcv);
+ #ifdef MAD
+ (yyval.opval) = newMYSUB((ps[(2) - (6)].val.ival), (ps[(3) - (6)].val.opval), (ps[(4) - (6)].val.opval), (ps[(5) - (6)].val.opval), (ps[(6) - (6)].val.opval));
+@@ -487,7 +493,7 @@ case 2:
+ break;
+
+ case 64:
+-#line 541 "perly.y"
++#line 547 "perly.y"
+ { SvREFCNT_inc_simple_void(PL_compcv);
+ #ifdef MAD
+ {
+@@ -510,25 +516,25 @@ case 2:
+ break;
+
+ case 65:
+-#line 563 "perly.y"
++#line 569 "perly.y"
+ { (yyval.ival) = start_subparse(FALSE, 0);
+ SAVEFREESV(PL_compcv); ;}
+ break;
+
+ case 66:
+-#line 569 "perly.y"
++#line 575 "perly.y"
+ { (yyval.ival) = start_subparse(FALSE, CVf_ANON);
+ SAVEFREESV(PL_compcv); ;}
+ break;
+
+ case 67:
+-#line 574 "perly.y"
++#line 580 "perly.y"
+ { (yyval.ival) = start_subparse(TRUE, 0);
+ SAVEFREESV(PL_compcv); ;}
+ break;
+
+ case 68:
+-#line 579 "perly.y"
++#line 585 "perly.y"
+ { const char *const name = SvPV_nolen_const(((SVOP*)(ps[(1) - (1)].val.opval))->op_sv);
+ if (strEQ(name, "BEGIN") || strEQ(name, "END")
+ || strEQ(name, "INIT") || strEQ(name, "CHECK")
+@@ -538,24 +544,24 @@ case 2:
+ break;
+
+ case 69:
+-#line 589 "perly.y"
++#line 595 "perly.y"
+ { (yyval.opval) = (OP*)NULL; ;}
+ break;
+
+ case 71:
+-#line 595 "perly.y"
++#line 601 "perly.y"
+ { (yyval.opval) = (OP*)NULL; ;}
+ break;
+
+ case 72:
+-#line 597 "perly.y"
++#line 603 "perly.y"
+ { (yyval.opval) = (ps[(2) - (2)].val.opval);
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),':');
+ ;}
+ break;
+
+ case 73:
+-#line 601 "perly.y"
++#line 607 "perly.y"
+ { (yyval.opval) = IF_MAD(
+ newOP(OP_NULL, 0),
+ (OP*)NULL
+@@ -565,14 +571,14 @@ case 2:
+ break;
+
+ case 74:
+-#line 611 "perly.y"
++#line 617 "perly.y"
+ { (yyval.opval) = (ps[(2) - (2)].val.opval);
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),':');
+ ;}
+ break;
+
+ case 75:
+-#line 615 "perly.y"
++#line 621 "perly.y"
+ { (yyval.opval) = IF_MAD(
+ newOP(OP_NULL, 0),
+ (OP*)NULL
+@@ -582,12 +588,12 @@ case 2:
+ break;
+
+ case 76:
+-#line 624 "perly.y"
++#line 630 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 77:
+-#line 625 "perly.y"
++#line 631 "perly.y"
+ { (yyval.opval) = IF_MAD(
+ newOP(OP_NULL,0),
+ (OP*)NULL
+@@ -598,7 +604,7 @@ case 2:
+ break;
+
+ case 78:
+-#line 635 "perly.y"
++#line 641 "perly.y"
+ {
+ #ifdef MAD
+ (yyval.opval) = package((ps[(2) - (3)].val.opval));
+@@ -612,12 +618,12 @@ case 2:
+ break;
+
+ case 79:
+-#line 648 "perly.y"
++#line 654 "perly.y"
+ { CvSPECIAL_on(PL_compcv); /* It's a BEGIN {} */ ;}
+ break;
+
+ case 80:
+-#line 650 "perly.y"
++#line 656 "perly.y"
+ { SvREFCNT_inc_simple_void(PL_compcv);
+ #ifdef MAD
+ (yyval.opval) = utilize(IVAL((ps[(1) - (7)].val.i_tkval)), (ps[(2) - (7)].val.ival), (ps[(4) - (7)].val.opval), (ps[(5) - (7)].val.opval), (ps[(6) - (7)].val.opval));
+@@ -634,28 +640,28 @@ case 2:
+ break;
+
+ case 81:
+-#line 667 "perly.y"
++#line 673 "perly.y"
+ { (yyval.opval) = newLOGOP(OP_AND, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 82:
+-#line 671 "perly.y"
++#line 677 "perly.y"
+ { (yyval.opval) = newLOGOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 83:
+-#line 675 "perly.y"
++#line 681 "perly.y"
+ { (yyval.opval) = newLOGOP(OP_DOR, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 85:
+-#line 683 "perly.y"
++#line 689 "perly.y"
+ {
+ #ifdef MAD
+ OP* op = newNULLLIST();
+@@ -668,7 +674,7 @@ case 2:
+ break;
+
+ case 86:
+-#line 693 "perly.y"
++#line 699 "perly.y"
+ {
+ OP* term = (ps[(3) - (3)].val.opval);
+ DO_MAD(
+@@ -680,7 +686,7 @@ case 2:
+ break;
+
+ case 88:
+-#line 706 "perly.y"
++#line 712 "perly.y"
+ { (yyval.opval) = convert(IVAL((ps[(1) - (3)].val.i_tkval)), OPf_STACKED,
+ prepend_elem(OP_LIST, newGVREF(IVAL((ps[(1) - (3)].val.i_tkval)),(ps[(2) - (3)].val.opval)), (ps[(3) - (3)].val.opval)) );
+ TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'o');
+@@ -688,7 +694,7 @@ case 2:
+ break;
+
+ case 89:
+-#line 711 "perly.y"
++#line 717 "perly.y"
+ { (yyval.opval) = convert(IVAL((ps[(1) - (5)].val.i_tkval)), OPf_STACKED,
+ prepend_elem(OP_LIST, newGVREF(IVAL((ps[(1) - (5)].val.i_tkval)),(ps[(3) - (5)].val.opval)), (ps[(4) - (5)].val.opval)) );
+ TOKEN_GETMAD((ps[(1) - (5)].val.i_tkval),(yyval.opval),'o');
+@@ -698,7 +704,7 @@ case 2:
+ break;
+
+ case 90:
+-#line 718 "perly.y"
++#line 724 "perly.y"
+ { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST,
+ prepend_elem(OP_LIST, scalar((ps[(1) - (6)].val.opval)), (ps[(5) - (6)].val.opval)),
+@@ -710,7 +716,7 @@ case 2:
+ break;
+
+ case 91:
+-#line 727 "perly.y"
++#line 733 "perly.y"
+ { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST, scalar((ps[(1) - (3)].val.opval)),
+ newUNOP(OP_METHOD, 0, (ps[(3) - (3)].val.opval))));
+@@ -719,7 +725,7 @@ case 2:
+ break;
+
+ case 92:
+-#line 733 "perly.y"
++#line 739 "perly.y"
+ { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST,
+ prepend_elem(OP_LIST, (ps[(2) - (3)].val.opval), (ps[(3) - (3)].val.opval)),
+@@ -728,7 +734,7 @@ case 2:
+ break;
+
+ case 93:
+-#line 739 "perly.y"
++#line 745 "perly.y"
+ { (yyval.opval) = convert(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST,
+ prepend_elem(OP_LIST, (ps[(2) - (5)].val.opval), (ps[(4) - (5)].val.opval)),
+@@ -739,14 +745,14 @@ case 2:
+ break;
+
+ case 94:
+-#line 747 "perly.y"
++#line 753 "perly.y"
+ { (yyval.opval) = convert(IVAL((ps[(1) - (2)].val.i_tkval)), 0, (ps[(2) - (2)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 95:
+-#line 751 "perly.y"
++#line 757 "perly.y"
+ { (yyval.opval) = convert(IVAL((ps[(1) - (4)].val.i_tkval)), 0, (ps[(3) - (4)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (4)].val.i_tkval),(yyval.opval),'o');
+ TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'(');
+@@ -755,13 +761,13 @@ case 2:
+ break;
+
+ case 96:
+-#line 757 "perly.y"
++#line 763 "perly.y"
+ { SvREFCNT_inc_simple_void(PL_compcv);
+ (yyval.opval) = newANONATTRSUB((ps[(2) - (3)].val.ival), 0, (OP*)NULL, (ps[(3) - (3)].val.opval)); ;}
+ break;
+
+ case 97:
+-#line 760 "perly.y"
++#line 766 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST,
+ prepend_elem(OP_LIST, (ps[(4) - (5)].val.opval), (ps[(5) - (5)].val.opval)), (ps[(1) - (5)].val.opval)));
+@@ -769,7 +775,7 @@ case 2:
+ break;
+
+ case 100:
+-#line 775 "perly.y"
++#line 781 "perly.y"
+ { (yyval.opval) = newBINOP(OP_GELEM, 0, (ps[(1) - (5)].val.opval), scalar((ps[(3) - (5)].val.opval)));
+ PL_parser->expect = XOPERATOR;
+ TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),'{');
+@@ -779,7 +785,7 @@ case 2:
+ break;
+
+ case 101:
+-#line 782 "perly.y"
++#line 788 "perly.y"
+ { (yyval.opval) = newBINOP(OP_AELEM, 0, oopsAV((ps[(1) - (4)].val.opval)), scalar((ps[(3) - (4)].val.opval)));
+ TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'[');
+ TOKEN_GETMAD((ps[(4) - (4)].val.i_tkval),(yyval.opval),']');
+@@ -787,7 +793,7 @@ case 2:
+ break;
+
+ case 102:
+-#line 787 "perly.y"
++#line 793 "perly.y"
+ { (yyval.opval) = newBINOP(OP_AELEM, 0,
+ ref(newAVREF((ps[(1) - (5)].val.opval)),OP_RV2AV),
+ scalar((ps[(4) - (5)].val.opval)));
+@@ -798,7 +804,7 @@ case 2:
+ break;
+
+ case 103:
+-#line 795 "perly.y"
++#line 801 "perly.y"
+ { (yyval.opval) = newBINOP(OP_AELEM, 0,
+ ref(newAVREF((ps[(1) - (4)].val.opval)),OP_RV2AV),
+ scalar((ps[(3) - (4)].val.opval)));
+@@ -808,7 +814,7 @@ case 2:
+ break;
+
+ case 104:
+-#line 802 "perly.y"
++#line 808 "perly.y"
+ { (yyval.opval) = newBINOP(OP_HELEM, 0, oopsHV((ps[(1) - (5)].val.opval)), jmaybe((ps[(3) - (5)].val.opval)));
+ PL_parser->expect = XOPERATOR;
+ TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),'{');
+@@ -818,7 +824,7 @@ case 2:
+ break;
+
+ case 105:
+-#line 809 "perly.y"
++#line 815 "perly.y"
+ { (yyval.opval) = newBINOP(OP_HELEM, 0,
+ ref(newHVREF((ps[(1) - (6)].val.opval)),OP_RV2HV),
+ jmaybe((ps[(4) - (6)].val.opval)));
+@@ -831,7 +837,7 @@ case 2:
+ break;
+
+ case 106:
+-#line 819 "perly.y"
++#line 825 "perly.y"
+ { (yyval.opval) = newBINOP(OP_HELEM, 0,
+ ref(newHVREF((ps[(1) - (5)].val.opval)),OP_RV2HV),
+ jmaybe((ps[(3) - (5)].val.opval)));
+@@ -843,7 +849,7 @@ case 2:
+ break;
+
+ case 107:
+-#line 828 "perly.y"
++#line 834 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ newCVREF(0, scalar((ps[(1) - (4)].val.opval))));
+ TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'a');
+@@ -853,7 +859,7 @@ case 2:
+ break;
+
+ case 108:
+-#line 835 "perly.y"
++#line 841 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST, (ps[(4) - (5)].val.opval),
+ newCVREF(0, scalar((ps[(1) - (5)].val.opval)))));
+@@ -864,7 +870,7 @@ case 2:
+ break;
+
+ case 109:
+-#line 844 "perly.y"
++#line 850 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST, (ps[(3) - (4)].val.opval),
+ newCVREF(0, scalar((ps[(1) - (4)].val.opval)))));
+@@ -874,7 +880,7 @@ case 2:
+ break;
+
+ case 110:
+-#line 851 "perly.y"
++#line 857 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ newCVREF(0, scalar((ps[(1) - (3)].val.opval))));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'(');
+@@ -883,7 +889,7 @@ case 2:
+ break;
+
+ case 111:
+-#line 857 "perly.y"
++#line 863 "perly.y"
+ { (yyval.opval) = newSLICEOP(0, (ps[(5) - (6)].val.opval), (ps[(2) - (6)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (6)].val.i_tkval),(yyval.opval),'(');
+ TOKEN_GETMAD((ps[(3) - (6)].val.i_tkval),(yyval.opval),')');
+@@ -893,7 +899,7 @@ case 2:
+ break;
+
+ case 112:
+-#line 864 "perly.y"
++#line 870 "perly.y"
+ { (yyval.opval) = newSLICEOP(0, (ps[(4) - (5)].val.opval), (OP*)NULL);
+ TOKEN_GETMAD((ps[(1) - (5)].val.i_tkval),(yyval.opval),'(');
+ TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),')');
+@@ -903,21 +909,21 @@ case 2:
+ break;
+
+ case 113:
+-#line 874 "perly.y"
++#line 880 "perly.y"
+ { (yyval.opval) = newASSIGNOP(OPf_STACKED, (ps[(1) - (3)].val.opval), IVAL((ps[(2) - (3)].val.i_tkval)), (ps[(3) - (3)].val.opval));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 114:
+-#line 878 "perly.y"
++#line 884 "perly.y"
+ { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 115:
+-#line 882 "perly.y"
++#line 888 "perly.y"
+ { if (IVAL((ps[(2) - (3)].val.i_tkval)) != OP_REPEAT)
+ scalar((ps[(1) - (3)].val.opval));
+ (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, (ps[(1) - (3)].val.opval), scalar((ps[(3) - (3)].val.opval)));
+@@ -926,49 +932,49 @@ case 2:
+ break;
+
+ case 116:
+-#line 888 "perly.y"
++#line 894 "perly.y"
+ { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 117:
+-#line 892 "perly.y"
++#line 898 "perly.y"
+ { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 118:
+-#line 896 "perly.y"
++#line 902 "perly.y"
+ { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 119:
+-#line 900 "perly.y"
++#line 906 "perly.y"
+ { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 120:
+-#line 904 "perly.y"
++#line 910 "perly.y"
+ { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 121:
+-#line 908 "perly.y"
++#line 914 "perly.y"
+ { (yyval.opval) = newBINOP(IVAL((ps[(2) - (3)].val.i_tkval)), 0, scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 122:
+-#line 912 "perly.y"
++#line 918 "perly.y"
+ {
+ (yyval.opval) = newRANGE(IVAL((ps[(2) - (3)].val.i_tkval)), scalar((ps[(1) - (3)].val.opval)), scalar((ps[(3) - (3)].val.opval)));
+ DO_MAD({
+@@ -983,28 +989,28 @@ case 2:
+ break;
+
+ case 123:
+-#line 924 "perly.y"
++#line 930 "perly.y"
+ { (yyval.opval) = newLOGOP(OP_AND, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 124:
+-#line 928 "perly.y"
++#line 934 "perly.y"
+ { (yyval.opval) = newLOGOP(OP_OR, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 125:
+-#line 932 "perly.y"
++#line 938 "perly.y"
+ { (yyval.opval) = newLOGOP(OP_DOR, 0, (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 126:
+-#line 936 "perly.y"
++#line 942 "perly.y"
+ { (yyval.opval) = bind_match(IVAL((ps[(2) - (3)].val.i_tkval)), (ps[(1) - (3)].val.opval), (ps[(3) - (3)].val.opval));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),
+ ((yyval.opval)->op_type == OP_NOT
+@@ -1014,14 +1020,14 @@ case 2:
+ break;
+
+ case 127:
+-#line 946 "perly.y"
++#line 952 "perly.y"
+ { (yyval.opval) = newUNOP(OP_NEGATE, 0, scalar((ps[(2) - (2)].val.opval)));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 128:
+-#line 950 "perly.y"
++#line 956 "perly.y"
+ { (yyval.opval) = IF_MAD(
+ newUNOP(OP_NULL, 0, (ps[(2) - (2)].val.opval)),
+ (ps[(2) - (2)].val.opval)
+@@ -1031,21 +1037,21 @@ case 2:
+ break;
+
+ case 129:
+-#line 957 "perly.y"
++#line 963 "perly.y"
+ { (yyval.opval) = newUNOP(OP_NOT, 0, scalar((ps[(2) - (2)].val.opval)));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 130:
+-#line 961 "perly.y"
++#line 967 "perly.y"
+ { (yyval.opval) = newUNOP(OP_COMPLEMENT, 0, scalar((ps[(2) - (2)].val.opval)));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 131:
+-#line 965 "perly.y"
++#line 971 "perly.y"
+ { (yyval.opval) = newUNOP(OP_POSTINC, 0,
+ mod(scalar((ps[(1) - (2)].val.opval)), OP_POSTINC));
+ TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),'o');
+@@ -1053,7 +1059,7 @@ case 2:
+ break;
+
+ case 132:
+-#line 970 "perly.y"
++#line 976 "perly.y"
+ { (yyval.opval) = newUNOP(OP_POSTDEC, 0,
+ mod(scalar((ps[(1) - (2)].val.opval)), OP_POSTDEC));
+ TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),'o');
+@@ -1061,7 +1067,7 @@ case 2:
+ break;
+
+ case 133:
+-#line 975 "perly.y"
++#line 981 "perly.y"
+ { (yyval.opval) = newUNOP(OP_PREINC, 0,
+ mod(scalar((ps[(2) - (2)].val.opval)), OP_PREINC));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+@@ -1069,7 +1075,7 @@ case 2:
+ break;
+
+ case 134:
+-#line 980 "perly.y"
++#line 986 "perly.y"
+ { (yyval.opval) = newUNOP(OP_PREDEC, 0,
+ mod(scalar((ps[(2) - (2)].val.opval)), OP_PREDEC));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+@@ -1077,7 +1083,7 @@ case 2:
+ break;
+
+ case 135:
+-#line 989 "perly.y"
++#line 995 "perly.y"
+ { (yyval.opval) = newANONLIST((ps[(2) - (3)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'[');
+ TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),']');
+@@ -1085,7 +1091,7 @@ case 2:
+ break;
+
+ case 136:
+-#line 994 "perly.y"
++#line 1000 "perly.y"
+ { (yyval.opval) = newANONLIST((OP*)NULL);
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'[');
+ TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),']');
+@@ -1093,7 +1099,7 @@ case 2:
+ break;
+
+ case 137:
+-#line 999 "perly.y"
++#line 1005 "perly.y"
+ { (yyval.opval) = newANONHASH((ps[(2) - (4)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (4)].val.i_tkval),(yyval.opval),'{');
+ TOKEN_GETMAD((ps[(3) - (4)].val.i_tkval),(yyval.opval),';');
+@@ -1102,7 +1108,7 @@ case 2:
+ break;
+
+ case 138:
+-#line 1005 "perly.y"
++#line 1011 "perly.y"
+ { (yyval.opval) = newANONHASH((OP*)NULL);
+ TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'{');
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),';');
+@@ -1111,7 +1117,7 @@ case 2:
+ break;
+
+ case 139:
+-#line 1011 "perly.y"
++#line 1017 "perly.y"
+ { SvREFCNT_inc_simple_void(PL_compcv);
+ (yyval.opval) = newANONATTRSUB((ps[(2) - (5)].val.ival), (ps[(3) - (5)].val.opval), (ps[(4) - (5)].val.opval), (ps[(5) - (5)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (5)].val.i_tkval),(yyval.opval),'o');
+@@ -1121,21 +1127,21 @@ case 2:
+ break;
+
+ case 140:
+-#line 1022 "perly.y"
++#line 1028 "perly.y"
+ { (yyval.opval) = dofile((ps[(2) - (2)].val.opval), IVAL((ps[(1) - (2)].val.i_tkval)));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 141:
+-#line 1026 "perly.y"
++#line 1032 "perly.y"
+ { (yyval.opval) = newUNOP(OP_NULL, OPf_SPECIAL, scope((ps[(2) - (2)].val.opval)));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'D');
+ ;}
+ break;
+
+ case 142:
+-#line 1030 "perly.y"
++#line 1036 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB,
+ OPf_SPECIAL|OPf_STACKED,
+ prepend_elem(OP_LIST,
+@@ -1150,7 +1156,7 @@ case 2:
+ break;
+
+ case 143:
+-#line 1042 "perly.y"
++#line 1048 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB,
+ OPf_SPECIAL|OPf_STACKED,
+ append_elem(OP_LIST,
+@@ -1166,7 +1172,7 @@ case 2:
+ break;
+
+ case 144:
+-#line 1055 "perly.y"
++#line 1061 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
+ prepend_elem(OP_LIST,
+ scalar(newCVREF(0,scalar((ps[(2) - (4)].val.opval)))), (OP*)NULL)); dep();
+@@ -1177,7 +1183,7 @@ case 2:
+ break;
+
+ case 145:
+-#line 1063 "perly.y"
++#line 1069 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_SPECIAL|OPf_STACKED,
+ prepend_elem(OP_LIST,
+ (ps[(4) - (5)].val.opval),
+@@ -1189,7 +1195,7 @@ case 2:
+ break;
+
+ case 150:
+-#line 1079 "perly.y"
++#line 1085 "perly.y"
+ { (yyval.opval) = newCONDOP(0, (ps[(1) - (5)].val.opval), (ps[(3) - (5)].val.opval), (ps[(5) - (5)].val.opval));
+ TOKEN_GETMAD((ps[(2) - (5)].val.i_tkval),(yyval.opval),'?');
+ TOKEN_GETMAD((ps[(4) - (5)].val.i_tkval),(yyval.opval),':');
+@@ -1197,26 +1203,26 @@ case 2:
+ break;
+
+ case 151:
+-#line 1084 "perly.y"
++#line 1090 "perly.y"
+ { (yyval.opval) = newUNOP(OP_REFGEN, 0, mod((ps[(2) - (2)].val.opval),OP_REFGEN));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 152:
+-#line 1088 "perly.y"
++#line 1094 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 153:
+-#line 1090 "perly.y"
++#line 1096 "perly.y"
+ { (yyval.opval) = localize((ps[(2) - (2)].val.opval),IVAL((ps[(1) - (2)].val.i_tkval)));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'k');
+ ;}
+ break;
+
+ case 154:
+-#line 1094 "perly.y"
++#line 1100 "perly.y"
+ { (yyval.opval) = sawparens(IF_MAD(newUNOP(OP_NULL,0,(ps[(2) - (3)].val.opval)), (ps[(2) - (3)].val.opval)));
+ TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'(');
+ TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),')');
+@@ -1224,7 +1230,7 @@ case 2:
+ break;
+
+ case 155:
+-#line 1099 "perly.y"
++#line 1105 "perly.y"
+ { (yyval.opval) = sawparens(newNULLLIST());
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'(');
+ TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),')');
+@@ -1232,37 +1238,37 @@ case 2:
+ break;
+
+ case 156:
+-#line 1104 "perly.y"
++#line 1110 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 157:
+-#line 1106 "perly.y"
++#line 1112 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 158:
+-#line 1108 "perly.y"
++#line 1114 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 159:
+-#line 1110 "perly.y"
++#line 1116 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 160:
+-#line 1112 "perly.y"
++#line 1118 "perly.y"
+ { (yyval.opval) = newUNOP(OP_AV2ARYLEN, 0, ref((ps[(1) - (1)].val.opval), OP_AV2ARYLEN));;}
+ break;
+
+ case 161:
+-#line 1114 "perly.y"
++#line 1120 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 162:
+-#line 1116 "perly.y"
++#line 1122 "perly.y"
+ { (yyval.opval) = prepend_elem(OP_ASLICE,
+ newOP(OP_PUSHMARK, 0),
+ newLISTOP(OP_ASLICE, 0,
+@@ -1274,7 +1280,7 @@ case 2:
+ break;
+
+ case 163:
+-#line 1125 "perly.y"
++#line 1131 "perly.y"
+ { (yyval.opval) = prepend_elem(OP_HSLICE,
+ newOP(OP_PUSHMARK, 0),
+ newLISTOP(OP_HSLICE, 0,
+@@ -1288,17 +1294,17 @@ case 2:
+ break;
+
+ case 164:
+-#line 1136 "perly.y"
++#line 1142 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 165:
+-#line 1138 "perly.y"
++#line 1144 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, 0, scalar((ps[(1) - (1)].val.opval))); ;}
+ break;
+
+ case 166:
+-#line 1140 "perly.y"
++#line 1146 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((ps[(1) - (3)].val.opval)));
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'(');
+ TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),')');
+@@ -1306,7 +1312,7 @@ case 2:
+ break;
+
+ case 167:
+-#line 1145 "perly.y"
++#line 1151 "perly.y"
+ {
+ (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST, (ps[(3) - (4)].val.opval), scalar((ps[(1) - (4)].val.opval))));
+@@ -1322,7 +1328,7 @@ case 2:
+ break;
+
+ case 168:
+-#line 1158 "perly.y"
++#line 1164 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST, (ps[(3) - (3)].val.opval), scalar((ps[(2) - (3)].val.opval))));
+ TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'o');
+@@ -1330,7 +1336,7 @@ case 2:
+ break;
+
+ case 169:
+-#line 1163 "perly.y"
++#line 1169 "perly.y"
+ { (yyval.opval) = newOP(IVAL((ps[(1) - (1)].val.i_tkval)), OPf_SPECIAL);
+ PL_hints |= HINT_BLOCK_SCOPE;
+ TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o');
+@@ -1338,74 +1344,74 @@ case 2:
+ break;
+
+ case 170:
+-#line 1168 "perly.y"
++#line 1174 "perly.y"
+ { (yyval.opval) = newLOOPEX(IVAL((ps[(1) - (2)].val.i_tkval)),(ps[(2) - (2)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 171:
+-#line 1172 "perly.y"
++#line 1178 "perly.y"
+ { (yyval.opval) = newUNOP(OP_NOT, 0, scalar((ps[(2) - (2)].val.opval)));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 172:
+-#line 1176 "perly.y"
++#line 1182 "perly.y"
+ { (yyval.opval) = newOP(IVAL((ps[(1) - (1)].val.i_tkval)), 0);
+ TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 173:
+-#line 1180 "perly.y"
++#line 1186 "perly.y"
+ { (yyval.opval) = newUNOP(IVAL((ps[(1) - (2)].val.i_tkval)), 0, (ps[(2) - (2)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 174:
+-#line 1184 "perly.y"
++#line 1190 "perly.y"
+ { (yyval.opval) = newUNOP(IVAL((ps[(1) - (2)].val.i_tkval)), 0, (ps[(2) - (2)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 175:
+-#line 1188 "perly.y"
++#line 1194 "perly.y"
+ { (yyval.opval) = newOP(OP_REQUIRE, (ps[(1) - (1)].val.i_tkval) ? OPf_SPECIAL : 0);
+ TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 176:
+-#line 1192 "perly.y"
++#line 1198 "perly.y"
+ { (yyval.opval) = newUNOP(OP_REQUIRE, (ps[(1) - (2)].val.i_tkval) ? OPf_SPECIAL : 0, (ps[(2) - (2)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 177:
+-#line 1196 "perly.y"
++#line 1202 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED, scalar((ps[(1) - (1)].val.opval))); ;}
+ break;
+
+ case 178:
+-#line 1198 "perly.y"
++#line 1204 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ append_elem(OP_LIST, (ps[(2) - (2)].val.opval), scalar((ps[(1) - (2)].val.opval)))); ;}
+ break;
+
+ case 179:
+-#line 1201 "perly.y"
++#line 1207 "perly.y"
+ { (yyval.opval) = newOP(IVAL((ps[(1) - (1)].val.i_tkval)), 0);
+ TOKEN_GETMAD((ps[(1) - (1)].val.i_tkval),(yyval.opval),'o');
+ ;}
+ break;
+
+ case 180:
+-#line 1205 "perly.y"
++#line 1211 "perly.y"
+ { (yyval.opval) = newOP(IVAL((ps[(1) - (3)].val.i_tkval)), 0);
+ TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'o');
+ TOKEN_GETMAD((ps[(2) - (3)].val.i_tkval),(yyval.opval),'(');
+@@ -1414,13 +1420,13 @@ case 2:
+ break;
+
+ case 181:
+-#line 1211 "perly.y"
++#line 1217 "perly.y"
+ { (yyval.opval) = newUNOP(OP_ENTERSUB, OPf_STACKED,
+ scalar((ps[(1) - (1)].val.opval))); ;}
+ break;
+
+ case 182:
+-#line 1214 "perly.y"
++#line 1220 "perly.y"
+ { (yyval.opval) = (IVAL((ps[(1) - (3)].val.i_tkval)) == OP_NOT)
+ ? newUNOP(IVAL((ps[(1) - (3)].val.i_tkval)), 0, newSVOP(OP_CONST, 0, newSViv(0)))
+ : newOP(IVAL((ps[(1) - (3)].val.i_tkval)), OPf_SPECIAL);
+@@ -1432,7 +1438,7 @@ case 2:
+ break;
+
+ case 183:
+-#line 1223 "perly.y"
++#line 1229 "perly.y"
+ { (yyval.opval) = newUNOP(IVAL((ps[(1) - (4)].val.i_tkval)), 0, (ps[(3) - (4)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (4)].val.i_tkval),(yyval.opval),'o');
+ TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'(');
+@@ -1441,7 +1447,7 @@ case 2:
+ break;
+
+ case 184:
+-#line 1229 "perly.y"
++#line 1235 "perly.y"
+ { (yyval.opval) = pmruntime((ps[(1) - (4)].val.opval), (ps[(3) - (4)].val.opval), 1);
+ TOKEN_GETMAD((ps[(2) - (4)].val.i_tkval),(yyval.opval),'(');
+ TOKEN_GETMAD((ps[(4) - (4)].val.i_tkval),(yyval.opval),')');
+@@ -1449,7 +1455,7 @@ case 2:
+ break;
+
+ case 187:
+-#line 1239 "perly.y"
++#line 1245 "perly.y"
+ { (yyval.opval) = my_attrs((ps[(2) - (3)].val.opval),(ps[(3) - (3)].val.opval));
+ DO_MAD(
+ token_getmad((ps[(1) - (3)].val.i_tkval),(yyval.opval),'d');
+@@ -1460,14 +1466,14 @@ case 2:
+ break;
+
+ case 188:
+-#line 1247 "perly.y"
++#line 1253 "perly.y"
+ { (yyval.opval) = localize((ps[(2) - (2)].val.opval),IVAL((ps[(1) - (2)].val.i_tkval)));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'d');
+ ;}
+ break;
+
+ case 189:
+-#line 1254 "perly.y"
++#line 1260 "perly.y"
+ { (yyval.opval) = sawparens((ps[(2) - (3)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (3)].val.i_tkval),(yyval.opval),'(');
+ TOKEN_GETMAD((ps[(3) - (3)].val.i_tkval),(yyval.opval),')');
+@@ -1475,7 +1481,7 @@ case 2:
+ break;
+
+ case 190:
+-#line 1259 "perly.y"
++#line 1265 "perly.y"
+ { (yyval.opval) = sawparens(newNULLLIST());
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'(');
+ TOKEN_GETMAD((ps[(2) - (2)].val.i_tkval),(yyval.opval),')');
+@@ -1483,42 +1489,42 @@ case 2:
+ break;
+
+ case 191:
+-#line 1264 "perly.y"
++#line 1270 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 192:
+-#line 1266 "perly.y"
++#line 1272 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 193:
+-#line 1268 "perly.y"
++#line 1274 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 194:
+-#line 1273 "perly.y"
++#line 1279 "perly.y"
+ { (yyval.opval) = (OP*)NULL; ;}
+ break;
+
+ case 195:
+-#line 1275 "perly.y"
++#line 1281 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 196:
+-#line 1279 "perly.y"
++#line 1285 "perly.y"
+ { (yyval.opval) = (OP*)NULL; ;}
+ break;
+
+ case 197:
+-#line 1281 "perly.y"
++#line 1287 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+ case 198:
+-#line 1283 "perly.y"
++#line 1289 "perly.y"
+ {
+ #ifdef MAD
+ OP* op = newNULLLIST();
+@@ -1532,69 +1538,69 @@ case 2:
+ break;
+
+ case 199:
+-#line 1298 "perly.y"
++#line 1304 "perly.y"
+ { PL_parser->in_my = 0; (yyval.opval) = my((ps[(1) - (1)].val.opval)); ;}
+ break;
+
+ case 200:
+-#line 1302 "perly.y"
++#line 1308 "perly.y"
+ { (yyval.opval) = newCVREF(IVAL((ps[(1) - (2)].val.i_tkval)),(ps[(2) - (2)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'&');
+ ;}
+ break;
+
+ case 201:
+-#line 1308 "perly.y"
++#line 1314 "perly.y"
+ { (yyval.opval) = newSVREF((ps[(2) - (2)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'$');
+ ;}
+ break;
+
+ case 202:
+-#line 1314 "perly.y"
++#line 1320 "perly.y"
+ { (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'@');
+ ;}
+ break;
+
+ case 203:
+-#line 1320 "perly.y"
++#line 1326 "perly.y"
+ { (yyval.opval) = newHVREF((ps[(2) - (2)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'%');
+ ;}
+ break;
+
+ case 204:
+-#line 1326 "perly.y"
++#line 1332 "perly.y"
+ { (yyval.opval) = newAVREF((ps[(2) - (2)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'l');
+ ;}
+ break;
+
+ case 205:
+-#line 1332 "perly.y"
++#line 1338 "perly.y"
+ { (yyval.opval) = newGVREF(0,(ps[(2) - (2)].val.opval));
+ TOKEN_GETMAD((ps[(1) - (2)].val.i_tkval),(yyval.opval),'*');
+ ;}
+ break;
+
+ case 206:
+-#line 1339 "perly.y"
++#line 1345 "perly.y"
+ { (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;}
+ break;
+
+ case 207:
+-#line 1341 "perly.y"
++#line 1347 "perly.y"
+ { (yyval.opval) = scalar((ps[(1) - (1)].val.opval)); ;}
+ break;
+
+ case 208:
+-#line 1343 "perly.y"
++#line 1349 "perly.y"
+ { (yyval.opval) = scope((ps[(1) - (1)].val.opval)); ;}
+ break;
+
+ case 209:
+-#line 1346 "perly.y"
++#line 1352 "perly.y"
+ { (yyval.opval) = (ps[(1) - (1)].val.opval); ;}
+ break;
+
+diff --git a/perly.tab b/perly.tab
+index 8dd02ed..5980559 100644
+--- a/perly.tab
++++ b/perly.tab
+@@ -171,21 +171,21 @@ static const yytype_uint16 yyrline[] =
+ 311, 314, 320, 321, 328, 341, 353, 364, 374, 384,
+ 416, 424, 434, 440, 441, 446, 449, 453, 458, 462,
+ 466, 472, 481, 485, 487, 489, 491, 493, 498, 502,
+- 508, 522, 523, 527, 540, 563, 569, 574, 579, 589,
+- 590, 595, 596, 600, 610, 614, 624, 625, 634, 648,
+- 647, 666, 670, 674, 678, 682, 692, 701, 705, 710,
+- 717, 726, 732, 738, 746, 750, 757, 756, 767, 768,
+- 772, 781, 786, 794, 801, 808, 818, 827, 834, 843,
+- 850, 856, 863, 873, 877, 881, 887, 891, 895, 899,
+- 903, 907, 911, 923, 927, 931, 935, 945, 949, 956,
+- 960, 964, 969, 974, 979, 988, 993, 998, 1004, 1010,
+- 1021, 1025, 1029, 1041, 1054, 1062, 1074, 1075, 1076, 1077,
+- 1078, 1083, 1087, 1089, 1093, 1098, 1103, 1105, 1107, 1109,
+- 1111, 1113, 1115, 1124, 1135, 1137, 1139, 1144, 1157, 1162,
+- 1167, 1171, 1175, 1179, 1183, 1187, 1191, 1195, 1197, 1200,
+- 1204, 1210, 1213, 1222, 1228, 1233, 1234, 1238, 1246, 1253,
+- 1258, 1263, 1265, 1267, 1272, 1274, 1279, 1280, 1282, 1297,
+- 1301, 1307, 1313, 1319, 1325, 1331, 1338, 1340, 1342, 1345
++ 508, 528, 529, 533, 546, 569, 575, 580, 585, 595,
++ 596, 601, 602, 606, 616, 620, 630, 631, 640, 654,
++ 653, 672, 676, 680, 684, 688, 698, 707, 711, 716,
++ 723, 732, 738, 744, 752, 756, 763, 762, 773, 774,
++ 778, 787, 792, 800, 807, 814, 824, 833, 840, 849,
++ 856, 862, 869, 879, 883, 887, 893, 897, 901, 905,
++ 909, 913, 917, 929, 933, 937, 941, 951, 955, 962,
++ 966, 970, 975, 980, 985, 994, 999, 1004, 1010, 1016,
++ 1027, 1031, 1035, 1047, 1060, 1068, 1080, 1081, 1082, 1083,
++ 1084, 1089, 1093, 1095, 1099, 1104, 1109, 1111, 1113, 1115,
++ 1117, 1119, 1121, 1130, 1141, 1143, 1145, 1150, 1163, 1168,
++ 1173, 1177, 1181, 1185, 1189, 1193, 1197, 1201, 1203, 1206,
++ 1210, 1216, 1219, 1228, 1234, 1239, 1240, 1244, 1252, 1259,
++ 1264, 1269, 1271, 1273, 1278, 1280, 1285, 1286, 1288, 1303,
++ 1307, 1313, 1319, 1325, 1331, 1337, 1344, 1346, 1348, 1351
+ };
+ #endif
+
+diff --git a/perly.y b/perly.y
+index 6b8b4e3..9164cab 100644
+--- a/perly.y
++++ b/perly.y
+@@ -506,7 +506,9 @@ peg : PEG
+ ;
+
+ format : FORMAT startformsub formname block
+- { SvREFCNT_inc_simple_void(PL_compcv);
++ {
++ CV *fmtcv = PL_compcv;
++ SvREFCNT_inc_simple_void(PL_compcv);
+ #ifdef MAD
+ $$ = newFORM($2, $3, $4);
+ prepend_madprops($1->tk_mad, $$, 'F');
+@@ -516,6 +518,10 @@ format : FORMAT startformsub formname block
+ newFORM($2, $3, $4);
+ $$ = (OP*)NULL;
+ #endif
++ if (CvOUTSIDE(fmtcv) && !CvUNIQUE(CvOUTSIDE(fmtcv))) {
++ SvREFCNT_inc_simple_void(fmtcv);
++ pad_add_anon((SV*)fmtcv, OP_NULL);
++ }
+ }
+ ;
+
+diff --git a/t/comp/form_scope.t b/t/comp/form_scope.t
+new file mode 100644
+index 0000000..3ef891e
+--- /dev/null
++++ b/t/comp/form_scope.t
+@@ -0,0 +1,18 @@
++#!./perl
++#
++# Tests bug #22977. Test case from Dave Mitchell.
++
++print "1..2\n";
++
++sub f ($);
++sub f ($) {
++my $test = $_[0];
++write;
++format STDOUT =
++ok @<<<<<<<
++$test
++.
++}
++
++f(1);
++f(2);
+--
+tg: (daf8b46..) fixes/format-write-crash (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/hppa-thread-eagain.diff b/recipes/perl/perl-5.10.1/hppa-thread-eagain.diff
new file mode 100644
index 0000000000..b967752629
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/hppa-thread-eagain.diff
@@ -0,0 +1,72 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: make the threads-shared test suite more robust, fixing failures on hppa
+Closes: 554218
+
+Fix from threads-shared-1.31:
+ Handle thread creation failures in tests due to lack of memory, etc.
+
+
+---
+ ext/threads-shared/t/stress.t | 28 ++++++++++++++++++++++++----
+ 1 files changed, 24 insertions(+), 4 deletions(-)
+
+diff --git a/ext/threads-shared/t/stress.t b/ext/threads-shared/t/stress.t
+index e36ab0a..adfd1ed 100755
+--- a/ext/threads-shared/t/stress.t
++++ b/ext/threads-shared/t/stress.t
+@@ -39,7 +39,11 @@ use threads::shared;
+ my $mutex = 1;
+ share($mutex);
+
++ my $warning;
++ $SIG{__WARN__} = sub { $warning = shift; };
++
+ my @threads;
++
+ for (reverse(1..$cnt)) {
+ $threads[$_] = threads->create(sub {
+ my $tnum = shift;
+@@ -71,10 +75,26 @@ use threads::shared;
+ cond_broadcast($mutex);
+ return ('okay');
+ }, $_);
++
++ # Handle thread creation failures
++ if ($warning) {
++ my $printit = 1;
++ if ($warning =~ /returned 11/) {
++ $warning = "Thread creation failed due to 'No more processes'\n";
++ $printit = (! $ENV{'PERL_CORE'});
++ } elsif ($warning =~ /returned 12/) {
++ $warning = "Thread creation failed due to 'No more memory'\n";
++ $printit = (! $ENV{'PERL_CORE'});
++ }
++ print(STDERR "# Warning: $warning") if ($printit);
++ lock($mutex);
++ $mutex = $_ + 1;
++ last;
++ }
+ }
+
+ # Gather thread results
+- my ($okay, $failures, $timeouts, $unknown) = (0, 0, 0, 0);
++ my ($okay, $failures, $timeouts, $unknown) = (0, 0, 0, 0, 0);
+ for (1..$cnt) {
+ if (! $threads[$_]) {
+ $failures++;
+@@ -92,10 +112,10 @@ use threads::shared;
+ }
+ }
+ }
++
+ if ($failures) {
+- # Most likely due to running out of memory
+- print(STDERR "# Warning: $failures threads failed\n");
+- print(STDERR "# Note: errno 12 = ENOMEM\n");
++ my $only = $cnt - $failures;
++ print(STDERR "# Warning: Intended to use $cnt threads, but could only muster $only\n");
+ $cnt -= $failures;
+ }
+
+--
+tg: (daf8b46..) fixes/hppa-thread-eagain (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/hurd-ccflags.diff b/recipes/perl/perl-5.10.1/hurd-ccflags.diff
new file mode 100644
index 0000000000..b103154aa3
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/hurd-ccflags.diff
@@ -0,0 +1,26 @@
+Author: Samuel Thibault <sthibault@debian.org>
+Subject: Make hints/gnu.sh append to $ccflags rather than overriding them
+Bug-Debian: http://bugs.debian.org/587901
+
+Don't override possible extra $ccflags values given to Configure
+on GNU/Hurd.
+
+---
+ hints/gnu.sh | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/hints/gnu.sh b/hints/gnu.sh
+index 2cfce54..c1ba2db 100644
+--- a/hints/gnu.sh
++++ b/hints/gnu.sh
+@@ -19,7 +19,7 @@ lddlflags='-shared'
+ ccdlflags='-Wl,-E'
+
+ # Debian bug #258618
+-ccflags='-D_GNU_SOURCE'
++ccflags="-D_GNU_SOURCE $ccflags"
+
+ # The following routines are only available as stubs in GNU libc.
+ # XXX remove this once metaconf detects the GNU libc stubs.
+--
+tg: (daf8b46..) fixes/hurd-ccflags (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/hurd_cppsymbols.diff b/recipes/perl/perl-5.10.1/hurd_cppsymbols.diff
new file mode 100644
index 0000000000..d4802319c9
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/hurd_cppsymbols.diff
@@ -0,0 +1,25 @@
+From: Samuel Thibault <sthibault@debian.org>
+Subject: Add gcc predefined macros to $Config{cppsymbols} on GNU/Hurd.
+Bug-Debian: http://bugs.debian.org/544307
+Origin: http://perl5.git.perl.org/perl.git/commit/eeb92b76fda504cc34bcd98ba2dbc73d933c0208
+
+
+---
+ Configure | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/Configure b/Configure
+index 5e863b3..eed6f9b 100755
+--- a/Configure
++++ b/Configure
+@@ -21375,7 +21375,7 @@ $eunicefix Cppsym.try
+ ./Cppsym < Cppsym.know > Cppsym.true
+ : Add in any linux cpp "predefined macros":
+ case "$osname::$gccversion" in
+- *linux*::*.*|*gnukfreebsd*::*.*)
++ *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
+ tHdrH=_tmpHdr
+ rm -f $tHdrH'.h' $tHdrH
+ touch $tHdrH'.h'
+--
+tg: (89dcf0f..) fixes/hurd_cppsymbols (depends on: fixes/kfreebsd_cppsymbols)
diff --git a/recipes/perl/perl-5.10.1/instmodsh_doc.diff b/recipes/perl/perl-5.10.1/instmodsh_doc.diff
new file mode 100644
index 0000000000..10b743d32c
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/instmodsh_doc.diff
@@ -0,0 +1,26 @@
+Subject: Debian policy doesn't install .packlist files for core or vendor.
+
+
+---
+ lib/ExtUtils/instmodsh | 4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/lib/ExtUtils/instmodsh b/lib/ExtUtils/instmodsh
+index 5874aa6..6a2f03e 100644
+--- a/lib/ExtUtils/instmodsh
++++ b/lib/ExtUtils/instmodsh
+@@ -18,9 +18,11 @@ instmodsh - A shell to examine installed modules
+
+ =head1 DESCRIPTION
+
+-A little interface to ExtUtils::Installed to examine installed modules,
++A little interface to ExtUtils::Installed to examine locally* installed modules,
+ validate your packlists and even create a tarball from an installed module.
+
++*On Debian system, B<core> and B<vendor> modules are managed by C<dpkg>.
++
+ =head1 SEE ALSO
+
+ ExtUtils::Installed
+--
+tg: (daf8b46..) debian/instmodsh_doc (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/kfreebsd-filecopy-pipes.diff b/recipes/perl/perl-5.10.1/kfreebsd-filecopy-pipes.diff
new file mode 100644
index 0000000000..839d06465e
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/kfreebsd-filecopy-pipes.diff
@@ -0,0 +1,68 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Fix File::Copy::copy with pipes on GNU/kFreeBSD
+Bug-Debian: http://bugs.debian.org/537555
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/16f708c9bc0dc48713b200031295a40bed83bbfc
+
+Quoting Petr Salinger:
+The Copy tries to detect whether source and dest are the same files.
+Unfortunately, on the GNU/kFreeBSD the kernel returns for all pipes
+as device and inode numbers just zero. See pipe_stat() in
+http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/sys_pipe.c
+
+Patch by Petr Salinger, tests by Niko Tyni.
+
+Backported from blead change 16f708c9bc0dc48713b200031295a40bed83bbfc
+
+---
+ lib/File/Copy.pm | 2 +-
+ lib/File/Copy.t | 15 ++++++++++++++-
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/lib/File/Copy.pm b/lib/File/Copy.pm
+index e1d7724..1da5437 100644
+--- a/lib/File/Copy.pm
++++ b/lib/File/Copy.pm
+@@ -115,7 +115,7 @@ sub copy {
+ my @fs = stat($from);
+ if (@fs) {
+ my @ts = stat($to);
+- if (@ts && $fs[0] == $ts[0] && $fs[1] == $ts[1]) {
++ if (@ts && $fs[0] == $ts[0] && $fs[1] == $ts[1] && !-p $from) {
+ carp("'$from' and '$to' are identical (not copied)");
+ return 0;
+ }
+diff --git a/lib/File/Copy.t b/lib/File/Copy.t
+index bcfa207..2e5ce9c 100755
+--- a/lib/File/Copy.t
++++ b/lib/File/Copy.t
+@@ -14,7 +14,7 @@ use Test::More;
+
+ my $TB = Test::More->builder;
+
+-plan tests => 115;
++plan tests => 117;
+
+ # We're going to override rename() later on but Perl has to see an override
+ # at compile time to honor it.
+@@ -272,6 +272,19 @@ for my $cross_partition_test (0..1) {
+ }
+ }
+
++SKIP: {
++ skip("fork required to test pipe copying", 2)
++ if (!$Config{'d_fork'});
++
++ open(my $IN, "-|") || exec $^X, '-e', 'print "Hello, world!\n"';
++ open(my $OUT, "|-") || exec $^X, '-ne', 'exit(/Hello/ ? 55 : 0)';
++
++ ok(copy($IN, $OUT), "copy pipe to another");
++ close($OUT);
++ is($? >> 8, 55, "content copied through the pipes");
++ close($IN);
++}
++
+ END {
+ 1 while unlink "file-$$";
+ 1 while unlink "lib/file-$$";
+--
+tg: (daf8b46..) fixes/kfreebsd-filecopy-pipes (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/kfreebsd_cppsymbols.diff b/recipes/perl/perl-5.10.1/kfreebsd_cppsymbols.diff
new file mode 100644
index 0000000000..41c43b12dc
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/kfreebsd_cppsymbols.diff
@@ -0,0 +1,28 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Add gcc predefined macros to $Config{cppsymbols} on GNU/kFreeBSD.
+Bug-Debian: http://bugs.debian.org/533098
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/3b910a06633f63976a6da223b122193040fbe96d
+
+This is needed at least by h2ph, otherwise the generated .ph files
+choke on missing __LONG_MAX__ and similar definitions.
+
+
+---
+ Configure | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/Configure b/Configure
+index 01fa3c0..5e863b3 100755
+--- a/Configure
++++ b/Configure
+@@ -21375,7 +21375,7 @@ $eunicefix Cppsym.try
+ ./Cppsym < Cppsym.know > Cppsym.true
+ : Add in any linux cpp "predefined macros":
+ case "$osname::$gccversion" in
+- *linux*::*.*)
++ *linux*::*.*|*gnukfreebsd*::*.*)
+ tHdrH=_tmpHdr
+ rm -f $tHdrH'.h' $tHdrH
+ touch $tHdrH'.h'
+--
+tg: (daf8b46..) fixes/kfreebsd_cppsymbols (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/ld_run_path.diff b/recipes/perl/perl-5.10.1/ld_run_path.diff
new file mode 100644
index 0000000000..8ab25c9481
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/ld_run_path.diff
@@ -0,0 +1,23 @@
+Subject: Remove standard libs from LD_RUN_PATH as per Debian policy.
+
+
+---
+ lib/ExtUtils/Liblist/Kid.pm | 3 +++
+ 1 files changed, 3 insertions(+), 0 deletions(-)
+
+diff --git a/lib/ExtUtils/Liblist/Kid.pm b/lib/ExtUtils/Liblist/Kid.pm
+index 380d4f8..6e6ed5a 100644
+--- a/lib/ExtUtils/Liblist/Kid.pm
++++ b/lib/ExtUtils/Liblist/Kid.pm
+@@ -53,6 +53,9 @@ sub _unix_os2_ext {
+ my($pwd) = cwd(); # from Cwd.pm
+ my($found) = 0;
+
++ # Debian-specific: don't use LD_RUN_PATH for standard dirs
++ $ld_run_path_seen{$_}++ for qw(/lib /usr/lib /usr/X11R6/lib);
++
+ foreach my $thislib (split ' ', $potential_libs) {
+
+ # Handle possible linker path arguments.
+--
+tg: (daf8b46..) debian/ld_run_path (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/libnet_config_path.diff b/recipes/perl/perl-5.10.1/libnet_config_path.diff
new file mode 100644
index 0000000000..da7a4c1c30
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/libnet_config_path.diff
@@ -0,0 +1,35 @@
+Subject: Set location of libnet.cfg to /etc/perl/Net as /usr may not be writable.
+
+
+---
+ lib/Net/Config.pm | 7 +++----
+ 1 files changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/lib/Net/Config.pm b/lib/Net/Config.pm
+index db51c1f..8404593 100644
+--- a/lib/Net/Config.pm
++++ b/lib/Net/Config.pm
+@@ -57,9 +57,8 @@ my %nc = (
+ }
+ TRY_INTERNET_CONFIG
+
+-my $file = __FILE__;
++my $file = '/etc/perl/Net/libnet.cfg';
+ my $ref;
+-$file =~ s/Config.pm/libnet.cfg/;
+ if (-f $file) {
+ $ref = eval { local $SIG{__DIE__}; do $file };
+ if (ref($ref) eq 'HASH') {
+@@ -132,8 +131,8 @@ Net::Config - Local configuration data for libnet
+ C<Net::Config> holds configuration data for the modules in the libnet
+ distribution. During installation you will be asked for these values.
+
+-The configuration data is held globally in a file in the perl installation
+-tree, but a user may override any of these values by providing their own. This
++The configuration data is held globally in C</etc/perl/Net/libnet.cfg>,
++but a user may override any of these values by providing their own. This
+ can be done by having a C<.libnetrc> file in their home directory. This file
+ should return a reference to a HASH containing the keys described below.
+ For example
+--
+tg: (daf8b46..) debian/libnet_config_path (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/m68k_thread_stress.diff b/recipes/perl/perl-5.10.1/m68k_thread_stress.diff
new file mode 100644
index 0000000000..f45fa36c50
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/m68k_thread_stress.diff
@@ -0,0 +1,43 @@
+Subject: Disable some threads tests on m68k for now due to missing TLS.
+Closes: #495826, #517938
+
+
+---
+ ext/threads-shared/t/stress.t | 4 ++++
+ ext/threads-shared/t/waithires.t | 6 ++++++
+ 2 files changed, 10 insertions(+), 0 deletions(-)
+
+diff --git a/ext/threads-shared/t/stress.t b/ext/threads-shared/t/stress.t
+index e36ab0a..eb591ff 100755
+--- a/ext/threads-shared/t/stress.t
++++ b/ext/threads-shared/t/stress.t
+@@ -11,6 +11,10 @@ BEGIN {
+ print("1..0 # SKIP Broken under HP-UX 10.20\n");
+ exit(0);
+ }
++ if ($^O eq 'linux' && $Config{archname} =~ /^m68k/) {
++ print("1..0 # Skip: no TLS on m68k yet <http://bugs.debian.org/495826>\n");
++ exit(0);
++ }
+ }
+
+ use ExtUtils::testlib;
+diff --git a/ext/threads-shared/t/waithires.t b/ext/threads-shared/t/waithires.t
+index ae82448..e17c471 100755
+--- a/ext/threads-shared/t/waithires.t
++++ b/ext/threads-shared/t/waithires.t
+@@ -16,6 +16,12 @@ BEGIN {
+ if (! eval 'use Time::HiRes "time"; 1') {
+ Test::skip_all('Time::HiRes not available');
+ }
++
++ if ($^O eq 'linux' && $Config{archname} =~ /^m68k/) {
++ print("1..0 # Skip: no TLS on m68k yet <http://bugs.debian.org/495826>\n");
++ exit(0);
++ }
++
+ }
+
+ use ExtUtils::testlib;
+--
+tg: (daf8b46..) debian/m68k_thread_stress (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/mod_paths.diff b/recipes/perl/perl-5.10.1/mod_paths.diff
new file mode 100644
index 0000000000..c32f3dea14
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/mod_paths.diff
@@ -0,0 +1,117 @@
+Subject: Tweak @INC ordering for Debian
+
+Our order is:
+
+ etc (for config files)
+ site (5.8.1)
+ vendor (all)
+ core (5.8.1)
+ site (version-indep)
+ site (pre-5.8.1)
+
+The rationale being that an admin (via site), or module packager
+(vendor) can chose to shadow core modules when there is a newer
+version than is included in core.
+
+
+---
+ perl.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 62 insertions(+), 0 deletions(-)
+
+diff --git a/perl.c b/perl.c
+index 94f2b13..5a6744a 100644
+--- a/perl.c
++++ b/perl.c
+@@ -4879,9 +4879,14 @@ S_init_perllib(pTHX)
+ incpush(APPLLIB_EXP, TRUE, TRUE, TRUE, TRUE);
+ #endif
+
++#ifdef DEBIAN
++ /* for configuration where /usr is mounted ro (CPAN::Config, Net::Config) */
++ incpush("/etc/perl", FALSE, FALSE, FALSE, FALSE);
++#else
+ #ifdef ARCHLIB_EXP
+ incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE, TRUE);
+ #endif
++#endif
+ #ifdef MACOS_TRADITIONAL
+ {
+ Stat_t tmpstatbuf;
+@@ -4906,11 +4911,13 @@ S_init_perllib(pTHX)
+ #ifndef PRIVLIB_EXP
+ # define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
+ #endif
++#ifndef DEBIAN
+ #if defined(WIN32)
+ incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE, TRUE);
+ #else
+ incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE, TRUE);
+ #endif
++#endif
+
+ #ifdef SITEARCH_EXP
+ /* sitearch is always relative to sitelib on Windows for
+@@ -4954,6 +4961,61 @@ S_init_perllib(pTHX)
+ incpush(PERL_VENDORLIB_STEM, FALSE, TRUE, TRUE, TRUE);
+ #endif
+
++#ifdef DEBIAN
++ incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE, FALSE);
++ incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE, FALSE);
++
++ /* Non-versioned site directory for local modules and for
++ compatability with the previous packages' site dirs */
++ incpush("/usr/local/lib/site_perl", TRUE, FALSE, FALSE, FALSE);
++
++#ifdef PERL_INC_VERSION_LIST
++ {
++ struct stat s;
++
++ /* add small buffer in case old versions are longer than the
++ current version */
++ char sitearch[sizeof(SITEARCH_EXP)+16] = SITEARCH_EXP;
++ char sitelib[sizeof(SITELIB_EXP)+16] = SITELIB_EXP;
++ char const *vers[] = { PERL_INC_VERSION_LIST };
++ char const **p;
++
++ char *arch_vers = strrchr(sitearch, '/');
++ char *lib_vers = strrchr(sitelib, '/');
++
++ if (arch_vers && isdigit(*++arch_vers))
++ *arch_vers = 0;
++ else
++ arch_vers = 0;
++
++ if (lib_vers && isdigit(*++lib_vers))
++ *lib_vers = 0;
++ else
++ lib_vers = 0;
++
++ /* there is some duplication here as incpush does something
++ similar internally, but required as sitearch is not a
++ subdirectory of sitelib */
++ for (p = vers; *p; p++)
++ {
++ if (arch_vers)
++ {
++ strcpy(arch_vers, *p);
++ if (PerlLIO_stat(sitearch, &s) >= 0 && S_ISDIR(s.st_mode))
++ incpush(sitearch, FALSE, FALSE, FALSE, FALSE);
++ }
++
++ if (lib_vers)
++ {
++ strcpy(lib_vers, *p);
++ if (PerlLIO_stat(sitelib, &s) >= 0 && S_ISDIR(s.st_mode))
++ incpush(sitelib, FALSE, FALSE, FALSE, FALSE);
++ }
++ }
++ }
++#endif
++#endif
++
+ #ifdef PERL_OTHERLIBDIRS
+ incpush(PERL_OTHERLIBDIRS, TRUE, TRUE, TRUE, TRUE);
+ #endif
+--
+tg: (daf8b46..) debian/mod_paths (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/module_build_man_extensions.diff b/recipes/perl/perl-5.10.1/module_build_man_extensions.diff
new file mode 100644
index 0000000000..bbe53a618d
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/module_build_man_extensions.diff
@@ -0,0 +1,31 @@
+Subject: Adjust Module::Build manual page extensions for the Debian Perl policy
+Bug-Debian: http://bugs.debian.org/479460
+
+---
+ lib/Module/Build/Base.pm | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/Module/Build/Base.pm b/lib/Module/Build/Base.pm
+index ade64c8..b580423 100644
+--- a/lib/Module/Build/Base.pm
++++ b/lib/Module/Build/Base.pm
+@@ -2732,7 +2732,7 @@ sub manify_bin_pods {
+ foreach my $file (keys %$files) {
+ # Pod::Simple based parsers only support one document per instance.
+ # This is expected to change in a future version (Pod::Simple > 3.03).
+- my $parser = Pod::Man->new( section => 1 ); # binaries go in section 1
++ my $parser = Pod::Man->new( section => '1p' ); # binaries go in section 1p
+ my $manpage = $self->man1page_name( $file ) . '.' .
+ $self->config( 'man1ext' );
+ my $outfile = File::Spec->catfile($mandir, $manpage);
+@@ -2756,7 +2756,7 @@ sub manify_lib_pods {
+ while (my ($file, $relfile) = each %$files) {
+ # Pod::Simple based parsers only support one document per instance.
+ # This is expected to change in a future version (Pod::Simple > 3.03).
+- my $parser = Pod::Man->new( section => 3 ); # libraries go in section 3
++ my $parser = Pod::Man->new( section => '3pm' ); # libraries go in section 3pm
+ my $manpage = $self->man3page_name( $relfile ) . '.' .
+ $self->config( 'man3ext' );
+ my $outfile = File::Spec->catfile( $mandir, $manpage);
+--
+tg: (daf8b46..) debian/module_build_man_extensions (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/net_smtp_docs.diff b/recipes/perl/perl-5.10.1/net_smtp_docs.diff
new file mode 100644
index 0000000000..520172f831
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/net_smtp_docs.diff
@@ -0,0 +1,23 @@
+Subject: Document the Net::SMTP 'Port' option
+Bug-Debian: http://bugs.debian.org/100195
+Bug: http://rt.cpan.org/Public/Bug/Display.html?id=36038
+
+
+---
+ lib/Net/SMTP.pm | 1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/lib/Net/SMTP.pm b/lib/Net/SMTP.pm
+index a28496d..07b2498 100644
+--- a/lib/Net/SMTP.pm
++++ b/lib/Net/SMTP.pm
+@@ -625,6 +625,7 @@ Net::SMTP will attempt to extract the address from the value passed.
+
+ B<Debug> - Enable debugging information
+
++B<Port> - Select a port on the remote host to connect to (default is 25)
+
+ Example:
+
+--
+tg: (daf8b46..) fixes/net_smtp_docs (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/perl_5.10.1-8.diff.gz b/recipes/perl/perl-5.10.1/perl_5.10.1-8.diff.gz
deleted file mode 100644
index 011fd5f296..0000000000
--- a/recipes/perl/perl-5.10.1/perl_5.10.1-8.diff.gz
+++ /dev/null
Binary files differ
diff --git a/recipes/perl/perl-5.10.1/perl_synopsis.diff b/recipes/perl/perl-5.10.1/perl_synopsis.diff
new file mode 100644
index 0000000000..584a065ba2
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/perl_synopsis.diff
@@ -0,0 +1,96 @@
+Subject: Rearrange perl.pod
+Bug-Debian: http://bugs.debian.org/278323
+
+The TOC in perl.pod should probably not be in the synopsis.
+
+Note the debian/ prefix rather than fixes/ since upstream doesn't agree.
+
+
+---
+ pod/perl.pod | 64 +++++++++++++++++++++++++++++-----------------------------
+ 1 files changed, 32 insertions(+), 32 deletions(-)
+
+diff --git a/pod/perl.pod b/pod/perl.pod
+index 939c683..9bc461d 100644
+--- a/pod/perl.pod
++++ b/pod/perl.pod
+@@ -16,6 +16,38 @@ B<perl> S<[ B<-sTtuUWX> ]>
+ S<[ B<-i>[I<extension>] ]>
+ S<[ [B<-e>|B<-E>] I<'command'> ] [ B<--> ] [ I<programfile> ] [ I<argument> ]...>
+
++=head1 DESCRIPTION
++
++Perl is a language optimized for scanning arbitrary
++text files, extracting information from those text files, and printing
++reports based on that information. It's also a good language for many
++system management tasks. The language is intended to be practical
++(easy to use, efficient, complete) rather than beautiful (tiny,
++elegant, minimal).
++
++Perl combines (in the author's opinion, anyway) some of the best
++features of C, B<sed>, B<awk>, and B<sh>, so people familiar with
++those languages should have little difficulty with it. (Language
++historians will also note some vestiges of B<csh>, Pascal, and even
++BASIC-PLUS.) Expression syntax corresponds closely to C
++expression syntax. Unlike most Unix utilities, Perl does not
++arbitrarily limit the size of your data--if you've got the memory,
++Perl can slurp in your whole file as a single string. Recursion is of
++unlimited depth. And the tables used by hashes (sometimes called
++"associative arrays") grow as necessary to prevent degraded
++performance. Perl can use sophisticated pattern matching techniques to
++scan large amounts of data quickly. Although optimized for
++scanning text, Perl can also deal with binary data, and can make dbm
++files look like hashes. Setuid Perl scripts are safer than C programs
++through a dataflow tracing mechanism that prevents many stupid
++security holes.
++
++If you have a problem that would ordinarily use B<sed> or B<awk> or
++B<sh>, but it exceeds their capabilities or must run a little faster,
++and you don't want to write the silly thing in C, then Perl may be for
++you. There are also translators to turn your B<sed> and B<awk>
++scripts into Perl scripts.
++
+ If you're new to Perl, you should start with L<perlintro>, which is a
+ general intro for beginners and provides some background to help you
+ navigate the rest of Perl's extensive documentation.
+@@ -258,38 +290,6 @@ If something strange has gone wrong with your program and you're not
+ sure where you should look for help, try the B<-w> switch first. It
+ will often point out exactly where the trouble is.
+
+-=head1 DESCRIPTION
+-
+-Perl is a language optimized for scanning arbitrary
+-text files, extracting information from those text files, and printing
+-reports based on that information. It's also a good language for many
+-system management tasks. The language is intended to be practical
+-(easy to use, efficient, complete) rather than beautiful (tiny,
+-elegant, minimal).
+-
+-Perl combines (in the author's opinion, anyway) some of the best
+-features of C, B<sed>, B<awk>, and B<sh>, so people familiar with
+-those languages should have little difficulty with it. (Language
+-historians will also note some vestiges of B<csh>, Pascal, and even
+-BASIC-PLUS.) Expression syntax corresponds closely to C
+-expression syntax. Unlike most Unix utilities, Perl does not
+-arbitrarily limit the size of your data--if you've got the memory,
+-Perl can slurp in your whole file as a single string. Recursion is of
+-unlimited depth. And the tables used by hashes (sometimes called
+-"associative arrays") grow as necessary to prevent degraded
+-performance. Perl can use sophisticated pattern matching techniques to
+-scan large amounts of data quickly. Although optimized for
+-scanning text, Perl can also deal with binary data, and can make dbm
+-files look like hashes. Setuid Perl scripts are safer than C programs
+-through a dataflow tracing mechanism that prevents many stupid
+-security holes.
+-
+-If you have a problem that would ordinarily use B<sed> or B<awk> or
+-B<sh>, but it exceeds their capabilities or must run a little faster,
+-and you don't want to write the silly thing in C, then Perl may be for
+-you. There are also translators to turn your B<sed> and B<awk>
+-scripts into Perl scripts.
+-
+ But wait, there's more...
+
+ Begun in 1993 (see L<perlhist>), Perl version 5 is nearly a complete
+--
+tg: (daf8b46..) debian/perl_synopsis (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/perlivp.diff b/recipes/perl/perl-5.10.1/perlivp.diff
new file mode 100644
index 0000000000..bf5c728a5d
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/perlivp.diff
@@ -0,0 +1,38 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Make perlivp skip include directories in /usr/local
+Closes: 510895
+
+On Sat, Jan 10, 2009 at 12:37:18AM +1100, Brendan O'Dea wrote:
+> On Wed, Jan 7, 2009 at 12:21 AM, Niko Tyni <ntyni@debian.org> wrote:
+
+> > We could create the directories in a postinst script, but I'm not sure
+> > I see the point. They will be created automatically when installing
+> > CPAN modules.
+>
+> The directories are intentionally not created, as this way they are
+> excluded from the search path at start-up, saving a bunch of wasted
+> stats at use/require time in the common case that the user has not
+> installed any local packages. As Niko points out, they will be
+> created as required.
+
+
+Signed-off-by: Niko Tyni <ntyni@debian.org>
+
+---
+ utils/perlivp.PL | 1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/utils/perlivp.PL b/utils/perlivp.PL
+index 762b4b3..20f6579 100644
+--- a/utils/perlivp.PL
++++ b/utils/perlivp.PL
+@@ -142,6 +142,7 @@ my $INC_total = 0;
+ my $INC_there = 0;
+ foreach (@INC) {
+ next if $_ eq '.'; # skip -d test here
++ next if m|/usr/local|; # not shipped on Debian
+ if ($^O eq 'MacOS') {
+ next if $_ eq ':'; # skip -d test here
+ next if $_ eq 'Dev:Pseudo:'; # why is this in @INC?
+--
+tg: (daf8b46..) debian/perlivp (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/pod2man-index-backslash.diff b/recipes/perl/perl-5.10.1/pod2man-index-backslash.diff
new file mode 100644
index 0000000000..30708e9edb
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/pod2man-index-backslash.diff
@@ -0,0 +1,54 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Escape backslashes in .IX entries
+Bug-Debian: http://bugs.debian.org/521256
+Origin: upstream, http://git.eyrie.org/?p=perl/podlators.git;a=commit;h=8de2177170c79800d81d480227643c1c2ce84a0a
+
+Applicable parts of podlators upstream git commit
+release/2.2.2-6-g8de2177
+
+
+---
+ lib/Pod/Man.pm | 1 +
+ lib/Pod/t/man.t | 11 ++++++++++-
+ 2 files changed, 11 insertions(+), 1 deletions(-)
+
+diff --git a/lib/Pod/Man.pm b/lib/Pod/Man.pm
+index 71a4d7a..7662935 100644
+--- a/lib/Pod/Man.pm
++++ b/lib/Pod/Man.pm
+@@ -712,6 +712,7 @@ sub outindex {
+ for (@output) {
+ my ($type, $entry) = @$_;
+ $entry =~ s/\"/\"\"/g;
++ $entry =~ s/\\/\\\\/g;
+ $self->output (".IX $type " . '"' . $entry . '"' . "\n");
+ }
+ }
+diff --git a/lib/Pod/t/man.t b/lib/Pod/t/man.t
+index 419cce3..c4588bc 100755
+--- a/lib/Pod/t/man.t
++++ b/lib/Pod/t/man.t
+@@ -17,7 +17,7 @@ BEGIN {
+ }
+ unshift (@INC, '../blib/lib');
+ $| = 1;
+- print "1..25\n";
++ print "1..26\n";
+ }
+
+ END {
+@@ -482,3 +482,12 @@ Some raw nroff.
+ .PP
+ More text.
+ ###
++=head1 INDEX
++
++Index entry matching a whitespace escape.X<\n>
++###
++.SH "INDEX"
++.IX Header "INDEX"
++Index entry matching a whitespace escape.
++.IX Xref "\\n"
++###
+--
+tg: (daf8b46..) fixes/pod2man-index-backslash (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/positive-gpos.diff b/recipes/perl/perl-5.10.1/positive-gpos.diff
new file mode 100644
index 0000000000..f9e355e9ef
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/positive-gpos.diff
@@ -0,0 +1,36 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Fix \G crash on first match
+Bug-Debian: http://bugs.debian.org/545234
+Bug: http://rt.perl.org/rt3/Public/Bug/Display.html?id=69056
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/c584a96ef5d541fd119f21c2c77f6ffe2b2c0370
+
+
+---
+ regexec.c | 5 ++++-
+ 1 files changed, 4 insertions(+), 1 deletions(-)
+
+diff --git a/regexec.c b/regexec.c
+index 7a42c4f..5beb8ca 100644
+--- a/regexec.c
++++ b/regexec.c
+@@ -1853,6 +1853,8 @@ Perl_regexec_flags(pTHX_ REGEXP * const prog, char *stringarg, register char *st
+ if (s > reginfo.ganch)
+ goto phooey;
+ s = reginfo.ganch - prog->gofs;
++ if (s < strbeg)
++ goto phooey;
+ }
+ }
+ else if (data) {
+@@ -1928,7 +1930,8 @@ Perl_regexec_flags(pTHX_ REGEXP * const prog, char *stringarg, register char *st
+ is bogus -- we set it above, when prog->extflags & RXf_GPOS_SEEN
+ and we only enter this block when the same bit is set. */
+ char *tmp_s = reginfo.ganch - prog->gofs;
+- if (regtry(&reginfo, &tmp_s))
++
++ if (tmp_s >= strbeg && regtry(&reginfo, &tmp_s))
+ goto got_it;
+ goto phooey;
+ }
+--
+tg: (daf8b46..) fixes/positive-gpos (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/processPL.diff b/recipes/perl/perl-5.10.1/processPL.diff
new file mode 100644
index 0000000000..3e48df124a
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/processPL.diff
@@ -0,0 +1,43 @@
+Subject: Always use PERLRUNINST when building perl modules.
+Bug-Debian: http://bugs.debian.org/357264
+Bug: http://rt.cpan.org/Public/Bug/Display.html?id=17224
+
+Revert part of upstream change 24524 to always use PERLRUNINST when
+building perl modules: Some PDL demos expect blib to be implicitly
+searched.
+
+
+---
+ lib/ExtUtils/MM_Unix.pm | 5 +----
+ 1 files changed, 1 insertions(+), 4 deletions(-)
+
+diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm
+index ad28b22..1f6b2ef 100644
+--- a/lib/ExtUtils/MM_Unix.pm
++++ b/lib/ExtUtils/MM_Unix.pm
+@@ -3031,14 +3031,11 @@ sub processPL {
+ # pm_to_blib depends on then it can't depend on pm_to_blib
+ # else we have a dependency loop.
+ my $pm_dep;
+- my $perlrun;
+ if( defined $self->{PM}{$target} ) {
+ $pm_dep = '';
+- $perlrun = 'PERLRUN';
+ }
+ else {
+ $pm_dep = 'pm_to_blib';
+- $perlrun = 'PERLRUNINST';
+ }
+
+ $m .= <<MAKE_FRAG;
+@@ -3047,7 +3044,7 @@ all :: $target
+ \$(NOECHO) \$(NOOP)
+
+ $target :: $plfile $pm_dep
+- \$($perlrun) $plfile $target
++ \$(PERLRUNINST) $plfile $target
+ MAKE_FRAG
+
+ }
+--
+tg: (daf8b46..) fixes/processPL (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/prune_libs.diff b/recipes/perl/perl-5.10.1/prune_libs.diff
new file mode 100644
index 0000000000..8a36eb1d70
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/prune_libs.diff
@@ -0,0 +1,36 @@
+Subject: Prune the list of libraries wanted to what we actually need.
+Bug-Debian: http://bugs.debian.org/128355
+
+We want to keep the dependencies on perl-base as small as possible,
+and some of the original list may be present on buildds (see Bug#128355).
+
+
+---
+ Configure | 5 ++---
+ 1 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/Configure b/Configure
+index 01fa3c0..1fee5c1 100755
+--- a/Configure
++++ b/Configure
+@@ -1354,8 +1354,7 @@ libswanted_uselargefiles=''
+ : set usesocks on the Configure command line to enable socks.
+ : List of libraries we want.
+ : If anyone needs extra -lxxx, put those in a hint file.
+-libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
+-libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
++libswanted='gdbm gdbm_compat db dl m c crypt'
+ : We probably want to search /usr/shlib before most other libraries.
+ : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
+ glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
+@@ -22044,7 +22043,7 @@ sunos*X4*)
+ ;;
+ *) case "$usedl" in
+ $define|true|[yY]*)
+- set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
++ set X `echo " $libs " | sed -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldb @ @'`
+ shift
+ perllibs="$*"
+ ;;
+--
+tg: (daf8b46..) debian/prune_libs (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/safe-upgrade.diff b/recipes/perl/perl-5.10.1/safe-upgrade.diff
new file mode 100644
index 0000000000..51c063eac5
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/safe-upgrade.diff
@@ -0,0 +1,836 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Upgrade Safe.pm to 2.25, fixing CVE-2010-1974
+Bug-Debian: http://bugs.debian.org/582978
+Origin: upstream
+
+Upgrade Safe.pm to 2.25, fixing CVE-2010-1974, as recommended in
+
+ http://blogs.perl.org/users/rafael_garcia-suarez/2010/03/new-safepm-fixes-security-hole.html
+
+Although 2.27 is available, its changes are more intrusive.
+
+---
+ ext/Safe/Safe.pm | 290 +++++++++++++++++++++++++++++++++-----------
+ ext/Safe/t/safe1.t | 4 -
+ ext/Safe/t/safe2.t | 4 -
+ ext/Safe/t/safe3.t | 4 -
+ ext/Safe/t/safeload.t | 4 -
+ ext/Safe/t/safeops.t | 8 +-
+ ext/Safe/t/safesort.t | 61 +++++++++
+ ext/Safe/t/safeuniversal.t | 13 +--
+ ext/Safe/t/safeutf8.t | 46 +++++++
+ ext/Safe/t/safewrap.t | 39 ++++++
+ 10 files changed, 370 insertions(+), 103 deletions(-)
+
+diff --git a/ext/Safe/Safe.pm b/ext/Safe/Safe.pm
+index ff099ec..e33598e 100644
+--- a/ext/Safe/Safe.pm
++++ b/ext/Safe/Safe.pm
+@@ -2,8 +2,10 @@ package Safe;
+
+ use 5.003_11;
+ use strict;
++use Scalar::Util qw(reftype);
++use B qw(sub_generation);
+
+-$Safe::VERSION = "2.18";
++$Safe::VERSION = "2.25";
+
+ # *** Don't declare any lexicals above this point ***
+ #
+@@ -11,18 +13,18 @@ $Safe::VERSION = "2.18";
+ # see any lexicals in scope (apart from __ExPr__ which is unavoidable)
+
+ sub lexless_anon_sub {
+- # $_[0] is package;
+- # $_[1] is strict flag;
++ # $_[0] is package;
++ # $_[1] is strict flag;
+ my $__ExPr__ = $_[2]; # must be a lexical to create the closure that
+- # can be used to pass the value into the safe
+- # world
++ # can be used to pass the value into the safe
++ # world
+
+ # Create anon sub ref in root of compartment.
+ # Uses a closure (on $__ExPr__) to pass in the code to be executed.
+ # (eval on one line to keep line numbers as expected by caller)
+ eval sprintf
+ 'package %s; %s strict; sub { @_=(); eval q[my $__ExPr__;] . $__ExPr__; }',
+- $_[0], $_[1] ? 'use' : 'no';
++ $_[0], $_[1] ? 'use' : 'no';
+ }
+
+ use Carp;
+@@ -38,6 +40,23 @@ use Opcode 1.01, qw(
+
+ *ops_to_opset = \&opset; # Temporary alias for old Penguins
+
++# Regular expressions and other unicode-aware code may need to call
++# utf8->SWASHNEW (via perl's utf8.c). That will fail unless we share the
++# SWASHNEW method.
++# Sadly we can't just add utf8::SWASHNEW to $default_share because perl's
++# utf8.c code does a fetchmethod on SWASHNEW to check if utf8.pm is loaded,
++# and sharing makes it look like the method exists.
++# The simplest and most robust fix is to ensure the utf8 module is loaded when
++# Safe is loaded. Then we can add utf8::SWASHNEW to $default_share.
++require utf8;
++# we must ensure that utf8_heavy.pl, where SWASHNEW is defined, is loaded
++# but without depending on knowledge of that implementation detail.
++# This code (//i on a unicode string) ensures utf8 is fully loaded
++# and also loads the ToFold SWASH.
++# (Swashes are cached internally by perl in PL_utf8_* variables
++# independent of being inside/outside of Safe. So once loaded they can be)
++do { my $unicode = pack('U',0xC4).'1a'; $unicode =~ /\xE4/i; };
++# now we can safely include utf8::SWASHNEW in $default_share defined below.
+
+ my $default_root = 0;
+ # share *_ and functions defined in universal.c
+@@ -57,10 +76,15 @@ my $default_share = [qw[
+ &utf8::downgrade
+ &utf8::native_to_unicode
+ &utf8::unicode_to_native
++ &utf8::SWASHNEW
+ $version::VERSION
+ $version::CLASS
++ $version::STRICT
++ $version::LAX
+ @version::ISA
+-], ($] >= 5.008001 && qw[
++], ($] < 5.010 && qw[
++ &utf8::SWASHGET
++]), ($] >= 5.008001 && qw[
+ &Regexp::DESTROY
+ ]), ($] >= 5.010 && qw[
+ &re::is_regexp
+@@ -93,6 +117,11 @@ my $default_share = [qw[
+ &version::noop
+ &version::is_alpha
+ &version::qv
++ &version::vxs::declare
++ &version::vxs::qv
++ &version::vxs::_VERSION
++ &version::vxs::new
++ &version::vxs::parse
+ ]), ($] >= 5.011 && qw[
+ &re::regexp_pattern
+ ])];
+@@ -103,14 +132,14 @@ sub new {
+ bless $obj, $class;
+
+ if (defined($root)) {
+- croak "Can't use \"$root\" as root name"
+- if $root =~ /^main\b/ or $root !~ /^\w[:\w]*$/;
+- $obj->{Root} = $root;
+- $obj->{Erase} = 0;
++ croak "Can't use \"$root\" as root name"
++ if $root =~ /^main\b/ or $root !~ /^\w[:\w]*$/;
++ $obj->{Root} = $root;
++ $obj->{Erase} = 0;
+ }
+ else {
+- $obj->{Root} = "Safe::Root".$default_root++;
+- $obj->{Erase} = 1;
++ $obj->{Root} = "Safe::Root".$default_root++;
++ $obj->{Erase} = 1;
+ }
+
+ # use permit/deny methods instead till interface issues resolved
+@@ -125,7 +154,9 @@ sub new {
+ # the whole glob *_ rather than $_ and @_ separately, otherwise
+ # @_ in non default packages within the compartment don't work.
+ $obj->share_from('main', $default_share);
++
+ Opcode::_safe_pkg_prep($obj->{Root}) if($Opcode::VERSION > 1.04);
++
+ return $obj;
+ }
+
+@@ -140,7 +171,7 @@ sub erase {
+ my ($stem, $leaf);
+
+ no strict 'refs';
+- $pkg = "main::$pkg\::"; # expand to full symbol table name
++ $pkg = "main::$pkg\::"; # expand to full symbol table name
+ ($stem, $leaf) = $pkg =~ m/(.*::)(\w+::)$/;
+
+ # The 'my $foo' is needed! Without it you get an
+@@ -149,7 +180,7 @@ sub erase {
+
+ #warn "erase($pkg) stem=$stem, leaf=$leaf";
+ #warn " stem_symtab hash ".scalar(%$stem_symtab)."\n";
+- # ", join(', ', %$stem_symtab),"\n";
++ # ", join(', ', %$stem_symtab),"\n";
+
+ # delete $stem_symtab->{$leaf};
+
+@@ -220,12 +251,12 @@ sub dump_mask {
+ }
+
+
+-
+ sub share {
+ my($obj, @vars) = @_;
+ $obj->share_from(scalar(caller), \@vars);
+ }
+
++
+ sub share_from {
+ my $obj = shift;
+ my $pkg = shift;
+@@ -236,26 +267,27 @@ sub share_from {
+ no strict 'refs';
+ # Check that 'from' package actually exists
+ croak("Package \"$pkg\" does not exist")
+- unless keys %{"$pkg\::"};
++ unless keys %{"$pkg\::"};
+ my $arg;
+ foreach $arg (@$vars) {
+- # catch some $safe->share($var) errors:
+- my ($var, $type);
+- $type = $1 if ($var = $arg) =~ s/^(\W)//;
+- # warn "share_from $pkg $type $var";
+- for (1..2) { # assign twice to avoid any 'used once' warnings
+- *{$root."::$var"} = (!$type) ? \&{$pkg."::$var"}
+- : ($type eq '&') ? \&{$pkg."::$var"}
+- : ($type eq '$') ? \${$pkg."::$var"}
+- : ($type eq '@') ? \@{$pkg."::$var"}
+- : ($type eq '%') ? \%{$pkg."::$var"}
+- : ($type eq '*') ? *{$pkg."::$var"}
+- : croak(qq(Can't share "$type$var" of unknown type));
+- }
++ # catch some $safe->share($var) errors:
++ my ($var, $type);
++ $type = $1 if ($var = $arg) =~ s/^(\W)//;
++ # warn "share_from $pkg $type $var";
++ for (1..2) { # assign twice to avoid any 'used once' warnings
++ *{$root."::$var"} = (!$type) ? \&{$pkg."::$var"}
++ : ($type eq '&') ? \&{$pkg."::$var"}
++ : ($type eq '$') ? \${$pkg."::$var"}
++ : ($type eq '@') ? \@{$pkg."::$var"}
++ : ($type eq '%') ? \%{$pkg."::$var"}
++ : ($type eq '*') ? *{$pkg."::$var"}
++ : croak(qq(Can't share "$type$var" of unknown type));
++ }
+ }
+ $obj->share_record($pkg, $vars) unless $no_record or !$vars;
+ }
+
++
+ sub share_record {
+ my $obj = shift;
+ my $pkg = shift;
+@@ -264,41 +296,135 @@ sub share_record {
+ # Record shares using keys of $obj->{Shares}. See reinit.
+ @{$shares}{@$vars} = ($pkg) x @$vars if @$vars;
+ }
++
++
+ sub share_redo {
+ my $obj = shift;
+ my $shares = \%{$obj->{Shares} ||= {}};
+ my($var, $pkg);
+ while(($var, $pkg) = each %$shares) {
+- # warn "share_redo $pkg\:: $var";
+- $obj->share_from($pkg, [ $var ], 1);
++ # warn "share_redo $pkg\:: $var";
++ $obj->share_from($pkg, [ $var ], 1);
+ }
+ }
++
++
+ sub share_forget {
+ delete shift->{Shares};
+ }
+
++
+ sub varglob {
+ my ($obj, $var) = @_;
+ no strict 'refs';
+ return *{$obj->root()."::$var"};
+ }
+
++sub _clean_stash {
++ my ($root, $saved_refs) = @_;
++ $saved_refs ||= [];
++ no strict 'refs';
++ foreach my $hook (qw(DESTROY AUTOLOAD), grep /^\(/, keys %$root) {
++ push @$saved_refs, \*{$root.$hook};
++ delete ${$root}{$hook};
++ }
++
++ for (grep /::$/, keys %$root) {
++ next if \%{$root.$_} eq \%$root;
++ _clean_stash($root.$_, $saved_refs);
++ }
++}
+
+ sub reval {
+ my ($obj, $expr, $strict) = @_;
+ my $root = $obj->{Root};
+
+- my $evalsub = lexless_anon_sub($root,$strict, $expr);
+- return Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
++ my $evalsub = lexless_anon_sub($root, $strict, $expr);
++ # propagate context
++ my $sg = sub_generation();
++ my @subret = (wantarray)
++ ? Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub)
++ : scalar Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
++ _clean_stash($root.'::') if $sg != sub_generation();
++ return (wantarray) ? @subret : $subret[0];
++}
++
++
++sub wrap_code_refs_within {
++ my $obj = shift;
++
++ $obj->_find_code_refs('wrap_code_ref', @_);
++}
++
++
++sub _find_code_refs {
++ my $obj = shift;
++ my $visitor = shift;
++
++ for my $item (@_) {
++ my $reftype = $item && reftype $item
++ or next;
++ if ($reftype eq 'ARRAY') {
++ $obj->_find_code_refs($visitor, @$item);
++ }
++ elsif ($reftype eq 'HASH') {
++ $obj->_find_code_refs($visitor, values %$item);
++ }
++ # XXX GLOBs?
++ elsif ($reftype eq 'CODE') {
++ $item = $obj->$visitor($item);
++ }
++ }
++}
++
++
++sub wrap_code_ref {
++ my ($obj, $sub) = @_;
++
++ # wrap code ref $sub with _safe_call_sv so that, when called, the
++ # execution will happen with the compartment fully 'in effect'.
++
++ croak "Not a CODE reference"
++ if reftype $sub ne 'CODE';
++
++ my $ret = sub {
++ my @args = @_; # lexical to close over
++ my $sub_with_args = sub { $sub->(@args) };
++
++ my @subret;
++ my $error;
++ do {
++ local $@; # needed due to perl_call_sv(sv, G_EVAL|G_KEEPERR)
++ my $sg = sub_generation();
++ @subret = (wantarray)
++ ? Opcode::_safe_call_sv($obj->{Root}, $obj->{Mask}, $sub_with_args)
++ : scalar Opcode::_safe_call_sv($obj->{Root}, $obj->{Mask}, $sub_with_args);
++ $error = $@;
++ _clean_stash($obj->{Root}.'::') if $sg != sub_generation();
++ };
++ if ($error) { # rethrow exception
++ $error =~ s/\t\(in cleanup\) //; # prefix added by G_KEEPERR
++ die $error;
++ }
++ return (wantarray) ? @subret : $subret[0];
++ };
++
++ return $ret;
+ }
+
++
+ sub rdo {
+ my ($obj, $file) = @_;
+ my $root = $obj->{Root};
+
++ my $sg = sub_generation();
+ my $evalsub = eval
+- sprintf('package %s; sub { @_ = (); do $file }', $root);
+- return Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
++ sprintf('package %s; sub { @_ = (); do $file }', $root);
++ my @subret = (wantarray)
++ ? Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub)
++ : scalar Opcode::_safe_call_sv($root, $obj->{Mask}, $evalsub);
++ _clean_stash($root.'::') if $sg != sub_generation();
++ return (wantarray) ? @subret : $subret[0];
+ }
+
+
+@@ -390,15 +516,7 @@ of this software.
+ Your mileage will vary. If in any doubt B<do not use it>.
+
+
+-=head2 RECENT CHANGES
+-
+-The interface to the Safe module has changed quite dramatically since
+-version 1 (as supplied with Perl5.002). Study these pages carefully if
+-you have code written to use Safe version 1 because you will need to
+-makes changes.
+-
+-
+-=head2 Methods in class Safe
++=head1 METHODS
+
+ To create a new compartment, use
+
+@@ -417,9 +535,7 @@ object returned by the above constructor. The object argument
+ is implicit in each case.
+
+
+-=over 8
+-
+-=item permit (OP, ...)
++=head2 permit (OP, ...)
+
+ Permit the listed operators to be used when compiling code in the
+ compartment (in I<addition> to any operators already permitted).
+@@ -427,29 +543,30 @@ compartment (in I<addition> to any operators already permitted).
+ You can list opcodes by names, or use a tag name; see
+ L<Opcode/"Predefined Opcode Tags">.
+
+-=item permit_only (OP, ...)
++=head2 permit_only (OP, ...)
+
+ Permit I<only> the listed operators to be used when compiling code in
+ the compartment (I<no> other operators are permitted).
+
+-=item deny (OP, ...)
++=head2 deny (OP, ...)
+
+ Deny the listed operators from being used when compiling code in the
+ compartment (other operators may still be permitted).
+
+-=item deny_only (OP, ...)
++=head2 deny_only (OP, ...)
+
+ Deny I<only> the listed operators from being used when compiling code
+-in the compartment (I<all> other operators will be permitted).
++in the compartment (I<all> other operators will be permitted, so you probably
++don't want to use this method).
+
+-=item trap (OP, ...)
++=head2 trap (OP, ...)
+
+-=item untrap (OP, ...)
++=head2 untrap (OP, ...)
+
+ The trap and untrap methods are synonyms for deny and permit
+ respectfully.
+
+-=item share (NAME, ...)
++=head2 share (NAME, ...)
+
+ This shares the variable(s) in the argument list with the compartment.
+ This is almost identical to exporting variables using the L<Exporter>
+@@ -465,9 +582,9 @@ for a glob (i.e. all symbol table entries associated with "foo",
+ including scalar, array, hash, sub and filehandle).
+
+ Each NAME is assumed to be in the calling package. See share_from
+-for an alternative method (which share uses).
++for an alternative method (which C<share> uses).
+
+-=item share_from (PACKAGE, ARRAYREF)
++=head2 share_from (PACKAGE, ARRAYREF)
+
+ This method is similar to share() but allows you to explicitly name the
+ package that symbols should be shared from. The symbol names (including
+@@ -475,20 +592,29 @@ type characters) are supplied as an array reference.
+
+ $safe->share_from('main', [ '$foo', '%bar', 'func' ]);
+
++Names can include package names, which are relative to the specified PACKAGE.
++So these two calls have the same effect:
++
++ $safe->share_from('Scalar::Util', [ 'reftype' ]);
++ $safe->share_from('main', [ 'Scalar::Util::reftype' ]);
+
+-=item varglob (VARNAME)
++=head2 varglob (VARNAME)
+
+ This returns a glob reference for the symbol table entry of VARNAME in
+ the package of the compartment. VARNAME must be the B<name> of a
+-variable without any leading type marker. For example,
++variable without any leading type marker. For example:
++
++ ${$cpt->varglob('foo')} = "Hello world";
++
++has the same effect as:
+
+ $cpt = new Safe 'Root';
+ $Root::foo = "Hello world";
+- # Equivalent version which doesn't need to know $cpt's package name:
+- ${$cpt->varglob('foo')} = "Hello world";
++
++but avoids the need to know $cpt's package name.
+
+
+-=item reval (STRING, STRICT)
++=head2 reval (STRING, STRICT)
+
+ This evaluates STRING as perl code inside the compartment.
+
+@@ -553,14 +679,12 @@ the code in the compartment.
+ A similar effect applies to I<all> runtime symbol lookups in code
+ called from a compartment but not compiled within it.
+
+-
+-
+-=item rdo (FILENAME)
++=head2 rdo (FILENAME)
+
+ This evaluates the contents of file FILENAME inside the compartment.
+ See above documentation on the B<reval> method for further details.
+
+-=item root (NAMESPACE)
++=head2 root (NAMESPACE)
+
+ This method returns the name of the package that is the root of the
+ compartment's namespace.
+@@ -569,7 +693,7 @@ Note that this behaviour differs from version 1.00 of the Safe module
+ where the root module could be used to change the namespace. That
+ functionality has been withdrawn pending deeper consideration.
+
+-=item mask (MASK)
++=head2 mask (MASK)
+
+ This is a get-or-set method for the compartment's operator mask.
+
+@@ -579,14 +703,34 @@ the compartment.
+ With the MASK argument present, it sets the operator mask for the
+ compartment (equivalent to calling the deny_only method).
+
+-=back
++=head2 wrap_code_ref (CODEREF)
++
++Returns a reference to an anonymous subroutine that, when executed, will call
++CODEREF with the Safe compartment 'in effect'. In other words, with the
++package namespace adjusted and the opmask enabled.
+
++Note that the opmask doesn't affect the already compiled code, it only affects
++any I<further> compilation that the already compiled code may try to perform.
+
+-=head2 Some Safety Issues
++This is particularly useful when applied to code references returned from reval().
+
+-This section is currently just an outline of some of the things code in
+-a compartment might do (intentionally or unintentionally) which can
+-have an effect outside the compartment.
++(It also provides a kind of workaround for RT#60374: "Safe.pm sort {} bug with
++-Dusethreads". See L<http://rt.perl.org/rt3//Public/Bug/Display.html?id=60374>
++for I<much> more detail.)
++
++=head2 wrap_code_refs_within (...)
++
++Wraps any CODE references found within the arguments by replacing each with the
++result of calling L</wrap_code_ref> on the CODE reference. Any ARRAY or HASH
++references in the arguments are inspected recursively.
++
++Returns nothing.
++
++=head1 RISKS
++
++This section is just an outline of some of the things code in a compartment
++might do (intentionally or unintentionally) which can have an effect outside
++the compartment.
+
+ =over 8
+
+@@ -624,7 +768,7 @@ but more subtle effect.
+
+ =back
+
+-=head2 AUTHOR
++=head1 AUTHOR
+
+ Originally designed and implemented by Malcolm Beattie.
+
+diff --git a/ext/Safe/t/safe1.t b/ext/Safe/t/safe1.t
+index 6a3b908..385d661 100755
+--- a/ext/Safe/t/safe1.t
++++ b/ext/Safe/t/safe1.t
+@@ -1,10 +1,6 @@
+ #!./perl -w
+ $|=1;
+ BEGIN {
+- if($ENV{PERL_CORE}) {
+- chdir 't' if -d 't';
+- @INC = '../lib';
+- }
+ require Config; import Config;
+ if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
+ print "1..0\n";
+diff --git a/ext/Safe/t/safe2.t b/ext/Safe/t/safe2.t
+index d0239d1..2548dcc 100755
+--- a/ext/Safe/t/safe2.t
++++ b/ext/Safe/t/safe2.t
+@@ -1,10 +1,6 @@
+ #!./perl -w
+ $|=1;
+ BEGIN {
+- if($ENV{PERL_CORE}) {
+- chdir 't' if -d 't';
+- @INC = '../lib';
+- }
+ require Config; import Config;
+ if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
+ print "1..0\n";
+diff --git a/ext/Safe/t/safe3.t b/ext/Safe/t/safe3.t
+index c809f27..1f99f49 100755
+--- a/ext/Safe/t/safe3.t
++++ b/ext/Safe/t/safe3.t
+@@ -1,10 +1,6 @@
+ #!perl -w
+
+ BEGIN {
+- if ($ENV{PERL_CORE}) {
+- chdir 't' if -d 't';
+- @INC = '../lib';
+- }
+ require Config; import Config;
+ if ($Config{'extensions'} !~ /\bOpcode\b/
+ && $Config{'extensions'} !~ /\bPOSIX\b/
+diff --git a/ext/Safe/t/safeload.t b/ext/Safe/t/safeload.t
+index b15c290..2d2c3cc 100755
+--- a/ext/Safe/t/safeload.t
++++ b/ext/Safe/t/safeload.t
+@@ -1,10 +1,6 @@
+ #!perl
+
+ BEGIN {
+- if ($ENV{PERL_CORE}) {
+- chdir 't' if -d 't';
+- @INC = '../lib';
+- }
+ require Config;
+ import Config;
+ if ($Config{'extensions'} !~ /\bOpcode\b/) {
+diff --git a/ext/Safe/t/safeops.t b/ext/Safe/t/safeops.t
+index 229672e..e8fa339 100755
+--- a/ext/Safe/t/safeops.t
++++ b/ext/Safe/t/safeops.t
+@@ -2,13 +2,9 @@
+ # Tests that all ops can be trapped by a Safe compartment
+
+ BEGIN {
+- if ($ENV{PERL_CORE}) {
+- chdir 't' if -d 't';
+- @INC = '../lib';
+- }
+- else {
++ unless ($ENV{PERL_CORE}) {
+ # this won't work outside of the core, so exit
+- print "1..0\n"; exit 0;
++ print "1..0 # skipped: PERL_CORE unset\n"; exit 0;
+ }
+ }
+ use Config;
+diff --git a/ext/Safe/t/safesort.t b/ext/Safe/t/safesort.t
+new file mode 100644
+index 0000000..797e155
+--- /dev/null
++++ b/ext/Safe/t/safesort.t
+@@ -0,0 +1,61 @@
++#!perl -w
++$|=1;
++BEGIN {
++ require Config; import Config;
++ if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
++ print "1..0\n";
++ exit 0;
++ }
++}
++
++use Safe 1.00;
++use Test::More tests => 10;
++
++my $safe = Safe->new('PLPerl');
++$safe->permit_only(qw(:default sort));
++
++# check basic argument passing and context for anon-subs
++my $func = $safe->reval(q{ sub { @_ } });
++is_deeply [ $func->() ], [ ];
++is_deeply [ $func->("foo") ], [ "foo" ];
++
++my $func1 = $safe->reval(<<'EOS');
++
++ # uses quotes in { "$a" <=> $b } to avoid the optimizer replacing the block
++ # with a hardwired comparison
++ { package Pkg; sub p_sort { return sort { "$a" <=> $b } @_; } }
++ sub l_sort { return sort { "$a" <=> $b } @_; }
++
++ return sub { return join(",",l_sort(@_)), join(",",Pkg::p_sort(@_)) }
++
++EOS
++
++is $@, '', 'reval should not fail';
++is ref $func, 'CODE', 'reval should return a CODE ref';
++
++# $func1 will work in non-threaded perl
++# but RT#60374 "Safe.pm sort {} bug with -Dusethreads"
++# means the sorting won't work unless we wrap the code ref
++# such that it's executed with Safe 'in effect' at runtime
++my $func2 = $safe->wrap_code_ref($func1);
++
++my ($l_sorted, $p_sorted) = $func2->(3,1,2);
++is $l_sorted, "1,2,3";
++is $p_sorted, "1,2,3";
++
++# check other aspects of closures created inside Safe
++
++my $die_func = $safe->reval(q{ sub { die @_ if @_; 1 } });
++
++# check $@ not affected by successful call
++$@ = 42;
++$die_func->();
++is $@, 42, 'successful closure call should not alter $@';
++
++{
++ my $warns = 0;
++ local $SIG{__WARN__} = sub { $warns++ };
++ ok !eval { $die_func->("died\n"); 1 }, 'should die';
++ is $@, "died\n", '$@ should be set correctly';
++ is $warns, 0;
++}
+diff --git a/ext/Safe/t/safeuniversal.t b/ext/Safe/t/safeuniversal.t
+index 5ef3842..95867c5 100755
+--- a/ext/Safe/t/safeuniversal.t
++++ b/ext/Safe/t/safeuniversal.t
+@@ -1,10 +1,6 @@
+ #!perl
+
+ BEGIN {
+- if ($ENV{PERL_CORE}) {
+- chdir 't' if -d 't';
+- @INC = '../lib';
+- }
+ require Config;
+ import Config;
+ if ($Config{'extensions'} !~ /\bOpcode\b/) {
+@@ -22,8 +18,10 @@ plan(tests => 6);
+ my $c = new Safe;
+ $c->permit(qw(require caller));
+
+-my $r = $c->reval(q!
+- no warnings 'redefine';
++my $no_warn_redef = ($] != 5.008009)
++ ? q(no warnings 'redefine';)
++ : q($SIG{__WARN__}=sub{};);
++my $r = $c->reval($no_warn_redef . q!
+ sub UNIVERSAL::isa { "pwned" }
+ (bless[],"Foo")->isa("Foo");
+ !);
+@@ -33,8 +31,7 @@ is( (bless[],"Foo")->isa("Foo"), 1, "... but not outside" );
+
+ sub Foo::foo {}
+
+-$r = $c->reval(q!
+- no warnings 'redefine';
++$r = $c->reval($no_warn_redef . q!
+ sub UNIVERSAL::can { "pwned" }
+ (bless[],"Foo")->can("foo");
+ !);
+diff --git a/ext/Safe/t/safeutf8.t b/ext/Safe/t/safeutf8.t
+new file mode 100644
+index 0000000..28441da
+--- /dev/null
++++ b/ext/Safe/t/safeutf8.t
+@@ -0,0 +1,46 @@
++#!perl -w
++$|=1;
++BEGIN {
++ require Config; import Config;
++ if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
++ print "1..0\n";
++ exit 0;
++ }
++}
++
++use Test::More tests => 7;
++
++use Safe 1.00;
++use Opcode qw(full_opset);
++
++pass;
++
++my $safe = Safe->new('PLPerl');
++$safe->permit(qw(pack));
++
++# Expression that triggers require utf8 and call to SWASHNEW.
++# Fails with "Undefined subroutine PLPerl::utf8::SWASHNEW called"
++# if SWASHNEW is not shared, else returns true if unicode logic is working.
++my $trigger = q{ my $a = pack('U',0xC4); $a =~ /\\xE4/i };
++
++ok $safe->reval( $trigger ), 'trigger expression should return true';
++is $@, '', 'trigger expression should not die';
++
++# return a closure
++my $sub = $safe->reval(q{sub { warn pack('U',0xC4) }});
++
++# define code outside Safe that'll be triggered from inside
++my @warns;
++$SIG{__WARN__} = sub {
++ my $msg = shift;
++ # this regex requires a different SWASH digit data for \d)
++ # than the one used above and by the trigger code in Safe.pm
++ $msg =~ s/\(eval \d+\)/XXX/i; # uses IsDigit SWASH
++ push @warns, $msg;
++};
++
++is eval { $sub->() }, 1, 'warn should return 1';
++is $@, '', '__WARN__ hook should not die';
++is @warns, 1, 'should only be 1 warning';
++like $warns[0], qr/at XXX line/, 'warning should have been edited';
++
+diff --git a/ext/Safe/t/safewrap.t b/ext/Safe/t/safewrap.t
+new file mode 100644
+index 0000000..27166f8
+--- /dev/null
++++ b/ext/Safe/t/safewrap.t
+@@ -0,0 +1,39 @@
++#!perl -w
++
++$|=1;
++BEGIN {
++ require Config; import Config;
++ if ($Config{'extensions'} !~ /\bOpcode\b/ && $Config{'osname'} ne 'VMS') {
++ print "1..0\n";
++ exit 0;
++ }
++}
++
++use strict;
++use Safe 1.00;
++use Test::More tests => 9;
++
++my $safe = Safe->new('PLPerl');
++$safe->permit_only(qw(:default sort));
++
++# eval within an eval: the outer eval is compiled into the sub, the inner is
++# compiled (by the outer) at runtime and so is subject to runtime opmask
++my $sub1 = sub { eval " eval '1+1' " };
++is $sub1->(), 2;
++
++my $sub1w = $safe->wrap_code_ref($sub1);
++is ref $sub1w, 'CODE';
++is eval { $sub1w->() }, undef;
++like $@, qr/eval .* trapped by operation mask/;
++
++is $sub1->(), 2, 'original ref should be unaffected';
++
++# setup args for wrap_code_refs_within including nested data
++my @args = (42, [[ 0, { sub => $sub1 }, 2 ]], 24);
++is $args[1][0][1]{sub}, $sub1;
++
++$safe->wrap_code_refs_within(@args);
++my $sub1w2 = $args[1][0][1]{sub};
++isnt $sub1w2, $sub1;
++is eval { $sub1w2->() }, undef;
++like $@, qr/eval .* trapped by operation mask/;
+--
+tg: (daf8b46..) fixes/safe-upgrade (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/tainted-errno.diff b/recipes/perl/perl-5.10.1/tainted-errno.diff
new file mode 100644
index 0000000000..23931fd01f
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/tainted-errno.diff
@@ -0,0 +1,85 @@
+Author: David Mitchell <davem@iabyn.com>
+Author: Nicholas Clark <nick@ccl4.org>
+Subject: fix an errno stringification bug in taint mode
+Bug-Debian: http://bugs.debian.org/574129
+Bug: http://rt.perl.org/rt3/Public/Bug/Display.html?id=61976
+Origin: http://perl5.git.perl.org/perl.git/commit/0097b436152452e403cc71b4f1a1cfd30ec0ba1a
+Origin: http://perl5.git.perl.org/perl.git/commit/be1cf43c8dab9dd236839206d53611f7e7d2d856
+
+Hopefully fixes $! stringification problems seen with spamassassin (#574129).
+
+---
+ mg.c | 2 ++
+ t/op/magic.t | 8 +++++++-
+ t/op/taint.t | 13 ++++++++++++-
+ 3 files changed, 21 insertions(+), 2 deletions(-)
+
+diff --git a/mg.c b/mg.c
+index 5502e90..70ebb0b 100644
+--- a/mg.c
++++ b/mg.c
+@@ -1041,6 +1041,8 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
+ else
+ #endif
+ sv_setpv(sv, errno ? Strerror(errno) : "");
++ if (SvPOKp(sv))
++ SvPOK_on(sv); /* may have got removed during taint processing */
+ RESTORE_ERRNO;
+ }
+ #endif
+diff --git a/t/op/magic.t b/t/op/magic.t
+index bfb68a7..d51a22b 100755
+--- a/t/op/magic.t
++++ b/t/op/magic.t
+@@ -12,7 +12,7 @@ use warnings;
+ use Config;
+
+
+-plan (tests => 59);
++plan (tests => 60);
+
+ $Is_MSWin32 = $^O eq 'MSWin32';
+ $Is_NetWare = $^O eq 'NetWare';
+@@ -475,3 +475,9 @@ SKIP: {
+ is $@, '', 'Assign a shared key to a magic hash';
+ $@ and print "# $@";
+ }
++
++{
++ $! = 9999;
++ is int $!, 9999, q{[perl #72850] Core dump in bleadperl from perl -e '$! = 9999; $a = $!;'};
++
++}
+diff --git a/t/op/taint.t b/t/op/taint.t
+index 0ac02a6..6511fa5 100755
+--- a/t/op/taint.t
++++ b/t/op/taint.t
+@@ -17,7 +17,7 @@ use Config;
+ use File::Spec::Functions;
+
+ BEGIN { require './test.pl'; }
+-plan tests => 301;
++plan tests => 302;
+
+ $| = 1;
+
+@@ -1316,6 +1316,17 @@ foreach my $ord (78, 163, 256) {
+ ok(tainted($zz), "pack a*a* preserves tainting");
+ }
+
++# Bug RT #61976 tainted $! would show numeric rather than string value
++
++{
++ my $tainted_path = substr($^X,0,0) . "/no/such/file";
++ my $err;
++ # $! is used in a tainted expression, so gets tainted
++ open my $fh, $tainted_path or $err= "$!";
++ unlike($err, qr/^\d+$/, 'tainted $!');
++}
++
++
+ # This may bomb out with the alarm signal so keep it last
+ SKIP: {
+ skip "No alarm()" unless $Config{d_alarm};
+--
+tg: (daf8b46..) fixes/tainted-errno (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/tell-crash.diff b/recipes/perl/perl-5.10.1/tell-crash.diff
new file mode 100644
index 0000000000..c21c13dc48
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/tell-crash.diff
@@ -0,0 +1,33 @@
+From: Niko Tyni <ntyni@debian.org>
+Subject: Fix a tell() crash on bad arguments.
+Bug-Debian: http://bugs.debian.org/578577
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/f03173f2c707a804ec3e9c291d2ab1adb9db4abc
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/f4817f32b1c5f1cefe556cf79f36f874b67cad16
+
+Fix a crash with things like
+ perl -e 'tell (fileno(*STDOUT))'
+
+
+---
+ pp_sys.c | 6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/pp_sys.c b/pp_sys.c
+index a1f8c7a..74004b9 100644
+--- a/pp_sys.c
++++ b/pp_sys.c
+@@ -2081,6 +2081,12 @@ PP(pp_tell)
+ RETURN;
+ }
+ }
++ else if (!gv) {
++ if (!errno)
++ SETERRNO(EBADF,RMS_IFI);
++ PUSHi(-1);
++ RETURN;
++ }
+
+ #if LSEEKSIZE > IVSIZE
+ PUSHn( do_tell(gv) );
+--
+tg: (daf8b46..) fixes/tell-crash (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/trie-logic-match.diff b/recipes/perl/perl-5.10.1/trie-logic-match.diff
new file mode 100644
index 0000000000..b64457649a
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/trie-logic-match.diff
@@ -0,0 +1,111 @@
+From: Eugene V. Lyubimkin <jackyf@debian.org>
+Subject: Fix a DoS in Unicode processing [CVE-2009-3626]
+Bug-Debian: http://bugs.debian.org/552291
+Bug: http://rt.perl.org/rt3/Public/Bug/Display.html?id=69973
+Origin: upstream, http://perl5.git.perl.org/perl.git/commit/0abd0d78a73da1c4d13b1c700526b7e5d03b32d4.
+
+Resolves segmentation fault in some tricky tainted non-UTF-8 matches.
+
+Signed-off-by: Eugene V. Lyubimkin <jackyf@debian.org>
+
+---
+ ext/re/t/regop.t | 12 ++++++------
+ regcomp.c | 17 +++++++++++------
+ regexec.c | 9 ++-------
+ 3 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/ext/re/t/regop.t b/ext/re/t/regop.t
+index 7fe7b20..f111b91 100755
+--- a/ext/re/t/regop.t
++++ b/ext/re/t/regop.t
+@@ -233,12 +233,12 @@ anchored "ABC" at 0
+ #Freeing REx: "(\\.COM|\\.EXE|\\.BAT|\\.CMD|\\.VBS|\\.VBE|\\.JS|\\.JSE|\\."......
+ %MATCHED%
+ floating ""$ at 3..4 (checking floating)
+-1:1[1] 3:2[1] 5:2[64] 45:83[1] 47:84[1] 48:85[0]
+-stclass EXACTF <.> minlen 3
+-Found floating substr ""$ at offset 30...
+-Does not contradict STCLASS...
+-Guessed: match at offset 26
+-Matching stclass EXACTF <.> against ".exe"
++#1:1[1] 3:2[1] 5:2[64] 45:83[1] 47:84[1] 48:85[0]
++#stclass EXACTF <.> minlen 3
++#Found floating substr ""$ at offset 30...
++#Does not contradict STCLASS...
++#Guessed: match at offset 26
++#Matching stclass EXACTF <.> against ".exe"
+ ---
+ #Compiling REx "[q]"
+ #size 12 nodes Got 100 bytes for offset annotations.
+diff --git a/regcomp.c b/regcomp.c
+index 49e69b2..b7fb032 100644
+--- a/regcomp.c
++++ b/regcomp.c
+@@ -2820,13 +2820,18 @@ S_study_chunk(pTHX_ RExC_state_t *pRExC_state, regnode **scanp,
+ }
+ } else {
+ /*
+- Currently we assume that the trie can handle unicode and ascii
+- matches fold cased matches. If this proves true then the following
+- define will prevent tries in this situation.
+-
+- #define TRIE_TYPE_IS_SAFE (UTF || optype==EXACT)
+-*/
++ Currently we do not believe that the trie logic can
++ handle case insensitive matching properly when the
++ pattern is not unicode (thus forcing unicode semantics).
++
++ If/when this is fixed the following define can be swapped
++ in below to fully enable trie logic.
++
+ #define TRIE_TYPE_IS_SAFE 1
++
++*/
++#define TRIE_TYPE_IS_SAFE (UTF || optype==EXACT)
++
+ if ( last && TRIE_TYPE_IS_SAFE ) {
+ make_trie( pRExC_state,
+ startbranch, first, cur, tail, count,
+diff --git a/regexec.c b/regexec.c
+index 7a42c4f..32994de 100644
+--- a/regexec.c
++++ b/regexec.c
+@@ -1006,16 +1006,15 @@ Perl_re_intuit_start(pTHX_ REGEXP * const prog, SV *sv, char *strpos,
+
+ #define REXEC_TRIE_READ_CHAR(trie_type, trie, widecharmap, uc, uscan, len, \
+ uvc, charid, foldlen, foldbuf, uniflags) STMT_START { \
+- UV uvc_unfolded = 0; \
+ switch (trie_type) { \
+ case trie_utf8_fold: \
+ if ( foldlen>0 ) { \
+- uvc_unfolded = uvc = utf8n_to_uvuni( uscan, UTF8_MAXLEN, &len, uniflags ); \
++ uvc = utf8n_to_uvuni( uscan, UTF8_MAXLEN, &len, uniflags ); \
+ foldlen -= len; \
+ uscan += len; \
+ len=0; \
+ } else { \
+- uvc_unfolded = uvc = utf8n_to_uvuni( (U8*)uc, UTF8_MAXLEN, &len, uniflags ); \
++ uvc = utf8n_to_uvuni( (U8*)uc, UTF8_MAXLEN, &len, uniflags ); \
+ uvc = to_uni_fold( uvc, foldbuf, &foldlen ); \
+ foldlen -= UNISKIP( uvc ); \
+ uscan = foldbuf + UNISKIP( uvc ); \
+@@ -1041,7 +1040,6 @@ uvc, charid, foldlen, foldbuf, uniflags) STMT_START { \
+ uvc = (UV)*uc; \
+ len = 1; \
+ } \
+- \
+ if (uvc < 256) { \
+ charid = trie->charmap[ uvc ]; \
+ } \
+@@ -1054,9 +1052,6 @@ uvc, charid, foldlen, foldbuf, uniflags) STMT_START { \
+ charid = (U16)SvIV(*svpp); \
+ } \
+ } \
+- if (!charid && trie_type == trie_utf8_fold && !UTF) { \
+- charid = trie->charmap[uvc_unfolded]; \
+- } \
+ } STMT_END
+
+ #define REXEC_FBC_EXACTISH_CHECK(CoNd) \
+--
+tg: (daf8b46..) fixes/trie-logic-match (depends on: upstream)
diff --git a/recipes/perl/perl-5.10.1/use_gdbm.diff b/recipes/perl/perl-5.10.1/use_gdbm.diff
new file mode 100644
index 0000000000..085a700888
--- /dev/null
+++ b/recipes/perl/perl-5.10.1/use_gdbm.diff
@@ -0,0 +1,39 @@
+Subject: Explicitly link against -lgdbm_compat in ODBM_File/NDBM_File.
+
+Explicitly link against -lgdbm_compat.
+
+
+---
+ ext/NDBM_File/hints/linux.pl | 5 +----
+ ext/ODBM_File/hints/linux.pl | 8 +-------
+ 2 files changed, 2 insertions(+), 11 deletions(-)
+
+diff --git a/ext/NDBM_File/hints/linux.pl b/ext/NDBM_File/hints/linux.pl
+index 174f913..652b75b 100644
+--- a/ext/NDBM_File/hints/linux.pl
++++ b/ext/NDBM_File/hints/linux.pl
+@@ -2,7 +2,4 @@
+ # Prefer gdbm to avoid the broken ndbm in some distributions
+ # (no null key support)
+ # Jonathan Stowe <gellyfish@gellyfish.com>
+-use Config;
+-use ExtUtils::Liblist;
+-($self->{LIBS}) = ExtUtils::Liblist->ext('-lgdbm -lgdbm_compat')
+- if $Config{libs} =~ /(?:^|\s)-lgdbm(?:\s|$)/;
++$self->{LIBS} = ['-lgdbm_compat'];
+diff --git a/ext/ODBM_File/hints/linux.pl b/ext/ODBM_File/hints/linux.pl
+index f8ca492..2cf6b02 100644
+--- a/ext/ODBM_File/hints/linux.pl
++++ b/ext/ODBM_File/hints/linux.pl
+@@ -1,8 +1,2 @@
+ # uses GDBM dbm compatibility feature - at least on SuSE 8.0
+-$self->{LIBS} = ['-lgdbm'];
+-
+-# Debian/Ubuntu have /usr/lib/libgdbm_compat.so.3* but not this file,
+-# so linking may fail
+-if (-e '/usr/lib/libgdbm_compat.so' or -e '/usr/lib64/libgdbm_compat.so') {
+- $self->{LIBS}->[0] .= ' -lgdbm_compat';
+-}
++$self->{LIBS} = ['-lgdbm_compat'];
+--
+tg: (daf8b46..) debian/use_gdbm (depends on: upstream)
diff --git a/recipes/perl/perl_5.10.1.bb b/recipes/perl/perl_5.10.1.bb
index c3755125ce..0fe3371f4b 100644
--- a/recipes/perl/perl_5.10.1.bb
+++ b/recipes/perl/perl_5.10.1.bb
@@ -5,7 +5,7 @@ LICENSE = "Artistic|GPL"
PRIORITY = "optional"
# We need gnugrep (for -I)
DEPENDS = "virtual/db perl-native grep-native"
-PR = "r10"
+PR = "r11"
# Not tested enough
DEFAULT_PREFERENCE = "-1"
@@ -14,7 +14,52 @@ DEFAULT_PREFERENCE = "-1"
PVM = "5.10"
SRC_URI = "ftp://ftp.funet.fi/pub/CPAN/src/perl-${PV}.tar.gz;name=perl-${PV} \
- file://perl_${PV}-8.diff.gz \
+ file://arm_thread_stress_timeout.diff \
+ file://cpan_config_path.diff \
+ file://cpan_definstalldirs.diff \
+ file://db_file_ver.diff \
+ file://doc_info.diff \
+ file://enc2xs_inc.diff \
+ file://errno_ver.diff \
+ file://extutils_hacks.diff \
+ file://fakeroot.diff \
+ file://instmodsh_doc.diff \
+ file://ld_run_path.diff \
+ file://libnet_config_path.diff \
+ file://m68k_thread_stress.diff \
+ file://mod_paths.diff \
+ file://module_build_man_extensions.diff \
+ file://perl_synopsis.diff \
+ file://prune_libs.diff \
+ file://use_gdbm.diff \
+ file://assorted_docs.diff \
+ file://net_smtp_docs.diff \
+ file://processPL.diff \
+ file://perlivp.diff \
+ file://pod2man-index-backslash.diff \
+ file://disable-zlib-bundling.diff \
+ file://kfreebsd_cppsymbols.diff \
+ file://cpanplus_definstalldirs.diff \
+ file://cpanplus_config_path.diff \
+ file://kfreebsd-filecopy-pipes.diff \
+ file://anon-tmpfile-dir.diff \
+ file://abstract-sockets.diff \
+ file://hurd_cppsymbols.diff \
+ file://autodie-flock.diff \
+ file://archive-tar-instance-error.diff \
+ file://positive-gpos.diff \
+ file://devel-ppport-ia64-optim.diff \
+ file://trie-logic-match.diff \
+ file://hppa-thread-eagain.diff \
+ file://crash-on-undefined-destroy.diff \
+ file://tainted-errno.diff \
+ file://safe-upgrade.diff \
+ file://tell-crash.diff \
+ file://format-write-crash.diff \
+ file://arm-alignment.diff \
+ file://fcgi-test.diff \
+ file://hurd-ccflags.diff \
+ \
file://Makefile.patch \
file://Makefile.SH.patch \
file://installperl.patch \