perl/perl-update-constant.patch
Štěpán Kasal 26b7a08961 - remove compatibility obsolete sitelib directories
- use a better BuildRoot
- drop a redundant mkdir in %%install
- call patchlevel.h only once; rm patchlevel.bak
- update modules Sys::Syslog, Module::Load::Conditional, Module::CoreList,
    Test::Harness, Test::Simple, CGI.pm (dropping the upstreamed patch),
    File::Path (that includes our perl-5.10.0-CVE-2008-2827.patch),
    constant, Pod::Simple, Archive::Tar, Archive::Extract, File::Fetch,
    File::Temp, IPC::Cmd, Time::HiRes, Module::Build, ExtUtils::CBuilder
- standardize the patches for updating embedded modules
- work around a bug in Module::Build tests bu setting TMPDIR to a directory
    inside the source tree
2009-03-11 21:12:37 +00:00

116 lines
3.7 KiB
Diff

constant-1.17
diff -urN perl-5.10.0.orig/lib/constant.pm perl-5.10.0/lib/constant.pm
--- perl-5.10.0.orig/lib/constant.pm 2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/constant.pm 2008-10-29 22:38:47.000000000 +0100
@@ -4,7 +4,7 @@
use warnings::register;
use vars qw($VERSION %declared);
-$VERSION = '1.13';
+$VERSION = '1.17';
#=======================================================================
@@ -168,7 +168,7 @@
far less likely to send a space probe to the wrong planet because
nobody noticed the one equation in which you wrote C<3.14195>.
-When a constant is used in an expression, perl replaces it with its
+When a constant is used in an expression, Perl replaces it with its
value at compile time, and may then optimize the expression further.
In particular, any code in an C<if (CONSTANT)> block will be optimized
away if the constant is false.
@@ -331,6 +331,20 @@
(or simply use a comma in place of the big arrow) instead of
C<< CONSTANT => 'value' >>.
+=head1 SEE ALSO
+
+L<Readonly> - Facility for creating read-only scalars, arrays, hashes.
+
+L<Const> - Facility for creating read-only variables. Similar to C<Readonly>,
+but uses C<SvREADONLY> instead of C<tie>.
+
+L<Attribute::Constant> - Make read-only variables via attribute
+
+L<Scalar::Readonly> - Perl extension to the C<SvREADONLY> scalar flag
+
+L<Hash::Util> - A selection of general-utility hash subroutines (mostly
+to lock/unlock keys and values)
+
=head1 BUGS
Please report any bugs or feature requests via the perlbug(1) utility.
@@ -350,7 +364,7 @@
The CPAN distribution is maintained by SE<eacute>bastien Aperghis-Tramoni
E<lt>F<sebastien@aperghis.net>E<gt>.
-=head1 COPYRIGHT
+=head1 COPYRIGHT & LICENSE
Copyright (C) 1997, 1999 Tom Phoenix
diff -urN perl-5.10.0.orig/lib/constant.t perl-5.10.0/lib/constant.t
--- perl-5.10.0.orig/lib/constant.t 2007-12-18 11:47:07.000000000 +0100
+++ perl-5.10.0/lib/constant.t 2008-10-29 22:38:47.000000000 +0100
@@ -12,11 +12,11 @@
BEGIN { # ...and save 'em for later
$SIG{'__WARN__'} = sub { push @warnings, @_ }
}
-END { print STDERR @warnings }
+END { @warnings && print STDERR join "\n- ", "accumulated warnings:", @warnings }
use strict;
-use Test::More tests => 97;
+use Test::More tests => 95;
my $TB = Test::More->builder;
BEGIN { use_ok('constant'); }
@@ -80,13 +80,6 @@
is MESS, q('"'\\"'"\\);
is length(MESS), 8;
-use constant TRAILING => '12 cats';
-{
- local $^W;
- cmp_ok TRAILING, '==', 12;
-}
-is TRAILING, '12 cats';
-
use constant LEADING => " \t1234";
cmp_ok LEADING, '==', 1234;
is LEADING, " \t1234";
@@ -112,7 +105,7 @@
# text may vary, so we can't test much better than this.
cmp_ok length(E2BIG), '>', 6;
-is @warnings, 0 or diag join "\n", "unexpected warning", @warnings;
+is @warnings, 0 or diag join "\n- ", "unexpected warning:", @warnings;
@warnings = (); # just in case
undef &PI;
ok @warnings && ($warnings[0] =~ /Constant sub.* undefined/) or
@@ -122,9 +115,9 @@
is @warnings, 0, "unexpected warning";
my $curr_test = $TB->current_test;
-use constant CSCALAR => \"ok 37\n";
-use constant CHASH => { foo => "ok 38\n" };
-use constant CARRAY => [ undef, "ok 39\n" ];
+use constant CSCALAR => \"ok 35\n";
+use constant CHASH => { foo => "ok 36\n" };
+use constant CARRAY => [ undef, "ok 37\n" ];
use constant CCODE => sub { "ok $_[0]\n" };
my $output = $TB->output ;
@@ -305,7 +298,7 @@
eval 'use constant zit => 4; 1' or die $@;
# empty prototypes are reported differently in different versions
- my $no_proto = $] < 5.008 ? "" : ": none";
+ my $no_proto = $] < 5.008004 ? "" : ": none";
is(scalar @warnings, 1, "1 warning");
like ($warnings[0], qr/^Prototype mismatch: sub main::zit$no_proto vs \(\)/,