r31052 - in /branches/upstream/libclass-c3-adopt-next-perl/current: ./ inc/Module/ inc/Module/Install/ lib/Class/C3/Adopt/ t/ t/lib/
eloy at users.alioth.debian.org
eloy at users.alioth.debian.org
Mon Feb 23 13:54:55 UTC 2009
Author: eloy
Date: Mon Feb 23 13:54:43 2009
New Revision: 31052
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=31052
Log:
[svn-upgrade] Integrating new upstream version, libclass-c3-adopt-next-perl (0.07)
Added:
branches/upstream/libclass-c3-adopt-next-perl/current/t/disable_regex.t
branches/upstream/libclass-c3-adopt-next-perl/current/t/warning_package.t
Modified:
branches/upstream/libclass-c3-adopt-next-perl/current/Changes
branches/upstream/libclass-c3-adopt-next-perl/current/MANIFEST
branches/upstream/libclass-c3-adopt-next-perl/current/META.yml
branches/upstream/libclass-c3-adopt-next-perl/current/Makefile.PL
branches/upstream/libclass-c3-adopt-next-perl/current/README
branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install.pm
branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Base.pm
branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Can.pm
branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Fetch.pm
branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Makefile.pm
branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Metadata.pm
branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Win32.pm
branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/WriteAll.pm
branches/upstream/libclass-c3-adopt-next-perl/current/lib/Class/C3/Adopt/NEXT.pm
branches/upstream/libclass-c3-adopt-next-perl/current/t/basic.t
branches/upstream/libclass-c3-adopt-next-perl/current/t/disable.t
branches/upstream/libclass-c3-adopt-next-perl/current/t/lib/C3NT.pm
branches/upstream/libclass-c3-adopt-next-perl/current/t/lib/C3NT_nowarn.pm
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/Changes?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/Changes (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/Changes Mon Feb 23 13:54:43 2009
@@ -1,3 +1,10 @@
+0.07 Thu, 19 Feb 2009 01:44:43 +0100
+ * Add ability to disable warnings for an entire set of modules using a
+ regex.
+ * Change warnings to use the caller instead of the class name of the
+ instance so that warnings are reported on the class which actually
+ uses NEXT, not the class which inherits from it.
+
0.06 Thu, 25 Dec 2008 00:15:14 +0100
* Update documentation.
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/MANIFEST?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/MANIFEST (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/MANIFEST Mon Feb 23 13:54:43 2009
@@ -15,11 +15,13 @@
README
t/basic.t
t/disable.t
+t/disable_regex.t
t/import.t
t/incompatible.t
t/lib/C3NT.pm
t/lib/C3NT_nowarn.pm
t/nowarn.t
+t/warning_package.t
xt/author/pod.t
xt/author/pod_spelling.t
xt/release/meta_yml.t
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/META.yml?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/META.yml (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/META.yml Mon Feb 23 13:54:43 2009
@@ -5,7 +5,7 @@
build_requires:
Test::Exception: 0
distribution_type: module
-generated_by: 'Module::Install version 0.77'
+generated_by: 'Module::Install version 0.79'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -16,8 +16,9 @@
- inc
- t
requires:
+ List::MoreUtils: 0
MRO::Compat: 0
NEXT: 0
resources:
license: http://dev.perl.org/licenses/
-version: 0.06
+version: 0.07
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/Makefile.PL?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/Makefile.PL (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/Makefile.PL Mon Feb 23 13:54:43 2009
@@ -7,6 +7,7 @@
requires 'MRO::Compat';
requires 'NEXT';
+requires 'List::MoreUtils';
test_requires 'Test::Exception';
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/README?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/README (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/README Mon Feb 23 13:54:43 2009
@@ -12,6 +12,8 @@
# Or suppress warnings in a set of modules from one place
# no Class::C3::Adopt::NEXT qw/ Module1 Module2 Module3 /;
+ # Or suppress using a regex
+ # no Class::C3::Adopt::NEXT qr/^Module\d$/;
sub a_method {
my ($self) = @_;
@@ -47,9 +49,12 @@
adding "use Class::C3::Adopt::NEXT -no_warn;", or disable multiple
modules at once by saying:
- no Class::C3::Adopt::Next qw/ Module1 Module2 Module3 /;
+ no Class::C3::Adopt::NEXT qw/ Module1 Module2 Module3 /;
- somewhere before the warnings are first triggered.
+ somewhere before the warnings are first triggered. You can also setup
+ entire name spaces of modules which will not warn using a regex, e.g.
+
+ no Class::C3::Adopt::NEXT qr/^Module\d$/;
MIGRATING
There are two main reasons for using NEXT:
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install.pm?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install.pm (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install.pm Mon Feb 23 13:54:43 2009
@@ -30,7 +30,7 @@
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '0.77';
+ $VERSION = '0.79';
*inc::Module::Install::VERSION = *VERSION;
@inc::Module::Install::ISA = __PACKAGE__;
@@ -250,7 +250,7 @@
sub load_extensions {
my ($self, $path, $top) = @_;
- unless ( grep { lc $_ eq lc $self->{prefix} } @INC ) {
+ unless ( grep { !ref $_ and lc $_ eq lc $self->{prefix} } @INC ) {
unshift @INC, $self->{prefix};
}
@@ -366,4 +366,4 @@
1;
-# Copyright 2008 Adam Kennedy.
+# Copyright 2008 - 2009 Adam Kennedy.
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Base.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Base.pm?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Base.pm (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Base.pm Mon Feb 23 13:54:43 2009
@@ -1,7 +1,7 @@
#line 1
package Module::Install::Base;
-$VERSION = '0.77';
+$VERSION = '0.79';
# Suspend handler for "redefined" warnings
BEGIN {
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Can.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Can.pm?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Can.pm (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Can.pm Mon Feb 23 13:54:43 2009
@@ -11,7 +11,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.77';
+ $VERSION = '0.79';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Fetch.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Fetch.pm?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Fetch.pm (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Fetch.pm Mon Feb 23 13:54:43 2009
@@ -6,20 +6,20 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.77';
+ $VERSION = '0.79';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
sub get_file {
my ($self, %args) = @_;
- my ($scheme, $host, $path, $file) =
+ my ($scheme, $host, $path, $file) =
$args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) {
$args{url} = $args{ftp_url}
or (warn("LWP support unavailable!\n"), return);
- ($scheme, $host, $path, $file) =
+ ($scheme, $host, $path, $file) =
$args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
}
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Makefile.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Makefile.pm?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Makefile.pm (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Makefile.pm Mon Feb 23 13:54:43 2009
@@ -7,7 +7,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.77';
+ $VERSION = '0.79';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
@@ -64,7 +64,7 @@
my $self = shift;
my $clean = $self->makemaker_args->{clean} ||= {};
%$clean = (
- %$clean,
+ %$clean,
FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_),
);
}
@@ -73,7 +73,7 @@
my $self = shift;
my $realclean = $self->makemaker_args->{realclean} ||= {};
%$realclean = (
- %$realclean,
+ %$realclean,
FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_),
);
}
@@ -124,7 +124,7 @@
$self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
- # Generate the
+ # Generate the
my $args = $self->makemaker_args;
$args->{DISTNAME} = $self->name;
$args->{NAME} = $self->module_name || $self->name;
@@ -196,7 +196,7 @@
my $top_class = ref($self->_top) || '';
my $top_version = $self->_top->VERSION || '';
- my $preamble = $self->preamble
+ my $preamble = $self->preamble
? "# Preamble by $top_class $top_version\n"
. $self->preamble
: '';
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Metadata.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Metadata.pm?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Metadata.pm (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Metadata.pm Mon Feb 23 13:54:43 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION $ISCORE @ISA};
BEGIN {
- $VERSION = '0.77';
+ $VERSION = '0.79';
$ISCORE = 1;
@ISA = qw{Module::Install::Base};
}
@@ -176,18 +176,15 @@
"Did not provide a value to perl_version()"
);
- # Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
- # numbers (eg, 5.006001 or 5.008009).
-
- $version =~ s/^(\d+)\.(\d+)\.(\d+)$/sprintf("%d.%03d%03d",$1,$2,$3)/e;
-
- $version =~ s/_.+$//;
- $version = $version + 0; # Numify
+ # Normalize the version
+ $version = $self->_perl_version($version);
+
+ # We don't support the reall old versions
unless ( $version >= 5.005 ) {
die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
}
+
$self->{values}{perl_version} = $version;
- return 1;
}
sub license {
@@ -451,9 +448,6 @@
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
$pattern =~ s{\s+}{\\s+}g;
if ( $license_text =~ /\b$pattern\b/i ) {
- if ( $osi and $license_text =~ /All rights reserved/i ) {
- print "WARNING: 'All rights reserved' in copyright may invalidate Open Source license.\n";
- }
$self->license($license);
return 1;
}
@@ -482,19 +476,70 @@
return 1;
}
-sub install_script {
- my $self = shift;
- my $args = $self->makemaker_args;
- my $exe = $args->{EXE_FILES} ||= [];
- foreach ( @_ ) {
- if ( -f $_ ) {
- push @$exe, $_;
- } elsif ( -d 'script' and -f "script/$_" ) {
- push @$exe, "script/$_";
- } else {
- die("Cannot find script '$_'");
- }
- }
+# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
+# numbers (eg, 5.006001 or 5.008009).
+# Also, convert double-part versions (eg, 5.8)
+sub _perl_version {
+ my $v = $_[-1];
+ $v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e;
+ $v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e;
+ $v =~ s/(\.\d\d\d)000$/$1/;
+ $v =~ s/_.+$//;
+ if ( ref($v) ) {
+ $v = $v + 0; # Numify
+ }
+ return $v;
+}
+
+
+
+
+
+######################################################################
+# MYMETA.yml Support
+
+sub WriteMyMeta {
+ $_[0]->write_mymeta;
+}
+
+sub write_mymeta {
+ my $self = shift;
+
+ # If there's no existing META.yml there is nothing we can do
+ return unless -f 'META.yml';
+
+ # Merge the perl version into the dependencies
+ my $val = $self->Meta->{values};
+ my $perl = delete $val->{perl_version};
+ if ( $perl ) {
+ $val->{requires} ||= [];
+ my $requires = $val->{requires};
+
+ # Canonize to three-dot version after Perl 5.6
+ if ( $perl >= 5.006 ) {
+ $perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e
+ }
+ unshift @$requires, [ perl => $perl ];
+ }
+
+ # Load the advisory META.yml file
+ require YAML::Tiny;
+ my @yaml = YAML::Tiny::LoadFile('META.yml');
+ my $meta = $yaml[0];
+
+ # Overwrite the non-configure dependency hashs
+ delete $meta->{requires};
+ delete $meta->{build_requires};
+ delete $meta->{recommends};
+ if ( exists $val->{requires} ) {
+ $meta->{requires} = { map { @$_ } @{ $val->{requires} } };
+ }
+ if ( exists $val->{build_requires} ) {
+ $meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } };
+ }
+
+ # Save as the MYMETA.yml file
+ YAML::Tiny::DumpFile('MYMETA.yml', $meta);
}
1;
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Win32.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Win32.pm?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Win32.pm (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/Win32.pm Mon Feb 23 13:54:43 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.77';
+ $VERSION = '0.79';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/WriteAll.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/WriteAll.pm?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/WriteAll.pm (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/inc/Module/Install/WriteAll.pm Mon Feb 23 13:54:43 2009
@@ -6,7 +6,7 @@
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.77';
+ $VERSION = '0.79';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/lib/Class/C3/Adopt/NEXT.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/lib/Class/C3/Adopt/NEXT.pm?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/lib/Class/C3/Adopt/NEXT.pm (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/lib/Class/C3/Adopt/NEXT.pm Mon Feb 23 13:54:43 2009
@@ -5,13 +5,15 @@
use NEXT;
use MRO::Compat;
+use List::MoreUtils qw/none/;
use warnings::register;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
{
my %c3_mro_ok;
my %warned_for;
+ my @no_warn_regexes;
{
my $orig = NEXT->can('AUTOLOAD');
@@ -19,6 +21,7 @@
no warnings 'redefine';
*NEXT::AUTOLOAD = sub {
my $class = ref $_[0] || $_[0];
+ my $caller = caller();
# 'NEXT::AUTOLOAD' is cargo-culted from C::P::C3, I have no idea if/why it's needed
my $wanted = our $AUTOLOAD || 'NEXT::AUTOLOAD';
@@ -37,10 +40,12 @@
}
if (length $c3_mro_ok{$class} && $c3_mro_ok{$class}) {
- unless ($warned_for{$class}) {
- warnings::warnif("${class} is trying to use NEXT, which is deprecated. "
- . "Please see the Class::C3::Adopt::NEXT documentation for details");
- $warned_for{$class} = 1;
+ unless ($warned_for{$caller}) {
+ $warned_for{$caller} = 1;
+ if (!@no_warn_regexes || none { $caller =~ $_ } @no_warn_regexes) {
+ warnings::warnif("${caller} is trying to use NEXT, which is deprecated. "
+ . "Please see the Class::C3::Adopt::NEXT documentation for details");
+ }
}
}
@@ -68,7 +73,10 @@
sub unimport {
my $class = shift;
- @c3_mro_ok{@_} = ('') x @_;
+ my @strings = grep { !ref $_ || ref($_) ne 'Regexp' } @_;
+ my @regexes = grep { ref($_) && ref($_) eq 'Regexp' } @_;
+ @c3_mro_ok{@strings} = ('') x @strings;
+ push @no_warn_regexes, @regexes;
}
}
@@ -92,6 +100,8 @@
# Or suppress warnings in a set of modules from one place
# no Class::C3::Adopt::NEXT qw/ Module1 Module2 Module3 /;
+ # Or suppress using a regex
+ # no Class::C3::Adopt::NEXT qr/^Module\d$/;
sub a_method {
my ($self) = @_;
@@ -122,14 +132,17 @@
=head1 WARNINGS
This module will warn once for each package using NEXT. It uses
-L<warnings::register>, and so can be disabled like by adding
-C<no warnings 'Class::C3::Adopt::NEXT';> to each package which generates a
-warning, or adding C<use Class::C3::Adopt::NEXT -no_warn;>, or disable
-multiple modules at once by saying:
-
- no Class::C3::Adopt::Next qw/ Module1 Module2 Module3 /;
-
-somewhere before the warnings are first triggered.
+L<warnings::register>, and so can be disabled like by adding C<no warnings
+'Class::C3::Adopt::NEXT';> to each package which generates a warning, or
+adding C<use Class::C3::Adopt::NEXT -no_warn;>, or disable multiple modules at
+once by saying:
+
+ no Class::C3::Adopt::NEXT qw/ Module1 Module2 Module3 /;
+
+somewhere before the warnings are first triggered. You can also setup entire
+name spaces of modules which will not warn using a regex, e.g.
+
+ no Class::C3::Adopt::NEXT qr/^Module\d$/;
=head1 MIGRATING
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/t/basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/t/basic.t?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/t/basic.t (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/t/basic.t Mon Feb 23 13:54:43 2009
@@ -22,7 +22,7 @@
like($warnings[0], qr/C3NT::Quux is trying to use NEXT/, 'warning for the first time NEXT is used');
is($quux_obj->basic, 42, 'Basic inherited method returns correct value');
-is(scalar @warnings, 1, 'warn only once per class');
+is(scalar @warnings, 3, 'warn only once per class');
{
my $non_exist_rval;
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/t/disable.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/t/disable.t?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/t/disable.t (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/t/disable.t Mon Feb 23 13:54:43 2009
@@ -9,7 +9,7 @@
use C3NT;
-no Class::C3::Adopt::NEXT 'C3NT::Quux';
+no Class::C3::Adopt::NEXT qw/C3NT::Quux C3NT::Bar C3NT::Foo/;
my $obj = C3NT::Quux->new;
Added: branches/upstream/libclass-c3-adopt-next-perl/current/t/disable_regex.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/t/disable_regex.t?rev=31052&op=file
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/t/disable_regex.t (added)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/t/disable_regex.t Mon Feb 23 13:54:43 2009
@@ -1,0 +1,21 @@
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+use Class::C3::Adopt::NEXT;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use C3NT;
+
+no Class::C3::Adopt::NEXT qr/^C3NT::/;
+
+my $obj = C3NT::Quux->new;
+
+my @warnings;
+$SIG{__WARN__} = sub { push @warnings, @_ };
+
+is($obj->basic, 42);
+
+is(scalar @warnings, 0, 'no warnings after disabling NEXT adoption');
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/t/lib/C3NT.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/t/lib/C3NT.pm?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/t/lib/C3NT.pm (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/t/lib/C3NT.pm Mon Feb 23 13:54:43 2009
@@ -45,4 +45,10 @@
sub next_then_c3 { shift->NEXT::next_then_c3 }
}
+{
+ package C3NT::Child;
+
+ use base qw/C3NT::Quux/;
+}
+
1;
Modified: branches/upstream/libclass-c3-adopt-next-perl/current/t/lib/C3NT_nowarn.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/t/lib/C3NT_nowarn.pm?rev=31052&op=diff
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/t/lib/C3NT_nowarn.pm (original)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/t/lib/C3NT_nowarn.pm Mon Feb 23 13:54:43 2009
@@ -18,6 +18,8 @@
use base qw/C3NT::Foo/;
+ no warnings 'Class::C3::Adopt::NEXT';
+
sub basic { shift->NEXT::basic }
sub next_then_c3 { shift->next::method }
sub actual_fail_halfway { shift->NEXT::ACTUAL::actual_fail_halfway }
@@ -27,6 +29,8 @@
package C3NT::Baz;
use base qw/C3NT::Foo/;
+
+ no warnings 'Class::C3::Adopt::NEXT';
sub basic { shift->NEXT::basic }
sub c3_then_next { shift->NEXT::c3_then_next }
Added: branches/upstream/libclass-c3-adopt-next-perl/current/t/warning_package.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libclass-c3-adopt-next-perl/current/t/warning_package.t?rev=31052&op=file
==============================================================================
--- branches/upstream/libclass-c3-adopt-next-perl/current/t/warning_package.t (added)
+++ branches/upstream/libclass-c3-adopt-next-perl/current/t/warning_package.t Mon Feb 23 13:54:43 2009
@@ -1,0 +1,22 @@
+use strict;
+use warnings;
+use Test::More tests => 3;
+use Test::Exception;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Class::C3::Adopt::NEXT;
+
+use vars qw/@warnings/;
+
+BEGIN { $SIG{__WARN__} = sub { push @warnings, @_ } }
+
+use C3NT;
+
+my $child = C3NT::Child->new;
+ at warnings = ();
+$child->basic;
+like($warnings[0], qr/C3NT::Quux is trying to use NEXT/, 'warning for the class NEXT is used by');
+like($warnings[1], qr/C3NT::Bar is trying to use NEXT/, 'warning for the class NEXT is used by');
+like($warnings[2], qr/C3NT::Baz is trying to use NEXT/, 'warning for the class NEXT is used by');
More information about the Pkg-perl-cvs-commits
mailing list