[Bps-public-commit] Scalar-Defer branch, master, updated. d1885672d4ac8caf13a0c74f15cdd034fa14d76c
jesse
jesse at bestpractical.com
Mon Jan 18 14:56:42 EST 2010
The branch, master has been updated
via d1885672d4ac8caf13a0c74f15cdd034fa14d76c (commit)
via 70911d8123b1ea2dd59db0051fec7e6da6c91bea (commit)
via 66dee82dce9220b0cb4b17735e59721ac6531216 (commit)
via a9ca548dc516e8ae189a63b8f7d9fcbf5e5c35b4 (commit)
via 02fbea83a0069478743a9fa03beac60246843515 (commit)
via ed6f92bfe71f1d1d7026c9fc49b1c97ac086b576 (commit)
from 57a8a9478e78d8f9c994e4d994804d7e4509b5c8 (commit)
Summary of changes:
Changes | 8 +-
MANIFEST | 2 +
SIGNATURE | 50 ++
inc/Module/AutoInstall.pm | 768 -----------------------
inc/Module/Install.pm | 364 -----------
inc/Module/Install/AutoInstall.pm | 61 --
inc/Module/Install/Base.pm | 72 ---
inc/Module/Install/Can.pm | 82 ---
inc/Module/Install/Fetch.pm | 93 ---
inc/Module/Install/Include.pm | 34 -
inc/Module/Install/Makefile.pm | 251 --------
inc/Module/Install/Metadata.pm | 487 ---------------
inc/Module/Install/Win32.pm | 64 --
inc/Module/Install/WriteAll.pm | 40 --
inc/PerlIO.pm | 33 -
inc/Test/Builder.pm | 1206 -------------------------------------
inc/Test/Builder/Module.pm | 85 ---
inc/Test/More.pm | 688 ---------------------
inc/ok.pm | 19 -
lib/Scalar/Defer.pm | 2 +-
20 files changed, 59 insertions(+), 4350 deletions(-)
create mode 100644 SIGNATURE
delete mode 100644 inc/Module/AutoInstall.pm
delete mode 100644 inc/Module/Install.pm
delete mode 100644 inc/Module/Install/AutoInstall.pm
delete mode 100644 inc/Module/Install/Base.pm
delete mode 100644 inc/Module/Install/Can.pm
delete mode 100644 inc/Module/Install/Fetch.pm
delete mode 100644 inc/Module/Install/Include.pm
delete mode 100644 inc/Module/Install/Makefile.pm
delete mode 100644 inc/Module/Install/Metadata.pm
delete mode 100644 inc/Module/Install/Win32.pm
delete mode 100644 inc/Module/Install/WriteAll.pm
delete mode 100644 inc/PerlIO.pm
delete mode 100644 inc/Test/Builder.pm
delete mode 100644 inc/Test/Builder/Module.pm
delete mode 100644 inc/Test/More.pm
delete mode 100644 inc/ok.pm
- Log -----------------------------------------------------------------
commit ed6f92bfe71f1d1d7026c9fc49b1c97ac086b576
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Jan 18 11:50:36 2010 -0800
Changes update for 0.21
diff --git a/Changes b/Changes
index 901c4ca..3eb1f85 100644
--- a/Changes
+++ b/Changes
@@ -1,8 +1,12 @@
-[Changes for 0.20 - 20090-02-04]
+[Changes for 0.21 - 2010-01-18]
+
+* Upgrade to a newer Module::Install
+
+[Changes for 0.20 - 2009-02-04]
* No code changes. 0.19 dist was incorrectly built from blib
-[Changes for 0.19 - 20090-02-04]
+[Changes for 0.19 - 2009-02-04]
* Silence Scalar::Defer::Deferred::DEMOLISH warnings - SARTAK++
commit 02fbea83a0069478743a9fa03beac60246843515
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Jan 18 11:51:32 2010 -0800
Bump inc for 0.21
diff --git a/inc/Module/AutoInstall.pm b/inc/Module/AutoInstall.pm
index 7efc552..dfb8ef7 100644
--- a/inc/Module/AutoInstall.pm
+++ b/inc/Module/AutoInstall.pm
@@ -18,7 +18,9 @@ my %FeatureMap = (
# various lexical flags
my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS );
-my ( $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly );
+my (
+ $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps
+);
my ( $PostambleActions, $PostambleUsed );
# See if it's a testing or non-interactive session
@@ -73,6 +75,9 @@ sub _init {
elsif ( $arg =~ /^--test(?:only)?$/ ) {
$TestOnly = 1;
}
+ elsif ( $arg =~ /^--all(?:deps)?$/ ) {
+ $AllDeps = 1;
+ }
}
}
@@ -115,6 +120,13 @@ sub import {
)[0]
);
+ # We want to know if we're under CPAN early to avoid prompting, but
+ # if we aren't going to try and install anything anyway then skip the
+ # check entirely since we don't want to have to load (and configure)
+ # an old CPAN just for a cosmetic message
+
+ $UnderCPAN = _check_lock(1) unless $SkipInstall;
+
while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
my ( @required, @tests, @skiptests );
my $default = 1;
@@ -163,15 +175,24 @@ sub import {
}
# XXX: check for conflicts and uninstalls(!) them.
- if (
- defined( my $cur = _version_check( _load($mod), $arg ||= 0 ) ) )
+ my $cur = _load($mod);
+ if (_version_cmp ($cur, $arg) >= 0)
{
print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
push @Existing, $mod => $arg;
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
else {
- print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
+ if (not defined $cur) # indeed missing
+ {
+ print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
+ }
+ else
+ {
+ # no need to check $arg as _version_cmp ($cur, undef) would satisfy >= above
+ print "too old. ($cur < $arg)\n";
+ }
+
push @required, $mod => $arg;
}
}
@@ -184,6 +205,8 @@ sub import {
!$SkipInstall
and (
$CheckOnly
+ or ($mandatory and $UnderCPAN)
+ or $AllDeps
or _prompt(
qq{==> Auto-install the }
. ( @required / 2 )
@@ -214,8 +237,6 @@ sub import {
}
}
- $UnderCPAN = _check_lock(); # check for $UnderCPAN
-
if ( @Missing and not( $CheckOnly or $UnderCPAN ) ) {
require Config;
print
@@ -234,21 +255,38 @@ sub import {
*{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';
}
+sub _running_under {
+ my $thing = shift;
+ print <<"END_MESSAGE";
+*** Since we're running under ${thing}, I'll just let it take care
+ of the dependency's installation later.
+END_MESSAGE
+ return 1;
+}
+
# Check to see if we are currently running under CPAN.pm and/or CPANPLUS;
# if we are, then we simply let it taking care of our dependencies
sub _check_lock {
- return unless @Missing;
+ return unless @Missing or @_;
+
+ my $cpan_env = $ENV{PERL5_CPAN_IS_RUNNING};
if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) {
- print <<'END_MESSAGE';
+ return _running_under($cpan_env ? 'CPAN' : 'CPANPLUS');
+ }
-*** Since we're running under CPANPLUS, I'll just let it take care
- of the dependency's installation later.
-END_MESSAGE
- return 1;
+ require CPAN;
+
+ if ($CPAN::VERSION > '1.89') {
+ if ($cpan_env) {
+ return _running_under('CPAN');
+ }
+ return; # CPAN.pm new enough, don't need to check further
}
- _load_cpan();
+ # last ditch attempt, this -will- configure CPAN, very sorry
+
+ _load_cpan(1); # force initialize even though it's already loaded
# Find the CPAN lock-file
my $lock = MM->catfile( $CPAN::Config->{cpan_home}, ".lock" );
@@ -284,7 +322,7 @@ sub install {
while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
# grep out those already installed
- if ( defined( _version_check( _load($pkg), $ver ) ) ) {
+ if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
push @installed, $pkg;
}
else {
@@ -313,7 +351,7 @@ sub install {
@modules = @newmod;
}
- if ( _has_cpanplus() ) {
+ if ( _has_cpanplus() and not $ENV{PERL_AUTOINSTALL_PREFER_CPAN} ) {
_install_cpanplus( \@modules, \@config );
} else {
_install_cpan( \@modules, \@config );
@@ -323,7 +361,7 @@ sub install {
# see if we have successfully installed them
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
- if ( defined( _version_check( _load($pkg), $ver ) ) ) {
+ if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
push @installed, $pkg;
}
elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
@@ -378,7 +416,7 @@ sub _install_cpanplus {
my $success;
my $obj = $modtree->{$pkg};
- if ( $obj and defined( _version_check( $obj->{version}, $ver ) ) ) {
+ if ( $obj and _version_cmp( $obj->{version}, $ver ) >= 0 ) {
my $pathname = $pkg;
$pathname =~ s/::/\\W/;
@@ -471,7 +509,7 @@ sub _install_cpan {
my $obj = CPAN::Shell->expand( Module => $pkg );
my $success = 0;
- if ( $obj and defined( _version_check( $obj->cpan_version, $ver ) ) ) {
+ if ( $obj and _version_cmp( $obj->cpan_version, $ver ) >= 0 ) {
my $pathname = $pkg;
$pathname =~ s/::/\\W/;
@@ -535,7 +573,7 @@ sub _update_to {
my $ver = shift;
return
- if defined( _version_check( _load($class), $ver ) ); # no need to upgrade
+ if _version_cmp( _load($class), $ver ) >= 0; # no need to upgrade
if (
_prompt( "==> A newer version of $class ($ver) is required. Install?",
@@ -632,7 +670,7 @@ sub _load {
# Load CPAN.pm and it's configuration
sub _load_cpan {
- return if $CPAN::VERSION;
+ return if $CPAN::VERSION and $CPAN::Config and not @_;
require CPAN;
if ( $CPAN::HandleConfig::VERSION ) {
# Newer versions of CPAN have a HandleConfig module
@@ -644,9 +682,11 @@ sub _load_cpan {
}
# compare two versions, either use Sort::Versions or plain comparison
-sub _version_check {
+# return values same as <=>
+sub _version_cmp {
my ( $cur, $min ) = @_;
- return unless defined $cur;
+ return -1 unless defined $cur; # if 0 keep comparing
+ return 1 unless $min;
$cur =~ s/\s+$//;
@@ -657,16 +697,13 @@ sub _version_check {
) {
# use version.pm if it is installed.
- return (
- ( version->new($cur) >= version->new($min) ) ? $cur : undef );
+ return version->new($cur) <=> version->new($min);
}
elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) )
{
# use Sort::Versions as the sorting algorithm for a.b.c versions
- return ( ( Sort::Versions::versioncmp( $cur, $min ) != -1 )
- ? $cur
- : undef );
+ return Sort::Versions::versioncmp( $cur, $min );
}
warn "Cannot reliably compare non-decimal formatted versions.\n"
@@ -675,7 +712,7 @@ sub _version_check {
# plain comparison
local $^W = 0; # shuts off 'not numeric' bugs
- return ( $cur >= $min ? $cur : undef );
+ return $cur <=> $min;
}
# nothing; this usage is deprecated.
@@ -706,7 +743,7 @@ sub _make_args {
if $Config;
$PostambleActions = (
- $missing
+ ($missing and not $UnderCPAN)
? "\$(PERL) $0 --config=$config --installdeps=$missing"
: "\$(NOECHO) \$(NOOP)"
);
@@ -746,7 +783,7 @@ sub Write {
sub postamble {
$PostambleUsed = 1;
- return << ".";
+ return <<"END_MAKE";
config :: installdeps
\t\$(NOECHO) \$(NOOP)
@@ -757,7 +794,7 @@ checkdeps ::
installdeps ::
\t$PostambleActions
-.
+END_MAKE
}
@@ -765,4 +802,4 @@ installdeps ::
__END__
-#line 1003
+#line 1056
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 87bed66..51eda5d 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -17,12 +17,10 @@ package Module::Install;
# 3. The ./inc/ version of Module::Install loads
# }
-BEGIN {
- require 5.004;
-}
+use 5.005;
use strict 'vars';
-use vars qw{$VERSION};
+use vars qw{$VERSION $MAIN};
BEGIN {
# All Module::Install core packages now require synchronised versions.
# This will be used to ensure we don't accidentally load old or
@@ -30,7 +28,10 @@ BEGIN {
# 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.76';
+ $VERSION = '0.91';
+
+ # Storage for the pseudo-singleton
+ $MAIN = undef;
*inc::Module::Install::VERSION = *VERSION;
@inc::Module::Install::ISA = __PACKAGE__;
@@ -69,15 +70,26 @@ END_DIE
# again. This is bad. Rather than taking action to touch it (which
# is unreliable on some platforms and requires write permissions)
# for now we should catch this and refuse to run.
-if ( -f $0 and (stat($0))[9] > time ) { die <<"END_DIE" }
+if ( -f $0 ) {
+ my $s = (stat($0))[9];
+
+ # If the modification time is only slightly in the future,
+ # sleep briefly to remove the problem.
+ my $a = $s - time;
+ if ( $a > 0 and $a < 5 ) { sleep 5 }
+
+ # Too far in the future, throw an error.
+ my $t = time;
+ if ( $s > $t ) { die <<"END_DIE" }
-Your installer $0 has a modification time in the future.
+Your installer $0 has a modification time in the future ($s > $t).
This is known to create infinite loops in make.
Please correct this, then run $0 again.
END_DIE
+}
@@ -121,12 +133,22 @@ sub autoload {
$sym->{$cwd} = sub {
my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) {
- # delegate back to parent dirs
+ # Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
}
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
+ my $method = $1;
+ if ( uc($method) eq $method ) {
+ # Do nothing
+ return;
+ } elsif ( $method =~ /^_/ and $self->can($method) ) {
+ # Dispatch to the root M:I class
+ return $self->$method(@_);
+ }
+
+ # Dispatch to the appropriate plugin
unshift @_, ( $self, $1 );
- goto &{$self->can('call')} unless uc($1) eq $1;
+ goto &{$self->can('call')};
};
}
@@ -151,6 +173,9 @@ sub import {
delete $INC{"$self->{file}"};
delete $INC{"$self->{path}.pm"};
+ # Save to the singleton
+ $MAIN = $self;
+
return 1;
}
@@ -164,8 +189,7 @@ sub preload {
my @exts = @{$self->{extensions}};
unless ( @exts ) {
- my $admin = $self->{admin};
- @exts = $admin->load_all_extensions;
+ @exts = $self->{admin}->load_all_extensions;
}
my %seen;
@@ -248,7 +272,7 @@ END_DIE
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};
}
@@ -312,7 +336,7 @@ sub find_extensions {
#####################################################################
-# Utility Functions
+# Common Utility Functions
sub _caller {
my $depth = 0;
@@ -326,28 +350,70 @@ sub _caller {
sub _read {
local *FH;
- open FH, "< $_[0]" or die "open($_[0]): $!";
- my $str = do { local $/; <FH> };
+ if ( $] >= 5.006 ) {
+ open( FH, '<', $_[0] ) or die "open($_[0]): $!";
+ } else {
+ open( FH, "< $_[0]" ) or die "open($_[0]): $!";
+ }
+ my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!";
- return $str;
+ return $string;
+}
+
+sub _readperl {
+ my $string = Module::Install::_read($_[0]);
+ $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
+ $string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s;
+ $string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg;
+ return $string;
+}
+
+sub _readpod {
+ my $string = Module::Install::_read($_[0]);
+ $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
+ return $string if $_[0] =~ /\.pod\z/;
+ $string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg;
+ $string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg;
+ $string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg;
+ $string =~ s/^\n+//s;
+ return $string;
}
sub _write {
local *FH;
- open FH, "> $_[0]" or die "open($_[0]): $!";
- foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!" }
+ if ( $] >= 5.006 ) {
+ open( FH, '>', $_[0] ) or die "open($_[0]): $!";
+ } else {
+ open( FH, "> $_[0]" ) or die "open($_[0]): $!";
+ }
+ foreach ( 1 .. $#_ ) {
+ print FH $_[$_] or die "print($_[0]): $!";
+ }
close FH or die "close($_[0]): $!";
}
+# _version is for processing module versions (eg, 1.03_05) not
+# Perl versions (eg, 5.8.1).
sub _version ($) {
my $s = shift || 0;
- $s =~ s/^(\d+)\.?//;
+ my $d =()= $s =~ /(\.)/g;
+ if ( $d >= 2 ) {
+ # Normalise multipart versions
+ $s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
+ }
+ $s =~ s/^(\d+)\.?//;
my $l = $1 || 0;
- my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g;
- $l = $l . '.' . join '', @v if @v;
+ my @v = map {
+ $_ . '0' x (3 - length $_)
+ } $s =~ /(\d{1,3})\D?/g;
+ $l = $l . '.' . join '', @v if @v;
return $l + 0;
}
+sub _cmp ($$) {
+ _version($_[0]) <=> _version($_[1]);
+}
+
# Cloned from Params::Util::_CLASS
sub _CLASS ($) {
(
@@ -355,10 +421,10 @@ sub _CLASS ($) {
and
! ref $_[0]
and
- $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*$/s
+ $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s
) ? $_[0] : undef;
}
1;
-# Copyright 2008 Adam Kennedy.
+# Copyright 2008 - 2009 Adam Kennedy.
diff --git a/inc/Module/Install/AutoInstall.pm b/inc/Module/Install/AutoInstall.pm
index c893556..58dd026 100644
--- a/inc/Module/Install/AutoInstall.pm
+++ b/inc/Module/Install/AutoInstall.pm
@@ -2,13 +2,13 @@
package Module::Install::AutoInstall;
use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.76';
+ $VERSION = '0.91';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
- @ISA = qw{Module::Install::Base};
}
sub AutoInstall { $_[0] }
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index 76b32f8..60a74d2 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -1,7 +1,11 @@
#line 1
package Module::Install::Base;
-$VERSION = '0.76';
+use strict 'vars';
+use vars qw{$VERSION};
+BEGIN {
+ $VERSION = '0.91';
+}
# Suspend handler for "redefined" warnings
BEGIN {
@@ -9,54 +13,56 @@ BEGIN {
$SIG{__WARN__} = sub { $w };
}
-### This is the ONLY module that shouldn't have strict on
-# use strict;
-
-#line 41
+#line 42
sub new {
- my ($class, %args) = @_;
-
- foreach my $method ( qw(call load) ) {
- *{"$class\::$method"} = sub {
- shift()->_top->$method(@_);
- } unless defined &{"$class\::$method"};
- }
-
- bless( \%args, $class );
+ my $class = shift;
+ unless ( defined &{"${class}::call"} ) {
+ *{"${class}::call"} = sub { shift->_top->call(@_) };
+ }
+ unless ( defined &{"${class}::load"} ) {
+ *{"${class}::load"} = sub { shift->_top->load(@_) };
+ }
+ bless { @_ }, $class;
}
#line 61
sub AUTOLOAD {
- my $self = shift;
- local $@;
- my $autoload = eval { $self->_top->autoload } or return;
- goto &$autoload;
+ local $@;
+ my $func = eval { shift->_top->autoload } or return;
+ goto &$func;
}
-#line 76
+#line 75
-sub _top { $_[0]->{_top} }
+sub _top {
+ $_[0]->{_top};
+}
-#line 89
+#line 90
sub admin {
- $_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new;
+ $_[0]->_top->{admin}
+ or
+ Module::Install::Base::FakeAdmin->new;
}
-#line 101
+#line 106
sub is_admin {
- $_[0]->admin->VERSION;
+ $_[0]->admin->VERSION;
}
sub DESTROY {}
package Module::Install::Base::FakeAdmin;
-my $Fake;
-sub new { $Fake ||= bless(\@_, $_[0]) }
+my $fake;
+
+sub new {
+ $fake ||= bless(\@_, $_[0]);
+}
sub AUTOLOAD {}
@@ -69,4 +75,4 @@ BEGIN {
1;
-#line 146
+#line 154
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index dd9a81c..e65e4f6 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -2,18 +2,16 @@
package Module::Install::Can;
use strict;
-use Module::Install::Base;
-use Config ();
-### This adds a 5.005 Perl version dependency.
-### This is a bug and will be fixed.
-use File::Spec ();
-use ExtUtils::MakeMaker ();
-
-use vars qw{$VERSION $ISCORE @ISA};
+use Config ();
+use File::Spec ();
+use ExtUtils::MakeMaker ();
+use Module::Install::Base ();
+
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.76';
+ $VERSION = '0.91';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
- @ISA = qw{Module::Install::Base};
}
# check if we can load some module
@@ -39,6 +37,7 @@ sub can_run {
return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
+ next if $dir eq '';
my $abs = File::Spec->catfile($dir, $_[1]);
return $abs if (-x $abs or $abs = MM->maybe_command($abs));
}
@@ -79,4 +78,4 @@ if ( $^O eq 'cygwin' ) {
__END__
-#line 157
+#line 156
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index 58df9ff..05f2079 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -2,24 +2,24 @@
package Module::Install::Fetch;
use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.76';
+ $VERSION = '0.91';
+ @ISA = 'Module::Install::Base';
$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;
}
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index 8bbadee..7e792e0 100644
--- a/inc/Module/Install/Include.pm
+++ b/inc/Module/Install/Include.pm
@@ -2,13 +2,13 @@
package Module::Install::Include;
use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.76';
+ $VERSION = '0.91';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
- @ISA = qw{Module::Install::Base};
}
sub include {
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 05af6ef..98779db 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -2,14 +2,14 @@
package Module::Install::Makefile;
use strict 'vars';
-use Module::Install::Base;
-use ExtUtils::MakeMaker ();
+use ExtUtils::MakeMaker ();
+use Module::Install::Base ();
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.76';
+ $VERSION = '0.91';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
- @ISA = qw{Module::Install::Base};
}
sub Makefile { $_[0] }
@@ -64,7 +64,7 @@ sub clean_files {
my $self = shift;
my $clean = $self->makemaker_args->{clean} ||= {};
%$clean = (
- %$clean,
+ %$clean,
FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_),
);
}
@@ -73,7 +73,7 @@ sub realclean_files {
my $self = shift;
my $realclean = $self->makemaker_args->{realclean} ||= {};
%$realclean = (
- %$realclean,
+ %$realclean,
FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_),
);
}
@@ -114,17 +114,32 @@ sub write {
my $self = shift;
die "&Makefile->write() takes no arguments\n" if @_;
- # Make sure we have a new enough
- require ExtUtils::MakeMaker;
+ # Check the current Perl version
+ my $perl_version = $self->perl_version;
+ if ( $perl_version ) {
+ eval "use $perl_version; 1"
+ or die "ERROR: perl: Version $] is installed, "
+ . "but we need version >= $perl_version";
+ }
- # MakeMaker can complain about module versions that include
- # an underscore, even though its own version may contain one!
- # Hence the funny regexp to get rid of it. See RT #35800
- # for details.
+ # Make sure we have a new enough MakeMaker
+ require ExtUtils::MakeMaker;
- $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
+ if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
+ # MakeMaker can complain about module versions that include
+ # an underscore, even though its own version may contain one!
+ # Hence the funny regexp to get rid of it. See RT #35800
+ # for details.
+ $self->build_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
+ $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
+ } else {
+ # Allow legacy-compatibility with 5.005 by depending on the
+ # most recent EU:MM that supported 5.005.
+ $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 );
+ $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 );
+ }
- # Generate the
+ # Generate the MakeMaker params
my $args = $self->makemaker_args;
$args->{DISTNAME} = $self->name;
$args->{NAME} = $self->module_name || $self->name;
@@ -133,7 +148,7 @@ sub write {
if ( $self->tests ) {
$args->{test} = { TESTS => $self->tests };
}
- if ($] >= 5.005) {
+ if ( $] >= 5.005 ) {
$args->{ABSTRACT} = $self->abstract;
$args->{AUTHOR} = $self->author;
}
@@ -147,7 +162,7 @@ sub write {
delete $args->{SIGN};
}
- # merge both kinds of requires into prereq_pm
+ # Merge both kinds of requires into prereq_pm
my $prereq = ($args->{PREREQ_PM} ||= {});
%$prereq = ( %$prereq,
map { @$_ }
@@ -181,7 +196,9 @@ sub write {
my $user_preop = delete $args{dist}->{PREOP};
if (my $preop = $self->admin->preop($user_preop)) {
- $args{dist} = $preop;
+ foreach my $key ( keys %$preop ) {
+ $args{dist}->{$key} = $preop->{$key};
+ }
}
my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
@@ -194,7 +211,7 @@ sub fix_up_makefile {
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
: '';
@@ -248,4 +265,4 @@ sub postamble {
__END__
-#line 377
+#line 394
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index 90175f0..653193d 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -2,15 +2,19 @@
package Module::Install::Metadata;
use strict 'vars';
-use Module::Install::Base;
+use Module::Install::Base ();
-use vars qw{$VERSION $ISCORE @ISA};
+use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.76';
+ $VERSION = '0.91';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
- @ISA = qw{Module::Install::Base};
}
+my @boolean_keys = qw{
+ sign
+};
+
my @scalar_keys = qw{
name
module_name
@@ -37,16 +41,43 @@ my @resource_keys = qw{
repository
};
+my @array_keys = qw{
+ keywords
+};
+
sub Meta { shift }
+sub Meta_BooleanKeys { @boolean_keys }
sub Meta_ScalarKeys { @scalar_keys }
sub Meta_TupleKeys { @tuple_keys }
sub Meta_ResourceKeys { @resource_keys }
+sub Meta_ArrayKeys { @array_keys }
+
+foreach my $key ( @boolean_keys ) {
+ *$key = sub {
+ my $self = shift;
+ if ( defined wantarray and not @_ ) {
+ return $self->{values}->{$key};
+ }
+ $self->{values}->{$key} = ( @_ ? $_[0] : 1 );
+ return $self;
+ };
+}
foreach my $key ( @scalar_keys ) {
*$key = sub {
my $self = shift;
- return $self->{values}{$key} if defined wantarray and !@_;
- $self->{values}{$key} = shift;
+ return $self->{values}->{$key} if defined wantarray and !@_;
+ $self->{values}->{$key} = shift;
+ return $self;
+ };
+}
+
+foreach my $key ( @array_keys ) {
+ *$key = sub {
+ my $self = shift;
+ return $self->{values}->{$key} if defined wantarray and !@_;
+ $self->{values}->{$key} ||= [];
+ push @{$self->{values}->{$key}}, @_;
return $self;
};
}
@@ -55,12 +86,12 @@ foreach my $key ( @resource_keys ) {
*$key = sub {
my $self = shift;
unless ( @_ ) {
- return () unless $self->{values}{resources};
+ return () unless $self->{values}->{resources};
return map { $_->[1] }
grep { $_->[0] eq $key }
- @{ $self->{values}{resources} };
+ @{ $self->{values}->{resources} };
}
- return $self->{values}{resources}{$key} unless @_;
+ return $self->{values}->{resources}->{$key} unless @_;
my $uri = shift or die(
"Did not provide a value to $key()"
);
@@ -69,54 +100,19 @@ foreach my $key ( @resource_keys ) {
};
}
-sub requires {
- my $self = shift;
- while ( @_ ) {
- my $module = shift or last;
- my $version = shift || 0;
- push @{ $self->{values}{requires} }, [ $module, $version ];
- }
- $self->{values}{requires};
-}
-
-sub build_requires {
- my $self = shift;
- while ( @_ ) {
- my $module = shift or last;
- my $version = shift || 0;
- push @{ $self->{values}{build_requires} }, [ $module, $version ];
- }
- $self->{values}{build_requires};
-}
-
-sub configure_requires {
- my $self = shift;
- while ( @_ ) {
- my $module = shift or last;
- my $version = shift || 0;
- push @{ $self->{values}{configure_requires} }, [ $module, $version ];
- }
- $self->{values}{configure_requires};
-}
-
-sub recommends {
- my $self = shift;
- while ( @_ ) {
- my $module = shift or last;
- my $version = shift || 0;
- push @{ $self->{values}{recommends} }, [ $module, $version ];
- }
- $self->{values}{recommends};
-}
-
-sub bundles {
- my $self = shift;
- while ( @_ ) {
- my $module = shift or last;
- my $version = shift || 0;
- push @{ $self->{values}{bundles} }, [ $module, $version ];
- }
- $self->{values}{bundles};
+foreach my $key ( grep { $_ ne "resources" } @tuple_keys) {
+ *$key = sub {
+ my $self = shift;
+ return $self->{values}->{$key} unless @_;
+ my @added;
+ while ( @_ ) {
+ my $module = shift or last;
+ my $version = shift || 0;
+ push @added, [ $module, $version ];
+ }
+ push @{ $self->{values}->{$key} }, @added;
+ return map {@$_} @added;
+ };
}
# Resource handling
@@ -135,29 +131,22 @@ sub resources {
if ( $name eq lc $name and ! $lc_resource{$name} ) {
die("Unsupported reserved lowercase resource '$name'");
}
- $self->{values}{resources} ||= [];
- push @{ $self->{values}{resources} }, [ $name, $value ];
+ $self->{values}->{resources} ||= [];
+ push @{ $self->{values}->{resources} }, [ $name, $value ];
}
- $self->{values}{resources};
+ $self->{values}->{resources};
}
# Aliases for build_requires that will have alternative
# meanings in some future version of META.yml.
-sub test_requires { shift->build_requires(@_) }
-sub install_requires { shift->build_requires(@_) }
+sub test_requires { shift->build_requires(@_) }
+sub install_requires { shift->build_requires(@_) }
# Aliases for installdirs options
-sub install_as_core { $_[0]->installdirs('perl') }
-sub install_as_cpan { $_[0]->installdirs('site') }
-sub install_as_site { $_[0]->installdirs('site') }
-sub install_as_vendor { $_[0]->installdirs('vendor') }
-
-sub sign {
- my $self = shift;
- return $self->{values}{sign} if defined wantarray and ! @_;
- $self->{values}{sign} = ( @_ ? $_[0] : 1 );
- return $self;
-}
+sub install_as_core { $_[0]->installdirs('perl') }
+sub install_as_cpan { $_[0]->installdirs('site') }
+sub install_as_site { $_[0]->installdirs('site') }
+sub install_as_vendor { $_[0]->installdirs('vendor') }
sub dynamic_config {
my $self = shift;
@@ -165,36 +154,60 @@ sub dynamic_config {
warn "You MUST provide an explicit true/false value to dynamic_config\n";
return $self;
}
- $self->{values}{dynamic_config} = $_[0] ? 1 : 0;
+ $self->{values}->{dynamic_config} = $_[0] ? 1 : 0;
return 1;
}
sub perl_version {
my $self = shift;
- return $self->{values}{perl_version} unless @_;
+ return $self->{values}->{perl_version} unless @_;
my $version = shift or die(
"Did not provide a value to perl_version()"
);
- $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;
+
+ $self->{values}->{perl_version} = $version;
}
+#Stolen from M::B
+my %license_urls = (
+ perl => 'http://dev.perl.org/licenses/',
+ apache => 'http://apache.org/licenses/LICENSE-2.0',
+ artistic => 'http://opensource.org/licenses/artistic-license.php',
+ artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php',
+ lgpl => 'http://opensource.org/licenses/lgpl-license.php',
+ lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php',
+ lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html',
+ bsd => 'http://opensource.org/licenses/bsd-license.php',
+ gpl => 'http://opensource.org/licenses/gpl-license.php',
+ gpl2 => 'http://opensource.org/licenses/gpl-2.0.php',
+ gpl3 => 'http://opensource.org/licenses/gpl-3.0.html',
+ mit => 'http://opensource.org/licenses/mit-license.php',
+ mozilla => 'http://opensource.org/licenses/mozilla1.1.php',
+ open_source => undef,
+ unrestricted => undef,
+ restrictive => undef,
+ unknown => undef,
+);
+
sub license {
my $self = shift;
- return $self->{values}{license} unless @_;
+ return $self->{values}->{license} unless @_;
my $license = shift or die(
'Did not provide a value to license()'
);
- $self->{values}{license} = $license;
+ $self->{values}->{license} = $license;
# Automatically fill in license URLs
- if ( $license eq 'perl' ) {
- $self->resources( license => 'http://dev.perl.org/licenses/' );
+ if ( $license_urls{$license} ) {
+ $self->resources( license => $license_urls{$license} );
}
return 1;
@@ -213,6 +226,9 @@ sub all_from {
die("all_from cannot find $file from $name");
}
}
+ unless ( -f $file ) {
+ die("The path '$file' does not exist, or is not a file");
+ }
# Some methods pull from POD instead of code.
# If there is a matching .pod, use that instead
@@ -233,7 +249,7 @@ sub all_from {
sub provides {
my $self = shift;
- my $provides = ( $self->{values}{provides} ||= {} );
+ my $provides = ( $self->{values}->{provides} ||= {} );
%$provides = (%$provides, @_) if @_;
return $provides;
}
@@ -262,7 +278,7 @@ sub auto_provides {
sub feature {
my $self = shift;
my $name = shift;
- my $features = ( $self->{values}{features} ||= [] );
+ my $features = ( $self->{values}->{features} ||= [] );
my $mods;
if ( @_ == 1 and ref( $_[0] ) ) {
@@ -290,16 +306,16 @@ sub features {
while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) {
$self->feature( $name, @$mods );
}
- return $self->{values}{features}
- ? @{ $self->{values}{features} }
+ return $self->{values}->{features}
+ ? @{ $self->{values}->{features} }
: ();
}
sub no_index {
my $self = shift;
my $type = shift;
- push @{ $self->{values}{no_index}{$type} }, @_ if $type;
- return $self->{values}{no_index};
+ push @{ $self->{values}->{no_index}->{$type} }, @_ if $type;
+ return $self->{values}->{no_index};
}
sub read {
@@ -423,24 +439,25 @@ sub license_from {
/ixms ) {
my $license_text = $1;
my @phrases = (
- 'under the same (?:terms|license) as perl itself' => 'perl', 1,
- 'GNU public license' => 'gpl', 1,
- 'GNU lesser public license' => 'lgpl', 1,
- 'BSD license' => 'bsd', 1,
- 'Artistic license' => 'artistic', 1,
- 'GPL' => 'gpl', 1,
- 'LGPL' => 'lgpl', 1,
- 'BSD' => 'bsd', 1,
- 'Artistic' => 'artistic', 1,
- 'MIT' => 'mit', 1,
- 'proprietary' => 'proprietary', 0,
+ 'under the same (?:terms|license) as (?:perl|the perl programming language) itself' => 'perl', 1,
+ 'GNU general public license' => 'gpl', 1,
+ 'GNU public license' => 'gpl', 1,
+ 'GNU lesser general public license' => 'lgpl', 1,
+ 'GNU lesser public license' => 'lgpl', 1,
+ 'GNU library general public license' => 'lgpl', 1,
+ 'GNU library public license' => 'lgpl', 1,
+ 'BSD license' => 'bsd', 1,
+ 'Artistic license' => 'artistic', 1,
+ 'GPL' => 'gpl', 1,
+ 'LGPL' => 'lgpl', 1,
+ 'BSD' => 'bsd', 1,
+ 'Artistic' => 'artistic', 1,
+ 'MIT' => 'mit', 1,
+ 'proprietary' => 'proprietary', 0,
);
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;
}
@@ -451,10 +468,18 @@ sub license_from {
return 'unknown';
}
+sub _extract_bugtracker {
+ my @links = $_[0] =~ m#L<(\Qhttp://rt.cpan.org/\E[^>]+)>#g;
+ my %links;
+ @links{@links}=();
+ @links=keys %links;
+ return @links;
+}
+
sub bugtracker_from {
my $self = shift;
my $content = Module::Install::_read($_[0]);
- my @links = $content =~ m/L\<(http\:\/\/rt\.cpan\.org\/[^>]+)\>/g;
+ my @links = _extract_bugtracker($content);
unless ( @links ) {
warn "Cannot determine bugtracker info from $_[0]\n";
return 0;
@@ -469,19 +494,131 @@ sub bugtracker_from {
return 1;
}
-sub install_script {
+sub requires_from {
+ my $self = shift;
+ my $content = Module::Install::_readperl($_[0]);
+ my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
+ while ( @requires ) {
+ my $module = shift @requires;
+ my $version = shift @requires;
+ $self->requires( $module => $version );
+ }
+}
+
+sub test_requires_from {
+ my $self = shift;
+ my $content = Module::Install::_readperl($_[0]);
+ my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
+ while ( @requires ) {
+ my $module = shift @requires;
+ my $version = shift @requires;
+ $self->test_requires( $module => $version );
+ }
+}
+
+# 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) ) {
+ # Numify
+ $v = $v + 0;
+ }
+ return $v;
+}
+
+
+
+
+
+######################################################################
+# MYMETA Support
+
+sub WriteMyMeta {
+ die "WriteMyMeta has been deprecated";
+}
+
+sub write_mymeta_yaml {
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 '$_'");
+
+ # We need YAML::Tiny to write the MYMETA.yml file
+ unless ( eval { require YAML::Tiny; 1; } ) {
+ return 1;
+ }
+
+ # Generate the data
+ my $meta = $self->_write_mymeta_data or return 1;
+
+ # Save as the MYMETA.yml file
+ print "Writing MYMETA.yml\n";
+ YAML::Tiny::DumpFile('MYMETA.yml', $meta);
+}
+
+sub write_mymeta_json {
+ my $self = shift;
+
+ # We need JSON to write the MYMETA.json file
+ unless ( eval { require JSON; 1; } ) {
+ return 1;
+ }
+
+ # Generate the data
+ my $meta = $self->_write_mymeta_data or return 1;
+
+ # Save as the MYMETA.yml file
+ print "Writing MYMETA.json\n";
+ Module::Install::_write(
+ 'MYMETA.json',
+ JSON->new->pretty(1)->canonical->encode($meta),
+ );
+}
+
+sub _write_mymeta_data {
+ my $self = shift;
+
+ # If there's no existing META.yml there is nothing we can do
+ return undef unless -f 'META.yml';
+
+ # We need Parse::CPAN::Meta to load the file
+ unless ( eval { require Parse::CPAN::Meta; 1; } ) {
+ return undef;
+ }
+
+ # 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
+ my @yaml = Parse::CPAN::Meta::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} } };
}
+
+ return $meta;
}
1;
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index f890074..f2f99df 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -2,12 +2,12 @@
package Module::Install::Win32;
use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.76';
- @ISA = qw{Module::Install::Base};
+ $VERSION = '0.91';
+ @ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index a50d31e..12471e5 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -2,11 +2,11 @@
package Module::Install::WriteAll;
use strict;
-use Module::Install::Base;
+use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.76';
+ $VERSION = '0.91';;
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
@@ -22,7 +22,6 @@ sub WriteAll {
);
$self->sign(1) if $args{sign};
- $self->Meta->write if $args{meta};
$self->admin->WriteAll(%args) if $self->is_admin;
$self->check_nmake if $args{check_nmake};
@@ -30,11 +29,32 @@ sub WriteAll {
$self->makemaker_args( PL_FILES => {} );
}
+ # Until ExtUtils::MakeMaker support MYMETA.yml, make sure
+ # we clean it up properly ourself.
+ $self->realclean_files('MYMETA.yml');
+
if ( $args{inline} ) {
$self->Inline->write;
} else {
$self->Makefile->write;
}
+
+ # The Makefile write process adds a couple of dependencies,
+ # so write the META.yml files after the Makefile.
+ if ( $args{meta} ) {
+ $self->Meta->write;
+ }
+
+ # Experimental support for MYMETA
+ if ( $ENV{X_MYMETA} ) {
+ if ( $ENV{X_MYMETA} eq 'JSON' ) {
+ $self->Meta->write_mymeta_json;
+ } else {
+ $self->Meta->write_mymeta_yaml;
+ }
+ }
+
+ return 1;
}
1;
diff --git a/inc/PerlIO.pm b/inc/PerlIO.pm
index b036a2b..19c4a47 100644
--- a/inc/PerlIO.pm
+++ b/inc/PerlIO.pm
@@ -30,4 +30,4 @@ sub F_UTF8 () { 0x8000 }
1;
__END__
-#line 340
+#line 344
diff --git a/inc/Test/Builder.pm b/inc/Test/Builder.pm
index bdf80c6..795361f 100644
--- a/inc/Test/Builder.pm
+++ b/inc/Test/Builder.pm
@@ -3,19 +3,27 @@ package Test::Builder;
use 5.006;
use strict;
+use warnings;
+
+our $VERSION = '0.94';
+$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
+
+BEGIN {
+ if( $] < 5.008 ) {
+ require Test::Builder::IO::Scalar;
+ }
+}
-our $VERSION = '0.80';
-$VERSION = eval { $VERSION }; # make the alpha version come out as a number
# Make Test::Builder thread-safe for ithreads.
BEGIN {
use Config;
# Load threads::shared when threads are turned on.
# 5.8.0's threads are so busted we no longer support them.
- if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'}) {
+ if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'} ) {
require threads::shared;
- # Hack around YET ANOTHER threads::shared bug. It would
+ # Hack around YET ANOTHER threads::shared bug. It would
# occassionally forget the contents of the variable when sharing it.
# So we first copy the data, then share, then put our copy back.
*share = sub (\[$@%]) {
@@ -23,31 +31,31 @@ BEGIN {
my $data;
if( $type eq 'HASH' ) {
- %$data = %{$_[0]};
+ %$data = %{ $_[0] };
}
elsif( $type eq 'ARRAY' ) {
- @$data = @{$_[0]};
+ @$data = @{ $_[0] };
}
elsif( $type eq 'SCALAR' ) {
- $$data = ${$_[0]};
+ $$data = ${ $_[0] };
}
else {
- die("Unknown type: ".$type);
+ die( "Unknown type: " . $type );
}
- $_[0] = &threads::shared::share($_[0]);
+ $_[0] = &threads::shared::share( $_[0] );
if( $type eq 'HASH' ) {
- %{$_[0]} = %$data;
+ %{ $_[0] } = %$data;
}
elsif( $type eq 'ARRAY' ) {
- @{$_[0]} = @$data;
+ @{ $_[0] } = @$data;
}
elsif( $type eq 'SCALAR' ) {
- ${$_[0]} = $$data;
+ ${ $_[0] } = $$data;
}
else {
- die("Unknown type: ".$type);
+ die( "Unknown type: " . $type );
}
return $_[0];
@@ -61,18 +69,17 @@ BEGIN {
}
}
+#line 117
-#line 110
+our $Test = Test::Builder->new;
-my $Test = Test::Builder->new;
sub new {
my($class) = shift;
$Test ||= $class->create;
return $Test;
}
-
-#line 132
+#line 139
sub create {
my $class = shift;
@@ -83,140 +90,341 @@ sub create {
return $self;
}
-#line 151
+#line 168
+
+sub child {
+ my( $self, $name ) = @_;
+
+ if( $self->{Child_Name} ) {
+ $self->croak("You already have a child named ($self->{Child_Name}) running");
+ }
+
+ my $child = bless {}, ref $self;
+ $child->reset;
+
+ # Add to our indentation
+ $child->_indent( $self->_indent . ' ' );
+ $child->{$_} = $self->{$_} foreach qw{Out_FH Todo_FH Fail_FH};
+
+ # This will be reset in finalize. We do this here lest one child failure
+ # cause all children to fail.
+ $child->{Child_Error} = $?;
+ $? = 0;
+ $child->{Parent} = $self;
+ $child->{Name} = $name || "Child of " . $self->name;
+ $self->{Child_Name} = $child->name;
+ return $child;
+}
+
+
+#line 201
+
+sub subtest {
+ my $self = shift;
+ my($name, $subtests) = @_;
+
+ if ('CODE' ne ref $subtests) {
+ $self->croak("subtest()'s second argument must be a code ref");
+ }
+
+ # Turn the child into the parent so anyone who has stored a copy of
+ # the Test::Builder singleton will get the child.
+ my $child = $self->child($name);
+ my %parent = %$self;
+ %$self = %$child;
+
+ my $error;
+ if( !eval { $subtests->(); 1 } ) {
+ $error = $@;
+ }
+
+ # Restore the parent and the copied child.
+ %$child = %$self;
+ %$self = %parent;
+
+ # Die *after* we restore the parent.
+ die $error if $error and !eval { $error->isa('Test::Builder::Exception') };
+
+ return $child->finalize;
+}
+
+
+#line 250
+
+sub finalize {
+ my $self = shift;
+
+ return unless $self->parent;
+ if( $self->{Child_Name} ) {
+ $self->croak("Can't call finalize() with child ($self->{Child_Name}) active");
+ }
+ $self->_ending;
+
+ # XXX This will only be necessary for TAP envelopes (we think)
+ #$self->_print( $self->is_passing ? "PASS\n" : "FAIL\n" );
+
+ my $ok = 1;
+ $self->parent->{Child_Name} = undef;
+ if ( $self->{Skip_All} ) {
+ $self->parent->skip($self->{Skip_All});
+ }
+ elsif ( not @{ $self->{Test_Results} } ) {
+ $self->parent->ok( 0, sprintf q[No tests run for subtest "%s"], $self->name );
+ }
+ else {
+ $self->parent->ok( $self->is_passing, $self->name );
+ }
+ $? = $self->{Child_Error};
+ delete $self->{Parent};
+
+ return $self->is_passing;
+}
+
+sub _indent {
+ my $self = shift;
+
+ if( @_ ) {
+ $self->{Indent} = shift;
+ }
+
+ return $self->{Indent};
+}
+
+#line 300
+
+sub parent { shift->{Parent} }
-use vars qw($Level);
+#line 312
-sub reset {
- my ($self) = @_;
+sub name { shift->{Name} }
+
+sub DESTROY {
+ my $self = shift;
+ if ( $self->parent ) {
+ my $name = $self->name;
+ $self->diag(<<"FAIL");
+Child ($name) exited without calling finalize()
+FAIL
+ $self->parent->{In_Destroy} = 1;
+ $self->parent->ok(0, $name);
+ }
+}
+
+#line 336
+
+our $Level;
+
+sub reset { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
+ my($self) = @_;
# We leave this a global because it has to be localized and localizing
# hash keys is just asking for pain. Also, it was documented.
$Level = 1;
+ $self->{Name} = $0;
+ $self->is_passing(1);
+ $self->{Ending} = 0;
$self->{Have_Plan} = 0;
$self->{No_Plan} = 0;
+ $self->{Have_Output_Plan} = 0;
+
$self->{Original_Pid} = $$;
+ $self->{Child_Name} = undef;
+ $self->{Indent} ||= '';
- share($self->{Curr_Test});
- $self->{Curr_Test} = 0;
- $self->{Test_Results} = &share([]);
+ share( $self->{Curr_Test} );
+ $self->{Curr_Test} = 0;
+ $self->{Test_Results} = &share( [] );
$self->{Exported_To} = undef;
$self->{Expected_Tests} = 0;
- $self->{Skip_All} = 0;
+ $self->{Skip_All} = 0;
- $self->{Use_Nums} = 1;
+ $self->{Use_Nums} = 1;
- $self->{No_Header} = 0;
- $self->{No_Ending} = 0;
+ $self->{No_Header} = 0;
+ $self->{No_Ending} = 0;
- $self->{TODO} = undef;
+ $self->{Todo} = undef;
+ $self->{Todo_Stack} = [];
+ $self->{Start_Todo} = 0;
+ $self->{Opened_Testhandles} = 0;
- $self->_dup_stdhandles unless $^C;
+ $self->_dup_stdhandles;
return;
}
-#line 207
+#line 414
+
+my %plan_cmds = (
+ no_plan => \&no_plan,
+ skip_all => \&skip_all,
+ tests => \&_plan_tests,
+);
sub plan {
- my($self, $cmd, $arg) = @_;
+ my( $self, $cmd, $arg ) = @_;
return unless $cmd;
local $Level = $Level + 1;
- if( $self->{Have_Plan} ) {
- $self->croak("You tried to plan twice");
- }
+ $self->croak("You tried to plan twice") if $self->{Have_Plan};
- if( $cmd eq 'no_plan' ) {
- $self->no_plan;
- }
- elsif( $cmd eq 'skip_all' ) {
- return $self->skip_all($arg);
- }
- elsif( $cmd eq 'tests' ) {
- if( $arg ) {
- local $Level = $Level + 1;
- return $self->expected_tests($arg);
- }
- elsif( !defined $arg ) {
- $self->croak("Got an undefined number of tests");
- }
- elsif( !$arg ) {
- $self->croak("You said to run 0 tests");
- }
+ if( my $method = $plan_cmds{$cmd} ) {
+ local $Level = $Level + 1;
+ $self->$method($arg);
}
else {
- my @args = grep { defined } ($cmd, $arg);
+ my @args = grep { defined } ( $cmd, $arg );
$self->croak("plan() doesn't understand @args");
}
return 1;
}
-#line 254
+
+sub _plan_tests {
+ my($self, $arg) = @_;
+
+ if($arg) {
+ local $Level = $Level + 1;
+ return $self->expected_tests($arg);
+ }
+ elsif( !defined $arg ) {
+ $self->croak("Got an undefined number of tests");
+ }
+ else {
+ $self->croak("You said to run 0 tests");
+ }
+
+ return;
+}
+
+
+#line 470
sub expected_tests {
my $self = shift;
my($max) = @_;
- if( @_ ) {
+ if(@_) {
$self->croak("Number of tests must be a positive integer. You gave it '$max'")
- unless $max =~ /^\+?\d+$/ and $max > 0;
+ unless $max =~ /^\+?\d+$/;
$self->{Expected_Tests} = $max;
$self->{Have_Plan} = 1;
- $self->_print("1..$max\n") unless $self->no_header;
+ $self->_output_plan($max) unless $self->no_header;
}
return $self->{Expected_Tests};
}
-
-#line 279
+#line 494
sub no_plan {
- my $self = shift;
+ my($self, $arg) = @_;
+
+ $self->carp("no_plan takes no arguments") if $arg;
$self->{No_Plan} = 1;
$self->{Have_Plan} = 1;
+
+ return 1;
}
-#line 294
+
+#line 528
+
+sub _output_plan {
+ my($self, $max, $directive, $reason) = @_;
+
+ $self->carp("The plan was already output") if $self->{Have_Output_Plan};
+
+ my $plan = "1..$max";
+ $plan .= " # $directive" if defined $directive;
+ $plan .= " $reason" if defined $reason;
+
+ $self->_print("$plan\n");
+
+ $self->{Have_Output_Plan} = 1;
+
+ return;
+}
+
+#line 579
+
+sub done_testing {
+ my($self, $num_tests) = @_;
+
+ # If done_testing() specified the number of tests, shut off no_plan.
+ if( defined $num_tests ) {
+ $self->{No_Plan} = 0;
+ }
+ else {
+ $num_tests = $self->current_test;
+ }
+
+ if( $self->{Done_Testing} ) {
+ my($file, $line) = @{$self->{Done_Testing}}[1,2];
+ $self->ok(0, "done_testing() was already called at $file line $line");
+ return;
+ }
+
+ $self->{Done_Testing} = [caller];
+
+ if( $self->expected_tests && $num_tests != $self->expected_tests ) {
+ $self->ok(0, "planned to run @{[ $self->expected_tests ]} ".
+ "but done_testing() expects $num_tests");
+ }
+ else {
+ $self->{Expected_Tests} = $num_tests;
+ }
+
+ $self->_output_plan($num_tests) unless $self->{Have_Output_Plan};
+
+ $self->{Have_Plan} = 1;
+
+ # The wrong number of tests were run
+ $self->is_passing(0) if $self->{Expected_Tests} != $self->{Curr_Test};
+
+ # No tests were run
+ $self->is_passing(0) if $self->{Curr_Test} == 0;
+
+ return 1;
+}
+
+
+#line 630
sub has_plan {
my $self = shift;
- return($self->{Expected_Tests}) if $self->{Expected_Tests};
+ return( $self->{Expected_Tests} ) if $self->{Expected_Tests};
return('no_plan') if $self->{No_Plan};
return(undef);
-};
-
+}
-#line 312
+#line 647
sub skip_all {
- my($self, $reason) = @_;
-
- my $out = "1..0";
- $out .= " # Skip $reason" if $reason;
- $out .= "\n";
+ my( $self, $reason ) = @_;
- $self->{Skip_All} = 1;
+ $self->{Skip_All} = $self->parent ? $reason : 1;
- $self->_print($out) unless $self->no_header;
+ $self->_output_plan(0, "SKIP", $reason) unless $self->no_header;
+ if ( $self->parent ) {
+ die bless {} => 'Test::Builder::Exception';
+ }
exit(0);
}
-
-#line 339
+#line 672
sub exported_to {
- my($self, $pack) = @_;
+ my( $self, $pack ) = @_;
if( defined $pack ) {
$self->{Exported_To} = $pack;
@@ -224,42 +432,45 @@ sub exported_to {
return $self->{Exported_To};
}
-#line 369
+#line 702
sub ok {
- my($self, $test, $name) = @_;
+ my( $self, $test, $name ) = @_;
+ if ( $self->{Child_Name} and not $self->{In_Destroy} ) {
+ $name = 'unnamed test' unless defined $name;
+ $self->is_passing(0);
+ $self->croak("Cannot run test ($name) with active children");
+ }
# $test might contain an object which we don't want to accidentally
# store, so we turn it into a boolean.
$test = $test ? 1 : 0;
- $self->_plan_check;
-
lock $self->{Curr_Test};
$self->{Curr_Test}++;
# In case $name is a string overloaded object, force it to stringify.
- $self->_unoverload_str(\$name);
+ $self->_unoverload_str( \$name );
- $self->diag(<<ERR) if defined $name and $name =~ /^[\d\s]+$/;
+ $self->diag(<<"ERR") if defined $name and $name =~ /^[\d\s]+$/;
You named your test '$name'. You shouldn't use numbers for your test names.
Very confusing.
ERR
- my $todo = $self->todo();
-
# Capture the value of $TODO for the rest of this ok() call
# so it can more easily be found by other routines.
- local $self->{TODO} = $todo;
+ my $todo = $self->todo();
+ my $in_todo = $self->in_todo;
+ local $self->{Todo} = $todo if $in_todo;
- $self->_unoverload_str(\$todo);
+ $self->_unoverload_str( \$todo );
my $out;
- my $result = &share({});
+ my $result = &share( {} );
- unless( $test ) {
+ unless($test) {
$out .= "not ";
- @$result{ 'ok', 'actual_ok' } = ( ( $todo ? 1 : 0 ), 0 );
+ @$result{ 'ok', 'actual_ok' } = ( ( $self->in_todo ? 1 : 0 ), 0 );
}
else {
@$result{ 'ok', 'actual_ok' } = ( 1, $test );
@@ -269,16 +480,16 @@ ERR
$out .= " $self->{Curr_Test}" if $self->use_numbers;
if( defined $name ) {
- $name =~ s|#|\\#|g; # # in a name can confuse Test::Harness.
- $out .= " - $name";
+ $name =~ s|#|\\#|g; # # in a name can confuse Test::Harness.
+ $out .= " - $name";
$result->{name} = $name;
}
else {
$result->{name} = '';
}
- if( $todo ) {
- $out .= " # TODO $todo";
+ if( $self->in_todo ) {
+ $out .= " # TODO $todo";
$result->{reason} = $todo;
$result->{type} = 'todo';
}
@@ -287,16 +498,16 @@ ERR
$result->{type} = '';
}
- $self->{Test_Results}[$self->{Curr_Test}-1] = $result;
+ $self->{Test_Results}[ $self->{Curr_Test} - 1 ] = $result;
$out .= "\n";
$self->_print($out);
- unless( $test ) {
- my $msg = $todo ? "Failed (TODO)" : "Failed";
- $self->_print_diag("\n") if $ENV{HARNESS_ACTIVE};
+ unless($test) {
+ my $msg = $self->in_todo ? "Failed (TODO)" : "Failed";
+ $self->_print_to_fh( $self->_diag_fh, "\n" ) if $ENV{HARNESS_ACTIVE};
- my(undef, $file, $line) = $self->caller;
+ my( undef, $file, $line ) = $self->caller;
if( defined $name ) {
$self->diag(qq[ $msg test '$name'\n]);
$self->diag(qq[ at $file line $line.\n]);
@@ -304,244 +515,289 @@ ERR
else {
$self->diag(qq[ $msg test at $file line $line.\n]);
}
- }
+ }
+
+ $self->is_passing(0) unless $test || $self->in_todo;
+
+ # Check that we haven't violated the plan
+ $self->_check_is_passing_plan();
return $test ? 1 : 0;
}
+# Check that we haven't yet violated the plan and set
+# is_passing() accordingly
+sub _check_is_passing_plan {
+ my $self = shift;
+
+ my $plan = $self->has_plan;
+ return unless defined $plan; # no plan yet defined
+ return unless $plan !~ /\D/; # no numeric plan
+ $self->is_passing(0) if $plan < $self->{Curr_Test};
+}
+
+
sub _unoverload {
- my $self = shift;
- my $type = shift;
+ my $self = shift;
+ my $type = shift;
- $self->_try(sub { require overload } ) || return;
+ $self->_try(sub { require overload; }, die_on_fail => 1);
foreach my $thing (@_) {
if( $self->_is_object($$thing) ) {
- if( my $string_meth = overload::Method($$thing, $type) ) {
+ if( my $string_meth = overload::Method( $$thing, $type ) ) {
$$thing = $$thing->$string_meth();
}
}
}
-}
+ return;
+}
sub _is_object {
- my($self, $thing) = @_;
+ my( $self, $thing ) = @_;
- return $self->_try(sub { ref $thing && $thing->isa('UNIVERSAL') }) ? 1 : 0;
+ return $self->_try( sub { ref $thing && $thing->isa('UNIVERSAL') } ) ? 1 : 0;
}
-
sub _unoverload_str {
my $self = shift;
- $self->_unoverload(q[""], @_);
-}
+ return $self->_unoverload( q[""], @_ );
+}
sub _unoverload_num {
my $self = shift;
- $self->_unoverload('0+', @_);
+ $self->_unoverload( '0+', @_ );
for my $val (@_) {
next unless $self->_is_dualvar($$val);
- $$val = $$val+0;
+ $$val = $$val + 0;
}
-}
+ return;
+}
# This is a hack to detect a dualvar such as $!
sub _is_dualvar {
- my($self, $val) = @_;
-
- local $^W = 0;
- my $numval = $val+0;
- return 1 if $numval != 0 and $numval ne $val;
-}
+ my( $self, $val ) = @_;
+ # Objects are not dualvars.
+ return 0 if ref $val;
+ no warnings 'numeric';
+ my $numval = $val + 0;
+ return $numval != 0 and $numval ne $val ? 1 : 0;
+}
-#line 521
+#line 876
sub is_eq {
- my($self, $got, $expect, $name) = @_;
+ my( $self, $got, $expect, $name ) = @_;
local $Level = $Level + 1;
- $self->_unoverload_str(\$got, \$expect);
+ $self->_unoverload_str( \$got, \$expect );
if( !defined $got || !defined $expect ) {
# undef only matches undef and nothing else
my $test = !defined $got && !defined $expect;
- $self->ok($test, $name);
- $self->_is_diag($got, 'eq', $expect) unless $test;
+ $self->ok( $test, $name );
+ $self->_is_diag( $got, 'eq', $expect ) unless $test;
return $test;
}
- return $self->cmp_ok($got, 'eq', $expect, $name);
+ return $self->cmp_ok( $got, 'eq', $expect, $name );
}
sub is_num {
- my($self, $got, $expect, $name) = @_;
+ my( $self, $got, $expect, $name ) = @_;
local $Level = $Level + 1;
- $self->_unoverload_num(\$got, \$expect);
+ $self->_unoverload_num( \$got, \$expect );
if( !defined $got || !defined $expect ) {
# undef only matches undef and nothing else
my $test = !defined $got && !defined $expect;
- $self->ok($test, $name);
- $self->_is_diag($got, '==', $expect) unless $test;
+ $self->ok( $test, $name );
+ $self->_is_diag( $got, '==', $expect ) unless $test;
return $test;
}
- return $self->cmp_ok($got, '==', $expect, $name);
+ return $self->cmp_ok( $got, '==', $expect, $name );
}
-sub _is_diag {
- my($self, $got, $type, $expect) = @_;
+sub _diag_fmt {
+ my( $self, $type, $val ) = @_;
- foreach my $val (\$got, \$expect) {
- if( defined $$val ) {
- if( $type eq 'eq' ) {
- # quote and force string context
- $$val = "'$$val'"
- }
- else {
- # force numeric context
- $self->_unoverload_num($val);
- }
+ if( defined $$val ) {
+ if( $type eq 'eq' or $type eq 'ne' ) {
+ # quote and force string context
+ $$val = "'$$val'";
}
else {
- $$val = 'undef';
+ # force numeric context
+ $self->_unoverload_num($val);
}
}
+ else {
+ $$val = 'undef';
+ }
+
+ return;
+}
+
+sub _is_diag {
+ my( $self, $got, $type, $expect ) = @_;
+
+ $self->_diag_fmt( $type, $_ ) for \$got, \$expect;
local $Level = $Level + 1;
- return $self->diag(sprintf <<DIAGNOSTIC, $got, $expect);
- got: %s
- expected: %s
+ return $self->diag(<<"DIAGNOSTIC");
+ got: $got
+ expected: $expect
DIAGNOSTIC
-}
+}
+
+sub _isnt_diag {
+ my( $self, $got, $type ) = @_;
+
+ $self->_diag_fmt( $type, \$got );
+
+ local $Level = $Level + 1;
+ return $self->diag(<<"DIAGNOSTIC");
+ got: $got
+ expected: anything else
+DIAGNOSTIC
+}
-#line 600
+#line 973
sub isnt_eq {
- my($self, $got, $dont_expect, $name) = @_;
+ my( $self, $got, $dont_expect, $name ) = @_;
local $Level = $Level + 1;
if( !defined $got || !defined $dont_expect ) {
# undef only matches undef and nothing else
my $test = defined $got || defined $dont_expect;
- $self->ok($test, $name);
- $self->_cmp_diag($got, 'ne', $dont_expect) unless $test;
+ $self->ok( $test, $name );
+ $self->_isnt_diag( $got, 'ne' ) unless $test;
return $test;
}
- return $self->cmp_ok($got, 'ne', $dont_expect, $name);
+ return $self->cmp_ok( $got, 'ne', $dont_expect, $name );
}
sub isnt_num {
- my($self, $got, $dont_expect, $name) = @_;
+ my( $self, $got, $dont_expect, $name ) = @_;
local $Level = $Level + 1;
if( !defined $got || !defined $dont_expect ) {
# undef only matches undef and nothing else
my $test = defined $got || defined $dont_expect;
- $self->ok($test, $name);
- $self->_cmp_diag($got, '!=', $dont_expect) unless $test;
+ $self->ok( $test, $name );
+ $self->_isnt_diag( $got, '!=' ) unless $test;
return $test;
}
- return $self->cmp_ok($got, '!=', $dont_expect, $name);
+ return $self->cmp_ok( $got, '!=', $dont_expect, $name );
}
-
-#line 652
+#line 1022
sub like {
- my($self, $this, $regex, $name) = @_;
+ my( $self, $this, $regex, $name ) = @_;
local $Level = $Level + 1;
- $self->_regex_ok($this, $regex, '=~', $name);
+ return $self->_regex_ok( $this, $regex, '=~', $name );
}
sub unlike {
- my($self, $this, $regex, $name) = @_;
+ my( $self, $this, $regex, $name ) = @_;
local $Level = $Level + 1;
- $self->_regex_ok($this, $regex, '!~', $name);
+ return $self->_regex_ok( $this, $regex, '!~', $name );
}
+#line 1046
-#line 677
-
-
-my %numeric_cmps = map { ($_, 1) }
- ("<", "<=", ">", ">=", "==", "!=", "<=>");
+my %numeric_cmps = map { ( $_, 1 ) } ( "<", "<=", ">", ">=", "==", "!=", "<=>" );
sub cmp_ok {
- my($self, $got, $type, $expect, $name) = @_;
-
- # Treat overloaded objects as numbers if we're asked to do a
- # numeric comparison.
- my $unoverload = $numeric_cmps{$type} ? '_unoverload_num'
- : '_unoverload_str';
-
- $self->$unoverload(\$got, \$expect);
-
+ my( $self, $got, $type, $expect, $name ) = @_;
my $test;
+ my $error;
{
- local($@,$!,$SIG{__DIE__}); # isolate eval
+ ## no critic (BuiltinFunctions::ProhibitStringyEval)
- my $code = $self->_caller_context;
+ local( $@, $!, $SIG{__DIE__} ); # isolate eval
- # Yes, it has to look like this or 5.4.5 won't see the #line
- # directive.
- # Don't ask me, man, I just work here.
- $test = eval "
-$code" . "\$got $type \$expect;";
+ my($pack, $file, $line) = $self->caller();
+ $test = eval qq[
+#line 1 "cmp_ok [from $file line $line]"
+\$got $type \$expect;
+];
+ $error = $@;
}
local $Level = $Level + 1;
- my $ok = $self->ok($test, $name);
+ my $ok = $self->ok( $test, $name );
+
+ # Treat overloaded objects as numbers if we're asked to do a
+ # numeric comparison.
+ my $unoverload
+ = $numeric_cmps{$type}
+ ? '_unoverload_num'
+ : '_unoverload_str';
+
+ $self->diag(<<"END") if $error;
+An error occurred while using $type:
+------------------------------------
+$error
+------------------------------------
+END
+
+ unless($ok) {
+ $self->$unoverload( \$got, \$expect );
- unless( $ok ) {
if( $type =~ /^(eq|==)$/ ) {
- $self->_is_diag($got, $type, $expect);
+ $self->_is_diag( $got, $type, $expect );
+ }
+ elsif( $type =~ /^(ne|!=)$/ ) {
+ $self->_isnt_diag( $got, $type );
}
else {
- $self->_cmp_diag($got, $type, $expect);
+ $self->_cmp_diag( $got, $type, $expect );
}
}
return $ok;
}
sub _cmp_diag {
- my($self, $got, $type, $expect) = @_;
-
+ my( $self, $got, $type, $expect ) = @_;
+
$got = defined $got ? "'$got'" : 'undef';
$expect = defined $expect ? "'$expect'" : 'undef';
-
+
local $Level = $Level + 1;
- return $self->diag(sprintf <<DIAGNOSTIC, $got, $type, $expect);
- %s
- %s
- %s
+ return $self->diag(<<"DIAGNOSTIC");
+ $got
+ $type
+ $expect
DIAGNOSTIC
}
-
sub _caller_context {
my $self = shift;
- my($pack, $file, $line) = $self->caller(1);
+ my( $pack, $file, $line ) = $self->caller(1);
my $code = '';
$code .= "#line $line $file\n" if defined $file and defined $line;
@@ -549,101 +805,100 @@ sub _caller_context {
return $code;
}
-#line 766
+#line 1145
sub BAIL_OUT {
- my($self, $reason) = @_;
+ my( $self, $reason ) = @_;
$self->{Bailed_Out} = 1;
$self->_print("Bail out! $reason");
exit 255;
}
-#line 779
-
-*BAILOUT = \&BAIL_OUT;
+#line 1158
+{
+ no warnings 'once';
+ *BAILOUT = \&BAIL_OUT;
+}
-#line 791
+#line 1172
sub skip {
- my($self, $why) = @_;
+ my( $self, $why ) = @_;
$why ||= '';
- $self->_unoverload_str(\$why);
+ $self->_unoverload_str( \$why );
- $self->_plan_check;
-
- lock($self->{Curr_Test});
+ lock( $self->{Curr_Test} );
$self->{Curr_Test}++;
- $self->{Test_Results}[$self->{Curr_Test}-1] = &share({
- 'ok' => 1,
- actual_ok => 1,
- name => '',
- type => 'skip',
- reason => $why,
- });
+ $self->{Test_Results}[ $self->{Curr_Test} - 1 ] = &share(
+ {
+ 'ok' => 1,
+ actual_ok => 1,
+ name => '',
+ type => 'skip',
+ reason => $why,
+ }
+ );
my $out = "ok";
- $out .= " $self->{Curr_Test}" if $self->use_numbers;
- $out .= " # skip";
- $out .= " $why" if length $why;
- $out .= "\n";
+ $out .= " $self->{Curr_Test}" if $self->use_numbers;
+ $out .= " # skip";
+ $out .= " $why" if length $why;
+ $out .= "\n";
$self->_print($out);
return 1;
}
-
-#line 833
+#line 1213
sub todo_skip {
- my($self, $why) = @_;
+ my( $self, $why ) = @_;
$why ||= '';
- $self->_plan_check;
-
- lock($self->{Curr_Test});
+ lock( $self->{Curr_Test} );
$self->{Curr_Test}++;
- $self->{Test_Results}[$self->{Curr_Test}-1] = &share({
- 'ok' => 1,
- actual_ok => 0,
- name => '',
- type => 'todo_skip',
- reason => $why,
- });
+ $self->{Test_Results}[ $self->{Curr_Test} - 1 ] = &share(
+ {
+ 'ok' => 1,
+ actual_ok => 0,
+ name => '',
+ type => 'todo_skip',
+ reason => $why,
+ }
+ );
my $out = "not ok";
- $out .= " $self->{Curr_Test}" if $self->use_numbers;
- $out .= " # TODO & SKIP $why\n";
+ $out .= " $self->{Curr_Test}" if $self->use_numbers;
+ $out .= " # TODO & SKIP $why\n";
$self->_print($out);
return 1;
}
-
-#line 911
-
+#line 1293
sub maybe_regex {
- my ($self, $regex) = @_;
+ my( $self, $regex ) = @_;
my $usable_regex = undef;
return $usable_regex unless defined $regex;
- my($re, $opts);
+ my( $re, $opts );
# Check for qr/foo/
if( _is_qr($regex) ) {
$usable_regex = $regex;
}
# Check for '/foo/' or 'm,foo,'
- elsif( ($re, $opts) = $regex =~ m{^ /(.*)/ (\w*) $ }sx or
- (undef, $re, $opts) = $regex =~ m,^ m([^\w\s]) (.+) \1 (\w*) $,sx
- )
+ elsif(( $re, $opts ) = $regex =~ m{^ /(.*)/ (\w*) $ }sx or
+ ( undef, $re, $opts ) = $regex =~ m,^ m([^\w\s]) (.+) \1 (\w*) $,sx
+ )
{
$usable_regex = length $opts ? "(?$opts)$re" : $re;
}
@@ -651,39 +906,36 @@ sub maybe_regex {
return $usable_regex;
}
-
sub _is_qr {
my $regex = shift;
-
+
# is_regexp() checks for regexes in a robust manner, say if they're
# blessed.
return re::is_regexp($regex) if defined &re::is_regexp;
return ref $regex eq 'Regexp';
}
-
sub _regex_ok {
- my($self, $this, $regex, $cmp, $name) = @_;
+ my( $self, $this, $regex, $cmp, $name ) = @_;
- my $ok = 0;
+ my $ok = 0;
my $usable_regex = $self->maybe_regex($regex);
- unless (defined $usable_regex) {
+ unless( defined $usable_regex ) {
+ local $Level = $Level + 1;
$ok = $self->ok( 0, $name );
$self->diag(" '$regex' doesn't look much like a regex to me.");
return $ok;
}
{
+ ## no critic (BuiltinFunctions::ProhibitStringyEval)
+
my $test;
- my $code = $self->_caller_context;
+ my $context = $self->_caller_context;
- local($@, $!, $SIG{__DIE__}); # isolate eval
+ local( $@, $!, $SIG{__DIE__} ); # isolate eval
- # Yes, it has to look like this or 5.4.5 won't see the #line
- # directive.
- # Don't ask me, man, I just work here.
- $test = eval "
-$code" . q{$test = $this =~ /$usable_regex/ ? 1 : 0};
+ $test = eval $context . q{$test = $this =~ /$usable_regex/ ? 1 : 0};
$test = !$test if $cmp eq '!~';
@@ -691,12 +943,12 @@ $code" . q{$test = $this =~ /$usable_regex/ ? 1 : 0};
$ok = $self->ok( $test, $name );
}
- unless( $ok ) {
+ unless($ok) {
$this = defined $this ? "'$this'" : 'undef';
my $match = $cmp eq '=~' ? "doesn't match" : "matches";
local $Level = $Level + 1;
- $self->diag(sprintf <<DIAGNOSTIC, $this, $match, $regex);
+ $self->diag( sprintf <<'DIAGNOSTIC', $this, $match, $regex );
%s
%13s '%s'
DIAGNOSTIC
@@ -706,43 +958,47 @@ DIAGNOSTIC
return $ok;
}
-
# I'm not ready to publish this. It doesn't deal with array return
# values from the code or context.
-#line 1009
+#line 1389
sub _try {
- my($self, $code) = @_;
-
- local $!; # eval can mess up $!
- local $@; # don't set $@ in the test
- local $SIG{__DIE__}; # don't trip an outside DIE handler.
- my $return = eval { $code->() };
-
- return wantarray ? ($return, $@) : $return;
+ my( $self, $code, %opts ) = @_;
+
+ my $error;
+ my $return;
+ {
+ local $!; # eval can mess up $!
+ local $@; # don't set $@ in the test
+ local $SIG{__DIE__}; # don't trip an outside DIE handler.
+ $return = eval { $code->() };
+ $error = $@;
+ }
+
+ die $error if $error and $opts{die_on_fail};
+
+ return wantarray ? ( $return, $error ) : $return;
}
-#line 1031
+#line 1418
sub is_fh {
- my $self = shift;
+ my $self = shift;
my $maybe_fh = shift;
return 0 unless defined $maybe_fh;
- return 1 if ref $maybe_fh eq 'GLOB'; # its a glob ref
- return 1 if ref \$maybe_fh eq 'GLOB'; # its a glob
+ return 1 if ref $maybe_fh eq 'GLOB'; # its a glob ref
+ return 1 if ref \$maybe_fh eq 'GLOB'; # its a glob
return eval { $maybe_fh->isa("IO::Handle") } ||
- # 5.5.4's tied() and can() doesn't like getting undef
- eval { (tied($maybe_fh) || '')->can('TIEHANDLE') };
+ eval { tied($maybe_fh)->can('TIEHANDLE') };
}
-
-#line 1076
+#line 1461
sub level {
- my($self, $level) = @_;
+ my( $self, $level ) = @_;
if( defined $level ) {
$Level = $level;
@@ -750,11 +1006,10 @@ sub level {
return $Level;
}
-
-#line 1109
+#line 1493
sub use_numbers {
- my($self, $use_nums) = @_;
+ my( $self, $use_nums ) = @_;
if( defined $use_nums ) {
$self->{Use_Nums} = $use_nums;
@@ -762,14 +1017,13 @@ sub use_numbers {
return $self->{Use_Nums};
}
-
-#line 1143
+#line 1526
foreach my $attribute (qw(No_Header No_Ending No_Diag)) {
my $method = lc $attribute;
my $code = sub {
- my($self, $no) = @_;
+ my( $self, $no ) = @_;
if( defined $no ) {
$self->{$attribute} = $no;
@@ -777,15 +1031,35 @@ foreach my $attribute (qw(No_Header No_Ending No_Diag)) {
return $self->{$attribute};
};
- no strict 'refs'; ## no critic
- *{__PACKAGE__.'::'.$method} = $code;
+ no strict 'refs'; ## no critic
+ *{ __PACKAGE__ . '::' . $method } = $code;
}
-
-#line 1197
+#line 1579
sub diag {
- my($self, @msgs) = @_;
+ my $self = shift;
+
+ $self->_print_comment( $self->_diag_fh, @_ );
+}
+
+#line 1594
+
+sub note {
+ my $self = shift;
+
+ $self->_print_comment( $self->output, @_ );
+}
+
+sub _diag_fh {
+ my $self = shift;
+
+ local $Level = $Level + 1;
+ return $self->in_todo ? $self->todo_output : $self->failure_output;
+}
+
+sub _print_comment {
+ my( $self, $fh, @msgs ) = @_;
return if $self->no_diag;
return unless @msgs;
@@ -797,22 +1071,43 @@ sub diag {
# Convert undef to 'undef' so its readable.
my $msg = join '', map { defined($_) ? $_ : 'undef' } @msgs;
- # Escape each line with a #.
- $msg =~ s/^/# /gm;
-
- # Stick a newline on the end if it needs it.
- $msg .= "\n" unless $msg =~ /\n\Z/;
+ # Escape the beginning, _print will take care of the rest.
+ $msg =~ s/^/# /;
local $Level = $Level + 1;
- $self->_print_diag($msg);
+ $self->_print_to_fh( $fh, $msg );
return 0;
}
-#line 1234
+#line 1644
+
+sub explain {
+ my $self = shift;
+
+ return map {
+ ref $_
+ ? do {
+ $self->_try(sub { require Data::Dumper }, die_on_fail => 1);
+
+ my $dumper = Data::Dumper->new( [$_] );
+ $dumper->Indent(1)->Terse(1);
+ $dumper->Sortkeys(1) if $dumper->can("Sortkeys");
+ $dumper->Dump;
+ }
+ : $_
+ } @_;
+}
+
+#line 1673
sub _print {
- my($self, @msgs) = @_;
+ my $self = shift;
+ return $self->_print_to_fh( $self->output, @_ );
+}
+
+sub _print_to_fh {
+ my( $self, $fh, @msgs ) = @_;
# Prevent printing headers when only compiling. Mostly for when
# tests are deparsed with B::Deparse
@@ -820,33 +1115,22 @@ sub _print {
my $msg = join '', @msgs;
- local($\, $", $,) = (undef, ' ', '');
- my $fh = $self->output;
+ local( $\, $", $, ) = ( undef, ' ', '' );
# Escape each line after the first with a # so we don't
# confuse Test::Harness.
- $msg =~ s/\n(.)/\n# $1/sg;
+ $msg =~ s{\n(?!\z)}{\n# }sg;
# Stick a newline on the end if it needs it.
- $msg .= "\n" unless $msg =~ /\n\Z/;
+ $msg .= "\n" unless $msg =~ /\n\z/;
- print $fh $msg;
+ return print $fh $self->_indent, $msg;
}
-#line 1268
-
-sub _print_diag {
- my $self = shift;
-
- local($\, $", $,) = (undef, ' ', '');
- my $fh = $self->todo ? $self->todo_output : $self->failure_output;
- print $fh @_;
-}
-
-#line 1305
+#line 1732
sub output {
- my($self, $fh) = @_;
+ my( $self, $fh ) = @_;
if( defined $fh ) {
$self->{Out_FH} = $self->_new_fh($fh);
@@ -855,7 +1139,7 @@ sub output {
}
sub failure_output {
- my($self, $fh) = @_;
+ my( $self, $fh ) = @_;
if( defined $fh ) {
$self->{Fail_FH} = $self->_new_fh($fh);
@@ -864,7 +1148,7 @@ sub failure_output {
}
sub todo_output {
- my($self, $fh) = @_;
+ my( $self, $fh ) = @_;
if( defined $fh ) {
$self->{Todo_FH} = $self->_new_fh($fh);
@@ -872,7 +1156,6 @@ sub todo_output {
return $self->{Todo_FH};
}
-
sub _new_fh {
my $self = shift;
my($file_or_fh) = shift;
@@ -881,25 +1164,38 @@ sub _new_fh {
if( $self->is_fh($file_or_fh) ) {
$fh = $file_or_fh;
}
+ elsif( ref $file_or_fh eq 'SCALAR' ) {
+ # Scalar refs as filehandles was added in 5.8.
+ if( $] >= 5.008 ) {
+ open $fh, ">>", $file_or_fh
+ or $self->croak("Can't open scalar ref $file_or_fh: $!");
+ }
+ # Emulate scalar ref filehandles with a tie.
+ else {
+ $fh = Test::Builder::IO::Scalar->new($file_or_fh)
+ or $self->croak("Can't tie scalar ref $file_or_fh");
+ }
+ }
else {
- open $fh, ">", $file_or_fh or
- $self->croak("Can't open test output log $file_or_fh: $!");
+ open $fh, ">", $file_or_fh
+ or $self->croak("Can't open test output log $file_or_fh: $!");
_autoflush($fh);
}
return $fh;
}
-
sub _autoflush {
my($fh) = shift;
my $old_fh = select $fh;
$| = 1;
select $old_fh;
+
+ return;
}
+my( $Testout, $Testerr );
-my($Testout, $Testerr);
sub _dup_stdhandles {
my $self = shift;
@@ -908,99 +1204,104 @@ sub _dup_stdhandles {
# Set everything to unbuffered else plain prints to STDOUT will
# come out in the wrong order from our own prints.
_autoflush($Testout);
- _autoflush(\*STDOUT);
+ _autoflush( \*STDOUT );
_autoflush($Testerr);
- _autoflush(\*STDERR);
+ _autoflush( \*STDERR );
- $self->output ($Testout);
- $self->failure_output($Testerr);
- $self->todo_output ($Testout);
-}
+ $self->reset_outputs;
+ return;
+}
-my $Opened_Testhandles = 0;
sub _open_testhandles {
my $self = shift;
-
- return if $Opened_Testhandles;
-
+
+ return if $self->{Opened_Testhandles};
+
# We dup STDOUT and STDERR so people can change them in their
# test suites while still getting normal test output.
- open( $Testout, ">&STDOUT") or die "Can't dup STDOUT: $!";
- open( $Testerr, ">&STDERR") or die "Can't dup STDERR: $!";
+ open( $Testout, ">&STDOUT" ) or die "Can't dup STDOUT: $!";
+ open( $Testerr, ">&STDERR" ) or die "Can't dup STDERR: $!";
-# $self->_copy_io_layers( \*STDOUT, $Testout );
-# $self->_copy_io_layers( \*STDERR, $Testerr );
-
- $Opened_Testhandles = 1;
-}
+ # $self->_copy_io_layers( \*STDOUT, $Testout );
+ # $self->_copy_io_layers( \*STDERR, $Testerr );
+ $self->{Opened_Testhandles} = 1;
+
+ return;
+}
sub _copy_io_layers {
- my($self, $src, $dst) = @_;
-
- $self->_try(sub {
- require PerlIO;
- my @src_layers = PerlIO::get_layers($src);
+ my( $self, $src, $dst ) = @_;
- binmode $dst, join " ", map ":$_", @src_layers if @src_layers;
- });
+ $self->_try(
+ sub {
+ require PerlIO;
+ my @src_layers = PerlIO::get_layers($src);
+
+ binmode $dst, join " ", map ":$_", @src_layers if @src_layers;
+ }
+ );
+
+ return;
}
-#line 1423
+#line 1857
+
+sub reset_outputs {
+ my $self = shift;
+
+ $self->output ($Testout);
+ $self->failure_output($Testerr);
+ $self->todo_output ($Testout);
+
+ return;
+}
+
+#line 1883
sub _message_at_caller {
my $self = shift;
local $Level = $Level + 1;
- my($pack, $file, $line) = $self->caller;
- return join("", @_) . " at $file line $line.\n";
+ my( $pack, $file, $line ) = $self->caller;
+ return join( "", @_ ) . " at $file line $line.\n";
}
sub carp {
my $self = shift;
- warn $self->_message_at_caller(@_);
+ return warn $self->_message_at_caller(@_);
}
sub croak {
my $self = shift;
- die $self->_message_at_caller(@_);
+ return die $self->_message_at_caller(@_);
}
-sub _plan_check {
- my $self = shift;
-
- unless( $self->{Have_Plan} ) {
- local $Level = $Level + 2;
- $self->croak("You tried to run a test without a plan");
- }
-}
-#line 1471
+#line 1923
sub current_test {
- my($self, $num) = @_;
+ my( $self, $num ) = @_;
- lock($self->{Curr_Test});
+ lock( $self->{Curr_Test} );
if( defined $num ) {
- unless( $self->{Have_Plan} ) {
- $self->croak("Can't change the current test number without a plan!");
- }
-
$self->{Curr_Test} = $num;
# If the test counter is being pushed forward fill in the details.
my $test_results = $self->{Test_Results};
if( $num > @$test_results ) {
my $start = @$test_results ? @$test_results : 0;
- for ($start..$num-1) {
- $test_results->[$_] = &share({
- 'ok' => 1,
- actual_ok => undef,
- reason => 'incrementing test number',
- type => 'unknown',
- name => undef
- });
+ for( $start .. $num - 1 ) {
+ $test_results->[$_] = &share(
+ {
+ 'ok' => 1,
+ actual_ok => undef,
+ reason => 'incrementing test number',
+ type => 'unknown',
+ name => undef
+ }
+ );
}
}
# If backward, wipe history. Its their funeral.
@@ -1011,8 +1312,20 @@ sub current_test {
return $self->{Curr_Test};
}
+#line 1971
-#line 1516
+sub is_passing {
+ my $self = shift;
+
+ if( @_ ) {
+ $self->{Is_Passing} = shift;
+ }
+
+ return $self->{Is_Passing};
+}
+
+
+#line 1993
sub summary {
my($self) = shift;
@@ -1020,90 +1333,159 @@ sub summary {
return map { $_->{'ok'} } @{ $self->{Test_Results} };
}
-#line 1571
+#line 2048
sub details {
my $self = shift;
return @{ $self->{Test_Results} };
}
-#line 1597
+#line 2077
sub todo {
- my($self, $pack) = @_;
+ my( $self, $pack ) = @_;
+
+ return $self->{Todo} if defined $self->{Todo};
+
+ local $Level = $Level + 1;
+ my $todo = $self->find_TODO($pack);
+ return $todo if defined $todo;
- return $self->{TODO} if defined $self->{TODO};
+ return '';
+}
+
+#line 2099
+
+sub find_TODO {
+ my( $self, $pack ) = @_;
$pack = $pack || $self->caller(1) || $self->exported_to;
- return 0 unless $pack;
+ return unless $pack;
- no strict 'refs'; ## no critic
- return defined ${$pack.'::TODO'} ? ${$pack.'::TODO'}
- : 0;
+ no strict 'refs'; ## no critic
+ return ${ $pack . '::TODO' };
}
-#line 1622
+#line 2117
+
+sub in_todo {
+ my $self = shift;
-sub caller {
- my($self, $height) = @_;
+ local $Level = $Level + 1;
+ return( defined $self->{Todo} || $self->find_TODO ) ? 1 : 0;
+}
+
+#line 2167
+
+sub todo_start {
+ my $self = shift;
+ my $message = @_ ? shift : '';
+
+ $self->{Start_Todo}++;
+ if( $self->in_todo ) {
+ push @{ $self->{Todo_Stack} } => $self->todo;
+ }
+ $self->{Todo} = $message;
+
+ return;
+}
+
+#line 2189
+
+sub todo_end {
+ my $self = shift;
+
+ if( !$self->{Start_Todo} ) {
+ $self->croak('todo_end() called without todo_start()');
+ }
+
+ $self->{Start_Todo}--;
+
+ if( $self->{Start_Todo} && @{ $self->{Todo_Stack} } ) {
+ $self->{Todo} = pop @{ $self->{Todo_Stack} };
+ }
+ else {
+ delete $self->{Todo};
+ }
+
+ return;
+}
+
+#line 2222
+
+sub caller { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
+ my( $self, $height ) = @_;
$height ||= 0;
- my @caller = CORE::caller($self->level + $height + 1);
+ my $level = $self->level + $height + 1;
+ my @caller;
+ do {
+ @caller = CORE::caller( $level );
+ $level--;
+ } until @caller;
return wantarray ? @caller : $caller[0];
}
-#line 1634
+#line 2239
-#line 1648
+#line 2253
#'#
sub _sanity_check {
my $self = shift;
- $self->_whoa($self->{Curr_Test} < 0, 'Says here you ran a negative number of tests!');
- $self->_whoa(!$self->{Have_Plan} and $self->{Curr_Test},
- 'Somehow your tests ran without a plan!');
- $self->_whoa($self->{Curr_Test} != @{ $self->{Test_Results} },
- 'Somehow you got a different number of results than tests ran!');
+ $self->_whoa( $self->{Curr_Test} < 0, 'Says here you ran a negative number of tests!' );
+ $self->_whoa( $self->{Curr_Test} != @{ $self->{Test_Results} },
+ 'Somehow you got a different number of results than tests ran!' );
+
+ return;
}
-#line 1669
+#line 2274
sub _whoa {
- my($self, $check, $desc) = @_;
- if( $check ) {
+ my( $self, $check, $desc ) = @_;
+ if($check) {
local $Level = $Level + 1;
$self->croak(<<"WHOA");
WHOA! $desc
This should never happen! Please contact the author immediately!
WHOA
}
+
+ return;
}
-#line 1691
+#line 2298
sub _my_exit {
- $? = $_[0];
+ $? = $_[0]; ## no critic (Variables::RequireLocalizedPunctuationVars)
return 1;
}
-
-#line 1704
+#line 2310
sub _ending {
my $self = shift;
+ return if $self->no_ending;
+ return if $self->{Ending}++;
my $real_exit_code = $?;
- $self->_sanity_check();
# Don't bother with an ending if this is a forked copy. Only the parent
# should do the ending.
if( $self->{Original_Pid} != $$ ) {
return;
}
-
- # Exit if plan() was never called. This is so "require Test::Simple"
+
+ # Ran tests but never declared a plan or hit done_testing
+ if( !$self->{Have_Plan} and $self->{Curr_Test} ) {
+ $self->is_passing(0);
+ $self->diag("Tests were run but no plan was declared and done_testing() was not seen.");
+ }
+
+ # Exit if plan() was never called. This is so "require Test::Simple"
# doesn't puke.
if( !$self->{Have_Plan} ) {
return;
@@ -1111,46 +1493,40 @@ sub _ending {
# Don't do an ending if we bailed out.
if( $self->{Bailed_Out} ) {
+ $self->is_passing(0);
return;
}
-
# Figure out if we passed or failed and print helpful messages.
my $test_results = $self->{Test_Results};
- if( @$test_results ) {
+ if(@$test_results) {
# The plan? We have no plan.
if( $self->{No_Plan} ) {
- $self->_print("1..$self->{Curr_Test}\n") unless $self->no_header;
+ $self->_output_plan($self->{Curr_Test}) unless $self->no_header;
$self->{Expected_Tests} = $self->{Curr_Test};
}
# Auto-extended arrays and elements which aren't explicitly
# filled in with a shared reference will puke under 5.8.0
# ithreads. So we have to fill them in by hand. :(
- my $empty_result = &share({});
- for my $idx ( 0..$self->{Expected_Tests}-1 ) {
+ my $empty_result = &share( {} );
+ for my $idx ( 0 .. $self->{Expected_Tests} - 1 ) {
$test_results->[$idx] = $empty_result
unless defined $test_results->[$idx];
}
- my $num_failed = grep !$_->{'ok'},
- @{$test_results}[0..$self->{Curr_Test}-1];
+ my $num_failed = grep !$_->{'ok'}, @{$test_results}[ 0 .. $self->{Curr_Test} - 1 ];
my $num_extra = $self->{Curr_Test} - $self->{Expected_Tests};
- if( $num_extra < 0 ) {
- my $s = $self->{Expected_Tests} == 1 ? '' : 's';
- $self->diag(<<"FAIL");
-Looks like you planned $self->{Expected_Tests} test$s but only ran $self->{Curr_Test}.
-FAIL
- }
- elsif( $num_extra > 0 ) {
+ if( $num_extra != 0 ) {
my $s = $self->{Expected_Tests} == 1 ? '' : 's';
$self->diag(<<"FAIL");
-Looks like you planned $self->{Expected_Tests} test$s but ran $num_extra extra.
+Looks like you planned $self->{Expected_Tests} test$s but ran $self->{Curr_Test}.
FAIL
+ $self->is_passing(0);
}
- if ( $num_failed ) {
+ if($num_failed) {
my $num_tests = $self->{Curr_Test};
my $s = $num_failed == 1 ? '' : 's';
@@ -1159,18 +1535,19 @@ FAIL
$self->diag(<<"FAIL");
Looks like you failed $num_failed test$s of $num_tests$qualifier.
FAIL
+ $self->is_passing(0);
}
- if( $real_exit_code ) {
+ if($real_exit_code) {
$self->diag(<<"FAIL");
-Looks like your test died just after $self->{Curr_Test}.
+Looks like your test exited with $real_exit_code just after $self->{Curr_Test}.
FAIL
-
- _my_exit( 255 ) && return;
+ $self->is_passing(0);
+ _my_exit($real_exit_code) && return;
}
my $exit_code;
- if( $num_failed ) {
+ if($num_failed) {
$exit_code = $num_failed <= 254 ? $num_failed : 254;
}
elsif( $num_extra != 0 ) {
@@ -1180,27 +1557,33 @@ FAIL
$exit_code = 0;
}
- _my_exit( $exit_code ) && return;
+ _my_exit($exit_code) && return;
}
- elsif ( $self->{Skip_All} ) {
- _my_exit( 0 ) && return;
+ elsif( $self->{Skip_All} ) {
+ _my_exit(0) && return;
}
- elsif ( $real_exit_code ) {
- $self->diag(<<'FAIL');
-Looks like your test died before it could output anything.
+ elsif($real_exit_code) {
+ $self->diag(<<"FAIL");
+Looks like your test exited with $real_exit_code before it could output anything.
FAIL
- _my_exit( 255 ) && return;
+ $self->is_passing(0);
+ _my_exit($real_exit_code) && return;
}
else {
$self->diag("No tests run!\n");
- _my_exit( 255 ) && return;
+ $self->is_passing(0);
+ _my_exit(255) && return;
}
+
+ $self->is_passing(0);
+ $self->_whoa( 1, "We fell off the end of _ending()" );
}
END {
- $Test->_ending if defined $Test and !$Test->no_ending;
+ $Test->_ending if defined $Test;
}
-#line 1871
+#line 2498
1;
+
diff --git a/inc/Test/Builder/IO/Scalar.pm b/inc/Test/Builder/IO/Scalar.pm
new file mode 100644
index 0000000..ac0e90c
--- /dev/null
+++ b/inc/Test/Builder/IO/Scalar.pm
@@ -0,0 +1,406 @@
+#line 1
+package Test::Builder::IO::Scalar;
+
+
+#line 28
+
+# This is copied code, I don't care.
+##no critic
+
+use Carp;
+use strict;
+use vars qw($VERSION @ISA);
+use IO::Handle;
+
+use 5.005;
+
+### The package version, both in 1.23 style *and* usable by MakeMaker:
+$VERSION = "2.110";
+
+### Inheritance:
+ at ISA = qw(IO::Handle);
+
+#==============================
+
+#line 52
+
+#------------------------------
+
+#line 62
+
+sub new {
+ my $proto = shift;
+ my $class = ref($proto) || $proto;
+ my $self = bless \do { local *FH }, $class;
+ tie *$self, $class, $self;
+ $self->open(@_); ### open on anonymous by default
+ $self;
+}
+sub DESTROY {
+ shift->close;
+}
+
+#------------------------------
+
+#line 87
+
+sub open {
+ my ($self, $sref) = @_;
+
+ ### Sanity:
+ defined($sref) or do {my $s = ''; $sref = \$s};
+ (ref($sref) eq "SCALAR") or croak "open() needs a ref to a scalar";
+
+ ### Setup:
+ *$self->{Pos} = 0; ### seek position
+ *$self->{SR} = $sref; ### scalar reference
+ $self;
+}
+
+#------------------------------
+
+#line 109
+
+sub opened {
+ *{shift()}->{SR};
+}
+
+#------------------------------
+
+#line 123
+
+sub close {
+ my $self = shift;
+ %{*$self} = ();
+ 1;
+}
+
+#line 133
+
+
+
+#==============================
+
+#line 143
+
+
+#------------------------------
+
+#line 153
+
+sub flush { "0 but true" }
+
+#------------------------------
+
+#line 164
+
+sub getc {
+ my $self = shift;
+
+ ### Return undef right away if at EOF; else, move pos forward:
+ return undef if $self->eof;
+ substr(${*$self->{SR}}, *$self->{Pos}++, 1);
+}
+
+#------------------------------
+
+#line 183
+
+sub getline {
+ my $self = shift;
+
+ ### Return undef right away if at EOF:
+ return undef if $self->eof;
+
+ ### Get next line:
+ my $sr = *$self->{SR};
+ my $i = *$self->{Pos}; ### Start matching at this point.
+
+ ### Minimal impact implementation!
+ ### We do the fast fast thing (no regexps) if using the
+ ### classic input record separator.
+
+ ### Case 1: $/ is undef: slurp all...
+ if (!defined($/)) {
+ *$self->{Pos} = length $$sr;
+ return substr($$sr, $i);
+ }
+
+ ### Case 2: $/ is "\n": zoom zoom zoom...
+ elsif ($/ eq "\012") {
+
+ ### Seek ahead for "\n"... yes, this really is faster than regexps.
+ my $len = length($$sr);
+ for (; $i < $len; ++$i) {
+ last if ord (substr ($$sr, $i, 1)) == 10;
+ }
+
+ ### Extract the line:
+ my $line;
+ if ($i < $len) { ### We found a "\n":
+ $line = substr ($$sr, *$self->{Pos}, $i - *$self->{Pos} + 1);
+ *$self->{Pos} = $i+1; ### Remember where we finished up.
+ }
+ else { ### No "\n"; slurp the remainder:
+ $line = substr ($$sr, *$self->{Pos}, $i - *$self->{Pos});
+ *$self->{Pos} = $len;
+ }
+ return $line;
+ }
+
+ ### Case 3: $/ is ref to int. Do fixed-size records.
+ ### (Thanks to Dominique Quatravaux.)
+ elsif (ref($/)) {
+ my $len = length($$sr);
+ my $i = ${$/} + 0;
+ my $line = substr ($$sr, *$self->{Pos}, $i);
+ *$self->{Pos} += $i;
+ *$self->{Pos} = $len if (*$self->{Pos} > $len);
+ return $line;
+ }
+
+ ### Case 4: $/ is either "" (paragraphs) or something weird...
+ ### This is Graham's general-purpose stuff, which might be
+ ### a tad slower than Case 2 for typical data, because
+ ### of the regexps.
+ else {
+ pos($$sr) = $i;
+
+ ### If in paragraph mode, skip leading lines (and update i!):
+ length($/) or
+ (($$sr =~ m/\G\n*/g) and ($i = pos($$sr)));
+
+ ### If we see the separator in the buffer ahead...
+ if (length($/)
+ ? $$sr =~ m,\Q$/\E,g ### (ordinary sep) TBD: precomp!
+ : $$sr =~ m,\n\n,g ### (a paragraph)
+ ) {
+ *$self->{Pos} = pos $$sr;
+ return substr($$sr, $i, *$self->{Pos}-$i);
+ }
+ ### Else if no separator remains, just slurp the rest:
+ else {
+ *$self->{Pos} = length $$sr;
+ return substr($$sr, $i);
+ }
+ }
+}
+
+#------------------------------
+
+#line 273
+
+sub getlines {
+ my $self = shift;
+ wantarray or croak("can't call getlines in scalar context!");
+ my ($line, @lines);
+ push @lines, $line while (defined($line = $self->getline));
+ @lines;
+}
+
+#------------------------------
+
+#line 294
+
+sub print {
+ my $self = shift;
+ *$self->{Pos} = length(${*$self->{SR}} .= join('', @_) . (defined($\) ? $\ : ""));
+ 1;
+}
+sub _unsafe_print {
+ my $self = shift;
+ my $append = join('', @_) . $\;
+ ${*$self->{SR}} .= $append;
+ *$self->{Pos} += length($append);
+ 1;
+}
+sub _old_print {
+ my $self = shift;
+ ${*$self->{SR}} .= join('', @_) . $\;
+ *$self->{Pos} = length(${*$self->{SR}});
+ 1;
+}
+
+
+#------------------------------
+
+#line 324
+
+sub read {
+ my $self = $_[0];
+ my $n = $_[2];
+ my $off = $_[3] || 0;
+
+ my $read = substr(${*$self->{SR}}, *$self->{Pos}, $n);
+ $n = length($read);
+ *$self->{Pos} += $n;
+ ($off ? substr($_[1], $off) : $_[1]) = $read;
+ return $n;
+}
+
+#------------------------------
+
+#line 345
+
+sub write {
+ my $self = $_[0];
+ my $n = $_[2];
+ my $off = $_[3] || 0;
+
+ my $data = substr($_[1], $off, $n);
+ $n = length($data);
+ $self->print($data);
+ return $n;
+}
+
+#------------------------------
+
+#line 366
+
+sub sysread {
+ my $self = shift;
+ $self->read(@_);
+}
+
+#------------------------------
+
+#line 380
+
+sub syswrite {
+ my $self = shift;
+ $self->write(@_);
+}
+
+#line 389
+
+
+#==============================
+
+#line 398
+
+
+#------------------------------
+
+#line 408
+
+sub autoflush {}
+
+#------------------------------
+
+#line 419
+
+sub binmode {}
+
+#------------------------------
+
+#line 429
+
+sub clearerr { 1 }
+
+#------------------------------
+
+#line 439
+
+sub eof {
+ my $self = shift;
+ (*$self->{Pos} >= length(${*$self->{SR}}));
+}
+
+#------------------------------
+
+#line 452
+
+sub seek {
+ my ($self, $pos, $whence) = @_;
+ my $eofpos = length(${*$self->{SR}});
+
+ ### Seek:
+ if ($whence == 0) { *$self->{Pos} = $pos } ### SEEK_SET
+ elsif ($whence == 1) { *$self->{Pos} += $pos } ### SEEK_CUR
+ elsif ($whence == 2) { *$self->{Pos} = $eofpos + $pos} ### SEEK_END
+ else { croak "bad seek whence ($whence)" }
+
+ ### Fixup:
+ if (*$self->{Pos} < 0) { *$self->{Pos} = 0 }
+ if (*$self->{Pos} > $eofpos) { *$self->{Pos} = $eofpos }
+ return 1;
+}
+
+#------------------------------
+
+#line 476
+
+sub sysseek {
+ my $self = shift;
+ $self->seek (@_);
+}
+
+#------------------------------
+
+#line 490
+
+sub tell { *{shift()}->{Pos} }
+
+#------------------------------
+
+#line 503
+
+sub use_RS {
+ my ($self, $yesno) = @_;
+ carp "use_RS is deprecated and ignored; \$/ is always consulted\n";
+ }
+
+#------------------------------
+
+#line 517
+
+sub setpos { shift->seek($_[0],0) }
+
+#------------------------------
+
+#line 528
+
+*getpos = \&tell;
+
+
+#------------------------------
+
+#line 540
+
+sub sref { *{shift()}->{SR} }
+
+
+#------------------------------
+# Tied handle methods...
+#------------------------------
+
+# Conventional tiehandle interface:
+sub TIEHANDLE {
+ ((defined($_[1]) && UNIVERSAL::isa($_[1], __PACKAGE__))
+ ? $_[1]
+ : shift->new(@_));
+}
+sub GETC { shift->getc(@_) }
+sub PRINT { shift->print(@_) }
+sub PRINTF { shift->print(sprintf(shift, @_)) }
+sub READ { shift->read(@_) }
+sub READLINE { wantarray ? shift->getlines(@_) : shift->getline(@_) }
+sub WRITE { shift->write(@_); }
+sub CLOSE { shift->close(@_); }
+sub SEEK { shift->seek(@_); }
+sub TELL { shift->tell(@_); }
+sub EOF { shift->eof(@_); }
+
+#------------------------------------------------------------
+
+1;
+
+__END__
+
+
+
+#line 576
+
+
+#line 657
+
diff --git a/inc/Test/Builder/Module.pm b/inc/Test/Builder/Module.pm
index 2783dad..ffef230 100644
--- a/inc/Test/Builder/Module.pm
+++ b/inc/Test/Builder/Module.pm
@@ -8,23 +8,15 @@ use Test::Builder;
require Exporter;
our @ISA = qw(Exporter);
-our $VERSION = '0.80';
+our $VERSION = '0.94';
+$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
-# 5.004's Exporter doesn't have export_to_level.
-my $_export_to_level = sub {
- my $pkg = shift;
- my $level = shift;
- (undef) = shift; # redundant arg
- my $callpkg = caller($level);
- $pkg->export($callpkg, @_);
-};
-
-#line 82
+#line 74
sub import {
my($class) = shift;
-
+
# Don't run all this when loading ourself.
return 1 if $class eq 'Test::Builder::Module';
@@ -34,27 +26,26 @@ sub import {
$test->exported_to($caller);
- $class->import_extra(\@_);
- my(@imports) = $class->_strip_imports(\@_);
+ $class->import_extra( \@_ );
+ my(@imports) = $class->_strip_imports( \@_ );
$test->plan(@_);
- $class->$_export_to_level(1, $class, @imports);
+ $class->export_to_level( 1, $class, @imports );
}
-
sub _strip_imports {
my $class = shift;
my $list = shift;
my @imports = ();
my @other = ();
- my $idx = 0;
+ my $idx = 0;
while( $idx <= $#{$list} ) {
my $item = $list->[$idx];
if( defined $item and $item eq 'import' ) {
- push @imports, @{$list->[$idx+1]};
+ push @imports, @{ $list->[ $idx + 1 ] };
$idx++;
}
else {
@@ -69,17 +60,14 @@ sub _strip_imports {
return @imports;
}
+#line 137
-#line 147
+sub import_extra { }
-sub import_extra {}
-
-
-#line 178
+#line 167
sub builder {
return Test::Builder->new;
}
-
1;
diff --git a/inc/Test/More.pm b/inc/Test/More.pm
index d2700db..9d41458 100644
--- a/inc/Test/More.pm
+++ b/inc/Test/More.pm
@@ -3,47 +3,49 @@ package Test::More;
use 5.006;
use strict;
+use warnings;
+#---- perlcritic exemptions. ----#
+
+# We use a lot of subroutine prototypes
+## no critic (Subroutines::ProhibitSubroutinePrototypes)
# Can't use Carp because it might cause use_ok() to accidentally succeed
# even though the module being used forgot to use Carp. Yes, this
# actually happened.
sub _carp {
- my($file, $line) = (caller(1))[1,2];
- warn @_, " at $file line $line\n";
+ my( $file, $line ) = ( caller(1) )[ 1, 2 ];
+ return warn @_, " at $file line $line\n";
}
-
-
-use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS $TODO);
-$VERSION = '0.80';
-$VERSION = eval $VERSION; # make the alpha version come out as a number
+our $VERSION = '0.94';
+$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
use Test::Builder::Module;
- at ISA = qw(Test::Builder::Module);
- at EXPORT = qw(ok use_ok require_ok
- is isnt like unlike is_deeply
- cmp_ok
- skip todo todo_skip
- pass fail
- eq_array eq_hash eq_set
- $TODO
- plan
- can_ok isa_ok
- diag
- BAIL_OUT
- );
-
-
-#line 156
+our @ISA = qw(Test::Builder::Module);
+our @EXPORT = qw(ok use_ok require_ok
+ is isnt like unlike is_deeply
+ cmp_ok
+ skip todo todo_skip
+ pass fail
+ eq_array eq_hash eq_set
+ $TODO
+ plan
+ done_testing
+ can_ok isa_ok new_ok
+ diag note explain
+ subtest
+ BAIL_OUT
+);
+
+#line 164
sub plan {
my $tb = Test::More->builder;
- $tb->plan(@_);
+ return $tb->plan(@_);
}
-
# This implements "use Test::More 'no_diag'" but the behavior is
# deprecated.
sub import_extra {
@@ -51,7 +53,7 @@ sub import_extra {
my $list = shift;
my @other = ();
- my $idx = 0;
+ my $idx = 0;
while( $idx <= $#{$list} ) {
my $item = $list->[$idx];
@@ -66,76 +68,80 @@ sub import_extra {
}
@$list = @other;
+
+ return;
}
+#line 217
+
+sub done_testing {
+ my $tb = Test::More->builder;
+ $tb->done_testing(@_);
+}
-#line 256
+#line 289
sub ok ($;$) {
- my($test, $name) = @_;
+ my( $test, $name ) = @_;
my $tb = Test::More->builder;
- $tb->ok($test, $name);
+ return $tb->ok( $test, $name );
}
-#line 323
+#line 367
sub is ($$;$) {
my $tb = Test::More->builder;
- $tb->is_eq(@_);
+ return $tb->is_eq(@_);
}
sub isnt ($$;$) {
my $tb = Test::More->builder;
- $tb->isnt_eq(@_);
+ return $tb->isnt_eq(@_);
}
*isn't = \&isnt;
-
-#line 368
+#line 411
sub like ($$;$) {
my $tb = Test::More->builder;
- $tb->like(@_);
+ return $tb->like(@_);
}
-
-#line 384
+#line 426
sub unlike ($$;$) {
my $tb = Test::More->builder;
- $tb->unlike(@_);
+ return $tb->unlike(@_);
}
-
-#line 424
+#line 471
sub cmp_ok($$$;$) {
my $tb = Test::More->builder;
- $tb->cmp_ok(@_);
+ return $tb->cmp_ok(@_);
}
-
-#line 460
+#line 506
sub can_ok ($@) {
- my($proto, @methods) = @_;
+ my( $proto, @methods ) = @_;
my $class = ref $proto || $proto;
my $tb = Test::More->builder;
- unless( $class ) {
+ unless($class) {
my $ok = $tb->ok( 0, "->can(...)" );
$tb->diag(' can_ok() called with empty class or reference');
return $ok;
}
- unless( @methods ) {
+ unless(@methods) {
my $ok = $tb->ok( 0, "$class->can(...)" );
$tb->diag(' can_ok() called with no methods');
return $ok;
@@ -143,63 +149,69 @@ sub can_ok ($@) {
my @nok = ();
foreach my $method (@methods) {
- $tb->_try(sub { $proto->can($method) }) or push @nok, $method;
+ $tb->_try( sub { $proto->can($method) } ) or push @nok, $method;
}
- my $name;
- $name = @methods == 1 ? "$class->can('$methods[0]')"
- : "$class->can(...)";
+ my $name = (@methods == 1) ? "$class->can('$methods[0]')" :
+ "$class->can(...)" ;
my $ok = $tb->ok( !@nok, $name );
- $tb->diag(map " $class->can('$_') failed\n", @nok);
+ $tb->diag( map " $class->can('$_') failed\n", @nok );
return $ok;
}
-#line 522
+#line 572
sub isa_ok ($$;$) {
- my($object, $class, $obj_name) = @_;
+ my( $object, $class, $obj_name ) = @_;
my $tb = Test::More->builder;
my $diag;
- $obj_name = 'The object' unless defined $obj_name;
- my $name = "$obj_name isa $class";
+
if( !defined $object ) {
+ $obj_name = 'The thing' unless defined $obj_name;
$diag = "$obj_name isn't defined";
}
- elsif( !ref $object ) {
- $diag = "$obj_name isn't a reference";
- }
else {
+ my $whatami = ref $object ? 'object' : 'class';
# We can't use UNIVERSAL::isa because we want to honor isa() overrides
- my($rslt, $error) = $tb->_try(sub { $object->isa($class) });
- if( $error ) {
+ my( $rslt, $error ) = $tb->_try( sub { $object->isa($class) } );
+ if($error) {
if( $error =~ /^Can't call method "isa" on unblessed reference/ ) {
# Its an unblessed reference
- if( !UNIVERSAL::isa($object, $class) ) {
+ $obj_name = 'The reference' unless defined $obj_name;
+ if( !UNIVERSAL::isa( $object, $class ) ) {
my $ref = ref $object;
$diag = "$obj_name isn't a '$class' it's a '$ref'";
}
- } else {
+ }
+ elsif( $error =~ /Can't call method "isa" without a package/ ) {
+ # It's something that can't even be a class
+ $obj_name = 'The thing' unless defined $obj_name;
+ $diag = "$obj_name isn't a class or reference";
+ }
+ else {
die <<WHOA;
-WHOA! I tried to call ->isa on your object and got some weird error.
+WHOA! I tried to call ->isa on your $whatami and got some weird error.
Here's the error.
$error
WHOA
}
}
- elsif( !$rslt ) {
- my $ref = ref $object;
- $diag = "$obj_name isn't a '$class' it's a '$ref'";
+ else {
+ $obj_name = "The $whatami" unless defined $obj_name;
+ if( !$rslt ) {
+ my $ref = ref $object;
+ $diag = "$obj_name isn't a '$class' it's a '$ref'";
+ }
}
}
-
-
+ my $name = "$obj_name isa $class";
my $ok;
- if( $diag ) {
+ if($diag) {
$ok = $tb->ok( 0, $name );
$tb->diag(" $diag\n");
}
@@ -210,27 +222,62 @@ WHOA
return $ok;
}
+#line 651
+
+sub new_ok {
+ my $tb = Test::More->builder;
+ $tb->croak("new_ok() must be given at least a class") unless @_;
+
+ my( $class, $args, $object_name ) = @_;
+
+ $args ||= [];
+ $object_name = "The object" unless defined $object_name;
+
+ my $obj;
+ my( $success, $error ) = $tb->_try( sub { $obj = $class->new(@$args); 1 } );
+ if($success) {
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+ isa_ok $obj, $class, $object_name;
+ }
+ else {
+ $tb->ok( 0, "new() died" );
+ $tb->diag(" Error was: $error");
+ }
+
+ return $obj;
+}
+
+#line 719
-#line 591
+sub subtest($&) {
+ my ($name, $subtests) = @_;
+
+ my $tb = Test::More->builder;
+ return $tb->subtest(@_);
+}
+
+#line 743
sub pass (;$) {
my $tb = Test::More->builder;
- $tb->ok(1, @_);
+
+ return $tb->ok( 1, @_ );
}
sub fail (;$) {
my $tb = Test::More->builder;
- $tb->ok(0, @_);
+
+ return $tb->ok( 0, @_ );
}
-#line 652
+#line 806
sub use_ok ($;@) {
- my($module, @imports) = @_;
+ my( $module, @imports ) = @_;
@imports = () unless @imports;
my $tb = Test::More->builder;
- my($pack,$filename,$line) = caller;
+ my( $pack, $filename, $line ) = caller;
my $code;
if( @imports == 1 and $imports[0] =~ /^\d+(?:\.\d+)?$/ ) {
@@ -250,11 +297,10 @@ use $module \@{\$args[0]};
USE
}
-
- my($eval_result, $eval_error) = _eval($code, \@imports);
+ my( $eval_result, $eval_error ) = _eval( $code, \@imports );
my $ok = $tb->ok( $eval_result, "use $module;" );
-
- unless( $ok ) {
+
+ unless($ok) {
chomp $eval_error;
$@ =~ s{^BEGIN failed--compilation aborted at .*$}
{BEGIN failed--compilation aborted at $filename line $line.}m;
@@ -268,21 +314,25 @@ DIAGNOSTIC
return $ok;
}
-
sub _eval {
- my($code) = shift;
- my @args = @_;
+ my( $code, @args ) = @_;
# Work around oddities surrounding resetting of $@ by immediately
# storing it.
- local($@,$!,$SIG{__DIE__}); # isolate eval
- my $eval_result = eval $code;
- my $eval_error = $@;
+ my( $sigdie, $eval_result, $eval_error );
+ {
+ local( $@, $!, $SIG{__DIE__} ); # isolate eval
+ $eval_result = eval $code; ## no critic (BuiltinFunctions::ProhibitStringyEval)
+ $eval_error = $@;
+ $sigdie = $SIG{__DIE__} || undef;
+ }
+ # make sure that $code got a chance to set $SIG{__DIE__}
+ $SIG{__DIE__} = $sigdie if defined $sigdie;
- return($eval_result, $eval_error);
+ return( $eval_result, $eval_error );
}
-#line 718
+#line 875
sub require_ok ($) {
my($module) = shift;
@@ -300,10 +350,10 @@ require $module;
1;
REQUIRE
- my($eval_result, $eval_error) = _eval($code);
+ my( $eval_result, $eval_error ) = _eval($code);
my $ok = $tb->ok( $eval_result, "require $module;" );
- unless( $ok ) {
+ unless($ok) {
chomp $eval_error;
$tb->diag(<<DIAGNOSTIC);
Tried to require '$module'.
@@ -315,7 +365,6 @@ DIAGNOSTIC
return $ok;
}
-
sub _is_module_name {
my $module = shift;
@@ -323,55 +372,56 @@ sub _is_module_name {
# End with an alphanumeric.
# The rest is an alphanumeric or ::
$module =~ s/\b::\b//g;
- $module =~ /^[a-zA-Z]\w*$/;
+
+ return $module =~ /^[a-zA-Z]\w*$/ ? 1 : 0;
}
-#line 795
+#line 952
-use vars qw(@Data_Stack %Refs_Seen);
+our( @Data_Stack, %Refs_Seen );
my $DNE = bless [], 'Does::Not::Exist';
sub _dne {
- ref $_[0] eq ref $DNE;
+ return ref $_[0] eq ref $DNE;
}
-
+## no critic (Subroutines::RequireArgUnpacking)
sub is_deeply {
my $tb = Test::More->builder;
unless( @_ == 2 or @_ == 3 ) {
- my $msg = <<WARNING;
+ my $msg = <<'WARNING';
is_deeply() takes two or three args, you gave %d.
This usually means you passed an array or hash instead
of a reference to it
WARNING
- chop $msg; # clip off newline so carp() will put in line/file
+ chop $msg; # clip off newline so carp() will put in line/file
_carp sprintf $msg, scalar @_;
- return $tb->ok(0);
+ return $tb->ok(0);
}
- my($got, $expected, $name) = @_;
+ my( $got, $expected, $name ) = @_;
- $tb->_unoverload_str(\$expected, \$got);
+ $tb->_unoverload_str( \$expected, \$got );
my $ok;
- if( !ref $got and !ref $expected ) { # neither is a reference
- $ok = $tb->is_eq($got, $expected, $name);
+ if( !ref $got and !ref $expected ) { # neither is a reference
+ $ok = $tb->is_eq( $got, $expected, $name );
}
- elsif( !ref $got xor !ref $expected ) { # one's a reference, one isn't
- $ok = $tb->ok(0, $name);
- $tb->diag( _format_stack({ vals => [ $got, $expected ] }) );
+ elsif( !ref $got xor !ref $expected ) { # one's a reference, one isn't
+ $ok = $tb->ok( 0, $name );
+ $tb->diag( _format_stack({ vals => [ $got, $expected ] }) );
}
- else { # both references
+ else { # both references
local @Data_Stack = ();
- if( _deep_check($got, $expected) ) {
- $ok = $tb->ok(1, $name);
+ if( _deep_check( $got, $expected ) ) {
+ $ok = $tb->ok( 1, $name );
}
else {
- $ok = $tb->ok(0, $name);
- $tb->diag(_format_stack(@Data_Stack));
+ $ok = $tb->ok( 0, $name );
+ $tb->diag( _format_stack(@Data_Stack) );
}
}
@@ -381,11 +431,11 @@ WARNING
sub _format_stack {
my(@Stack) = @_;
- my $var = '$FOO';
+ my $var = '$FOO';
my $did_arrow = 0;
foreach my $entry (@Stack) {
my $type = $entry->{type} || '';
- my $idx = $entry->{'idx'};
+ my $idx = $entry->{'idx'};
if( $type eq 'HASH' ) {
$var .= "->" unless $did_arrow++;
$var .= "{$idx}";
@@ -399,18 +449,19 @@ sub _format_stack {
}
}
- my @vals = @{$Stack[-1]{vals}}[0,1];
+ my @vals = @{ $Stack[-1]{vals} }[ 0, 1 ];
my @vars = ();
- ($vars[0] = $var) =~ s/\$FOO/ \$got/;
- ($vars[1] = $var) =~ s/\$FOO/\$expected/;
+ ( $vars[0] = $var ) =~ s/\$FOO/ \$got/;
+ ( $vars[1] = $var ) =~ s/\$FOO/\$expected/;
my $out = "Structures begin differing at:\n";
- foreach my $idx (0..$#vals) {
+ foreach my $idx ( 0 .. $#vals ) {
my $val = $vals[$idx];
- $vals[$idx] = !defined $val ? 'undef' :
- _dne($val) ? "Does not exist" :
- ref $val ? "$val" :
- "'$val'";
+ $vals[$idx]
+ = !defined $val ? 'undef'
+ : _dne($val) ? "Does not exist"
+ : ref $val ? "$val"
+ : "'$val'";
}
$out .= "$vars[0] = $vals[0]\n";
@@ -420,33 +471,39 @@ sub _format_stack {
return $out;
}
-
sub _type {
my $thing = shift;
return '' if !ref $thing;
for my $type (qw(ARRAY HASH REF SCALAR GLOB CODE Regexp)) {
- return $type if UNIVERSAL::isa($thing, $type);
+ return $type if UNIVERSAL::isa( $thing, $type );
}
return '';
}
-#line 941
+#line 1112
sub diag {
- my $tb = Test::More->builder;
+ return Test::More->builder->diag(@_);
+}
- $tb->diag(@_);
+sub note {
+ return Test::More->builder->note(@_);
}
+#line 1138
-#line 1010
+sub explain {
+ return Test::More->builder->explain(@_);
+}
-#'#
+#line 1204
+
+## no critic (Subroutines::RequireFinalReturn)
sub skip {
- my($why, $how_many) = @_;
+ my( $why, $how_many ) = @_;
my $tb = Test::More->builder;
unless( defined $how_many ) {
@@ -457,23 +514,23 @@ sub skip {
}
if( defined $how_many and $how_many =~ /\D/ ) {
- _carp "skip() was passed a non-numeric number of tests. Did you get the arguments backwards?";
+ _carp
+ "skip() was passed a non-numeric number of tests. Did you get the arguments backwards?";
$how_many = 1;
}
- for( 1..$how_many ) {
+ for( 1 .. $how_many ) {
$tb->skip($why);
}
- local $^W = 0;
+ no warnings 'exiting';
last SKIP;
}
-
-#line 1097
+#line 1288
sub todo_skip {
- my($why, $how_many) = @_;
+ my( $why, $how_many ) = @_;
my $tb = Test::More->builder;
unless( defined $how_many ) {
@@ -483,35 +540,35 @@ sub todo_skip {
$how_many = 1;
}
- for( 1..$how_many ) {
+ for( 1 .. $how_many ) {
$tb->todo_skip($why);
}
- local $^W = 0;
+ no warnings 'exiting';
last TODO;
}
-#line 1150
+#line 1343
sub BAIL_OUT {
my $reason = shift;
- my $tb = Test::More->builder;
+ my $tb = Test::More->builder;
$tb->BAIL_OUT($reason);
}
-#line 1189
+#line 1382
#'#
sub eq_array {
- local @Data_Stack;
+ local @Data_Stack = ();
_deep_check(@_);
}
-sub _eq_array {
- my($a1, $a2) = @_;
+sub _eq_array {
+ my( $a1, $a2 ) = @_;
- if( grep !_type($_) eq 'ARRAY', $a1, $a2 ) {
+ if( grep _type($_) ne 'ARRAY', $a1, $a2 ) {
warn "eq_array passed a non-array ref";
return 0;
}
@@ -520,12 +577,12 @@ sub _eq_array {
my $ok = 1;
my $max = $#$a1 > $#$a2 ? $#$a1 : $#$a2;
- for (0..$max) {
+ for( 0 .. $max ) {
my $e1 = $_ > $#$a1 ? $DNE : $a1->[$_];
my $e2 = $_ > $#$a2 ? $DNE : $a2->[$_];
- push @Data_Stack, { type => 'ARRAY', idx => $_, vals => [$e1, $e2] };
- $ok = _deep_check($e1,$e2);
+ push @Data_Stack, { type => 'ARRAY', idx => $_, vals => [ $e1, $e2 ] };
+ $ok = _deep_check( $e1, $e2 );
pop @Data_Stack if $ok;
last unless $ok;
@@ -535,7 +592,7 @@ sub _eq_array {
}
sub _deep_check {
- my($e1, $e2) = @_;
+ my( $e1, $e2 ) = @_;
my $tb = Test::More->builder;
my $ok = 0;
@@ -547,27 +604,31 @@ sub _deep_check {
{
# Quiet uninitialized value warnings when comparing undefs.
- local $^W = 0;
+ no warnings 'uninitialized';
- $tb->_unoverload_str(\$e1, \$e2);
+ $tb->_unoverload_str( \$e1, \$e2 );
# Either they're both references or both not.
- my $same_ref = !(!ref $e1 xor !ref $e2);
- my $not_ref = (!ref $e1 and !ref $e2);
+ my $same_ref = !( !ref $e1 xor !ref $e2 );
+ my $not_ref = ( !ref $e1 and !ref $e2 );
if( defined $e1 xor defined $e2 ) {
$ok = 0;
}
- elsif ( _dne($e1) xor _dne($e2) ) {
+ elsif( !defined $e1 and !defined $e2 ) {
+ # Shortcut if they're both defined.
+ $ok = 1;
+ }
+ elsif( _dne($e1) xor _dne($e2) ) {
$ok = 0;
}
- elsif ( $same_ref and ($e1 eq $e2) ) {
+ elsif( $same_ref and( $e1 eq $e2 ) ) {
$ok = 1;
}
- elsif ( $not_ref ) {
- push @Data_Stack, { type => '', vals => [$e1, $e2] };
- $ok = 0;
- }
+ elsif($not_ref) {
+ push @Data_Stack, { type => '', vals => [ $e1, $e2 ] };
+ $ok = 0;
+ }
else {
if( $Refs_Seen{$e1} ) {
return $Refs_Seen{$e1} eq $e2;
@@ -580,61 +641,59 @@ sub _deep_check {
$type = 'DIFFERENT' unless _type($e2) eq $type;
if( $type eq 'DIFFERENT' ) {
- push @Data_Stack, { type => $type, vals => [$e1, $e2] };
+ push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] };
$ok = 0;
}
elsif( $type eq 'ARRAY' ) {
- $ok = _eq_array($e1, $e2);
+ $ok = _eq_array( $e1, $e2 );
}
elsif( $type eq 'HASH' ) {
- $ok = _eq_hash($e1, $e2);
+ $ok = _eq_hash( $e1, $e2 );
}
elsif( $type eq 'REF' ) {
- push @Data_Stack, { type => $type, vals => [$e1, $e2] };
- $ok = _deep_check($$e1, $$e2);
+ push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] };
+ $ok = _deep_check( $$e1, $$e2 );
pop @Data_Stack if $ok;
}
elsif( $type eq 'SCALAR' ) {
- push @Data_Stack, { type => 'REF', vals => [$e1, $e2] };
- $ok = _deep_check($$e1, $$e2);
+ push @Data_Stack, { type => 'REF', vals => [ $e1, $e2 ] };
+ $ok = _deep_check( $$e1, $$e2 );
pop @Data_Stack if $ok;
}
- elsif( $type ) {
- push @Data_Stack, { type => $type, vals => [$e1, $e2] };
+ elsif($type) {
+ push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] };
$ok = 0;
}
- else {
- _whoa(1, "No type in _deep_check");
- }
+ else {
+ _whoa( 1, "No type in _deep_check" );
+ }
}
}
return $ok;
}
-
sub _whoa {
- my($check, $desc) = @_;
- if( $check ) {
- die <<WHOA;
+ my( $check, $desc ) = @_;
+ if($check) {
+ die <<"WHOA";
WHOA! $desc
This should never happen! Please contact the author immediately!
WHOA
}
}
-
-#line 1320
+#line 1515
sub eq_hash {
- local @Data_Stack;
+ local @Data_Stack = ();
return _deep_check(@_);
}
sub _eq_hash {
- my($a1, $a2) = @_;
+ my( $a1, $a2 ) = @_;
- if( grep !_type($_) eq 'HASH', $a1, $a2 ) {
+ if( grep _type($_) ne 'HASH', $a1, $a2 ) {
warn "eq_hash passed a non-hash ref";
return 0;
}
@@ -643,12 +702,12 @@ sub _eq_hash {
my $ok = 1;
my $bigger = keys %$a1 > keys %$a2 ? $a1 : $a2;
- foreach my $k (keys %$bigger) {
+ foreach my $k ( keys %$bigger ) {
my $e1 = exists $a1->{$k} ? $a1->{$k} : $DNE;
my $e2 = exists $a2->{$k} ? $a2->{$k} : $DNE;
- push @Data_Stack, { type => 'HASH', idx => $k, vals => [$e1, $e2] };
- $ok = _deep_check($e1, $e2);
+ push @Data_Stack, { type => 'HASH', idx => $k, vals => [ $e1, $e2 ] };
+ $ok = _deep_check( $e1, $e2 );
pop @Data_Stack if $ok;
last unless $ok;
@@ -657,16 +716,15 @@ sub _eq_hash {
return $ok;
}
-#line 1377
+#line 1572
-sub eq_set {
- my($a1, $a2) = @_;
+sub eq_set {
+ my( $a1, $a2 ) = @_;
return 0 unless @$a1 == @$a2;
- # There's faster ways to do this, but this is easiest.
- local $^W = 0;
+ no warnings 'uninitialized';
- # It really doesn't matter how we sort them, as long as both arrays are
+ # It really doesn't matter how we sort them, as long as both arrays are
# sorted with the same algorithm.
#
# Ensure that references are not accidentally treated the same as a
@@ -678,11 +736,11 @@ sub eq_set {
# I don't know how references would be sorted so we just don't sort
# them. This means eq_set doesn't really work with refs.
return eq_array(
- [grep(ref, @$a1), sort( grep(!ref, @$a1) )],
- [grep(ref, @$a2), sort( grep(!ref, @$a2) )],
+ [ grep( ref, @$a1 ), sort( grep( !ref, @$a1 ) ) ],
+ [ grep( ref, @$a2 ), sort( grep( !ref, @$a2 ) ) ],
);
}
-#line 1567
+#line 1774
1;
diff --git a/inc/parent.pm b/inc/parent.pm
new file mode 100644
index 0000000..31f8dd9
--- /dev/null
+++ b/inc/parent.pm
@@ -0,0 +1,37 @@
+#line 1
+package parent;
+use strict;
+use vars qw($VERSION);
+$VERSION = '0.223';
+
+sub import {
+ my $class = shift;
+
+ my $inheritor = caller(0);
+
+ if ( @_ and $_[0] eq '-norequire' ) {
+ shift @_;
+ } else {
+ for ( my @filename = @_ ) {
+ if ( $_ eq $inheritor ) {
+ warn "Class '$inheritor' tried to inherit from itself\n";
+ };
+
+ s{::|'}{/}g;
+ require "$_.pm"; # dies if the file is not found
+ }
+ }
+
+ {
+ no strict 'refs';
+ # This is more efficient than push for the new MRO
+ # at least until the new MRO is fixed
+ @{"$inheritor\::ISA"} = (@{"$inheritor\::ISA"} , @_);
+ };
+};
+
+"All your base are belong to us"
+
+__END__
+
+#line 136
commit a9ca548dc516e8ae189a63b8f7d9fcbf5e5c35b4
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Jan 18 11:51:53 2010 -0800
Bump to 0.21
diff --git a/lib/Scalar/Defer.pm b/lib/Scalar/Defer.pm
index 1381cbc..b3101fa 100644
--- a/lib/Scalar/Defer.pm
+++ b/lib/Scalar/Defer.pm
@@ -5,7 +5,7 @@ use strict;
use warnings;
BEGIN {
- our $VERSION = '0.20';
+ our $VERSION = '0.21';
our @EXPORT = qw( lazy defer force );
our @EXPORT_OK = qw( is_deferred );
}
commit 66dee82dce9220b0cb4b17735e59721ac6531216
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Jan 18 11:52:55 2010 -0800
MANIFEST updates for releng
diff --git a/MANIFEST b/MANIFEST
index 17de2b8..d0d2bf0 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -11,8 +11,10 @@ inc/Module/Install/Metadata.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
inc/ok.pm
+inc/parent.pm
inc/PerlIO.pm
inc/Test/Builder.pm
+inc/Test/Builder/IO/Scalar.pm
inc/Test/Builder/Module.pm
inc/Test/More.pm
lib/Scalar/Defer.pm
commit 70911d8123b1ea2dd59db0051fec7e6da6c91bea
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Jan 18 11:54:19 2010 -0800
Add SIGNATURE to git
diff --git a/SIGNATURE b/SIGNATURE
new file mode 100644
index 0000000..6d493ac
--- /dev/null
+++ b/SIGNATURE
@@ -0,0 +1,50 @@
+This file contains message digests of all files listed in MANIFEST,
+signed via the Module::Signature module, version 0.61.
+
+To verify the content in this distribution, first make sure you have
+Module::Signature installed, then type:
+
+ % cpansign -v
+
+It will check each file's integrity, as well as the signature's
+validity. If "==> Signature verified OK! <==" is not displayed,
+the distribution may already have been compromised, and you should
+not run its Makefile.PL or Build.PL.
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+SHA1 4fa271361eea4f32eb5c16cf3ace7236cecfa624 Changes
+SHA1 c8f8d36e7d20dcbe00698733f42c3fa57f1ad831 MANIFEST
+SHA1 52ef325f18fe59fa1f52e3525f4104e3ab4abf48 META.yml
+SHA1 eef5a6f2e6bc9efe02c137b050c64ba1bd438eab Makefile.PL
+SHA1 91735f73073ea3d7b2d64047e45d25355f516752 README
+SHA1 e5fb92ac217988bfc7a6af739b0459627020a27e inc/Module/AutoInstall.pm
+SHA1 fd5f3c4f0418efee3b9b16cf8c3902e8374909df inc/Module/Install.pm
+SHA1 5c529e96420d964b192f011b121283a4916f7331 inc/Module/Install/AutoInstall.pm
+SHA1 7cd7c349afdf3f012e475507b1017bdfa796bfbd inc/Module/Install/Base.pm
+SHA1 ba186541bbf6439111f01fc70769cf24d22869bf inc/Module/Install/Can.pm
+SHA1 aaa50eca0d7751db7a4d953fac9bc72c6294e238 inc/Module/Install/Fetch.pm
+SHA1 219da5a95c290312a81477b226f005997d97dcfd inc/Module/Install/Include.pm
+SHA1 3e83972921d54198d1246f7278f08664006cd65d inc/Module/Install/Makefile.pm
+SHA1 12bf1867955480d47d5171a9e9c6a96fabe0b58f inc/Module/Install/Metadata.pm
+SHA1 f7ee667e878bd2faf22ee9358a7b5a2cc8e91ba4 inc/Module/Install/Win32.pm
+SHA1 8ed29d6cf217e0977469575d788599cbfb53a5ca inc/Module/Install/WriteAll.pm
+SHA1 fb1a897882981885fb57a77fba9bdc588053fc2a inc/PerlIO.pm
+SHA1 f7582b52d18e4b1b1bf24b3b7a29ccbf9a8ef00c inc/Test/Builder.pm
+SHA1 afc89bc18836c24cac226e5307a0130952832992 inc/Test/Builder/IO/Scalar.pm
+SHA1 4694604f76a8ed3e7bd049b2339d3a85c0d39de4 inc/Test/Builder/Module.pm
+SHA1 108e94af93b785625dde019b4191774f33ceea13 inc/Test/More.pm
+SHA1 55be398173a2d979a648a73a28c8b3a40531dbba inc/ok.pm
+SHA1 b526160f58a03562738f361878a6e65e3d79796a inc/parent.pm
+SHA1 5fc09e95a7d44f540570a91c72e0020acbc34a1c lib/Scalar/Defer.pm
+SHA1 f89e83f7a812e3b8c6afe96bb087d0b8218cbd04 t/01-basic.t
+SHA1 2be303573646cd1aee91665c353bce5cb0efd349 t/02-is.t
+SHA1 c3ea4c2671256fad58804f6a00d8d48f6afc2349 t/03-autoload.t
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.9 (GNU/Linux)
+
+iEYEARECAAYFAktUvE0ACgkQEi9d9xCOQEZvCwCgnjR9D4Ajnyx2LOdmUyAhJNkw
+yi8An2z/h9KH3F31g5nuGxsOFwBuatdV
+=1/F/
+-----END PGP SIGNATURE-----
commit d1885672d4ac8caf13a0c74f15cdd034fa14d76c
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Jan 18 11:54:50 2010 -0800
Checking in changes prior to tagging of version 0.21. Changelog diff is:
diff --git a/inc/Module/AutoInstall.pm b/inc/Module/AutoInstall.pm
deleted file mode 100644
index dfb8ef7..0000000
--- a/inc/Module/AutoInstall.pm
+++ /dev/null
@@ -1,805 +0,0 @@
-#line 1
-package Module::AutoInstall;
-
-use strict;
-use Cwd ();
-use ExtUtils::MakeMaker ();
-
-use vars qw{$VERSION};
-BEGIN {
- $VERSION = '1.03';
-}
-
-# special map on pre-defined feature sets
-my %FeatureMap = (
- '' => 'Core Features', # XXX: deprecated
- '-core' => 'Core Features',
-);
-
-# various lexical flags
-my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS );
-my (
- $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps
-);
-my ( $PostambleActions, $PostambleUsed );
-
-# See if it's a testing or non-interactive session
-_accept_default( $ENV{AUTOMATED_TESTING} or ! -t STDIN );
-_init();
-
-sub _accept_default {
- $AcceptDefault = shift;
-}
-
-sub missing_modules {
- return @Missing;
-}
-
-sub do_install {
- __PACKAGE__->install(
- [
- $Config
- ? ( UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
- : ()
- ],
- @Missing,
- );
-}
-
-# initialize various flags, and/or perform install
-sub _init {
- foreach my $arg (
- @ARGV,
- split(
- /[\s\t]+/,
- $ENV{PERL_AUTOINSTALL} || $ENV{PERL_EXTUTILS_AUTOINSTALL} || ''
- )
- )
- {
- if ( $arg =~ /^--config=(.*)$/ ) {
- $Config = [ split( ',', $1 ) ];
- }
- elsif ( $arg =~ /^--installdeps=(.*)$/ ) {
- __PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) );
- exit 0;
- }
- elsif ( $arg =~ /^--default(?:deps)?$/ ) {
- $AcceptDefault = 1;
- }
- elsif ( $arg =~ /^--check(?:deps)?$/ ) {
- $CheckOnly = 1;
- }
- elsif ( $arg =~ /^--skip(?:deps)?$/ ) {
- $SkipInstall = 1;
- }
- elsif ( $arg =~ /^--test(?:only)?$/ ) {
- $TestOnly = 1;
- }
- elsif ( $arg =~ /^--all(?:deps)?$/ ) {
- $AllDeps = 1;
- }
- }
-}
-
-# overrides MakeMaker's prompt() to automatically accept the default choice
-sub _prompt {
- goto &ExtUtils::MakeMaker::prompt unless $AcceptDefault;
-
- my ( $prompt, $default ) = @_;
- my $y = ( $default =~ /^[Yy]/ );
-
- print $prompt, ' [', ( $y ? 'Y' : 'y' ), '/', ( $y ? 'n' : 'N' ), '] ';
- print "$default\n";
- return $default;
-}
-
-# the workhorse
-sub import {
- my $class = shift;
- my @args = @_ or return;
- my $core_all;
-
- print "*** $class version " . $class->VERSION . "\n";
- print "*** Checking for Perl dependencies...\n";
-
- my $cwd = Cwd::cwd();
-
- $Config = [];
-
- my $maxlen = length(
- (
- sort { length($b) <=> length($a) }
- grep { /^[^\-]/ }
- map {
- ref($_)
- ? ( ( ref($_) eq 'HASH' ) ? keys(%$_) : @{$_} )
- : ''
- }
- map { +{@args}->{$_} }
- grep { /^[^\-]/ or /^-core$/i } keys %{ +{@args} }
- )[0]
- );
-
- # We want to know if we're under CPAN early to avoid prompting, but
- # if we aren't going to try and install anything anyway then skip the
- # check entirely since we don't want to have to load (and configure)
- # an old CPAN just for a cosmetic message
-
- $UnderCPAN = _check_lock(1) unless $SkipInstall;
-
- while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
- my ( @required, @tests, @skiptests );
- my $default = 1;
- my $conflict = 0;
-
- if ( $feature =~ m/^-(\w+)$/ ) {
- my $option = lc($1);
-
- # check for a newer version of myself
- _update_to( $modules, @_ ) and return if $option eq 'version';
-
- # sets CPAN configuration options
- $Config = $modules if $option eq 'config';
-
- # promote every features to core status
- $core_all = ( $modules =~ /^all$/i ) and next
- if $option eq 'core';
-
- next unless $option eq 'core';
- }
-
- print "[" . ( $FeatureMap{ lc($feature) } || $feature ) . "]\n";
-
- $modules = [ %{$modules} ] if UNIVERSAL::isa( $modules, 'HASH' );
-
- unshift @$modules, -default => &{ shift(@$modules) }
- if ( ref( $modules->[0] ) eq 'CODE' ); # XXX: bugward combatability
-
- while ( my ( $mod, $arg ) = splice( @$modules, 0, 2 ) ) {
- if ( $mod =~ m/^-(\w+)$/ ) {
- my $option = lc($1);
-
- $default = $arg if ( $option eq 'default' );
- $conflict = $arg if ( $option eq 'conflict' );
- @tests = @{$arg} if ( $option eq 'tests' );
- @skiptests = @{$arg} if ( $option eq 'skiptests' );
-
- next;
- }
-
- printf( "- %-${maxlen}s ...", $mod );
-
- if ( $arg and $arg =~ /^\D/ ) {
- unshift @$modules, $arg;
- $arg = 0;
- }
-
- # XXX: check for conflicts and uninstalls(!) them.
- my $cur = _load($mod);
- if (_version_cmp ($cur, $arg) >= 0)
- {
- print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
- push @Existing, $mod => $arg;
- $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
- }
- else {
- if (not defined $cur) # indeed missing
- {
- print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
- }
- else
- {
- # no need to check $arg as _version_cmp ($cur, undef) would satisfy >= above
- print "too old. ($cur < $arg)\n";
- }
-
- push @required, $mod => $arg;
- }
- }
-
- next unless @required;
-
- my $mandatory = ( $feature eq '-core' or $core_all );
-
- if (
- !$SkipInstall
- and (
- $CheckOnly
- or ($mandatory and $UnderCPAN)
- or $AllDeps
- or _prompt(
- qq{==> Auto-install the }
- . ( @required / 2 )
- . ( $mandatory ? ' mandatory' : ' optional' )
- . qq{ module(s) from CPAN?},
- $default ? 'y' : 'n',
- ) =~ /^[Yy]/
- )
- )
- {
- push( @Missing, @required );
- $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
- }
-
- elsif ( !$SkipInstall
- and $default
- and $mandatory
- and
- _prompt( qq{==> The module(s) are mandatory! Really skip?}, 'n', )
- =~ /^[Nn]/ )
- {
- push( @Missing, @required );
- $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
- }
-
- else {
- $DisabledTests{$_} = 1 for map { glob($_) } @tests;
- }
- }
-
- if ( @Missing and not( $CheckOnly or $UnderCPAN ) ) {
- require Config;
- print
-"*** Dependencies will be installed the next time you type '$Config::Config{make}'.\n";
-
- # make an educated guess of whether we'll need root permission.
- print " (You may need to do that as the 'root' user.)\n"
- if eval '$>';
- }
- print "*** $class configuration finished.\n";
-
- chdir $cwd;
-
- # import to main::
- no strict 'refs';
- *{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';
-}
-
-sub _running_under {
- my $thing = shift;
- print <<"END_MESSAGE";
-*** Since we're running under ${thing}, I'll just let it take care
- of the dependency's installation later.
-END_MESSAGE
- return 1;
-}
-
-# Check to see if we are currently running under CPAN.pm and/or CPANPLUS;
-# if we are, then we simply let it taking care of our dependencies
-sub _check_lock {
- return unless @Missing or @_;
-
- my $cpan_env = $ENV{PERL5_CPAN_IS_RUNNING};
-
- if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) {
- return _running_under($cpan_env ? 'CPAN' : 'CPANPLUS');
- }
-
- require CPAN;
-
- if ($CPAN::VERSION > '1.89') {
- if ($cpan_env) {
- return _running_under('CPAN');
- }
- return; # CPAN.pm new enough, don't need to check further
- }
-
- # last ditch attempt, this -will- configure CPAN, very sorry
-
- _load_cpan(1); # force initialize even though it's already loaded
-
- # Find the CPAN lock-file
- my $lock = MM->catfile( $CPAN::Config->{cpan_home}, ".lock" );
- return unless -f $lock;
-
- # Check the lock
- local *LOCK;
- return unless open(LOCK, $lock);
-
- if (
- ( $^O eq 'MSWin32' ? _under_cpan() : <LOCK> == getppid() )
- and ( $CPAN::Config->{prerequisites_policy} || '' ) ne 'ignore'
- ) {
- print <<'END_MESSAGE';
-
-*** Since we're running under CPAN, I'll just let it take care
- of the dependency's installation later.
-END_MESSAGE
- return 1;
- }
-
- close LOCK;
- return;
-}
-
-sub install {
- my $class = shift;
-
- my $i; # used below to strip leading '-' from config keys
- my @config = ( map { s/^-// if ++$i; $_ } @{ +shift } );
-
- my ( @modules, @installed );
- while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
-
- # grep out those already installed
- if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
- push @installed, $pkg;
- }
- else {
- push @modules, $pkg, $ver;
- }
- }
-
- return @installed unless @modules; # nothing to do
- return @installed if _check_lock(); # defer to the CPAN shell
-
- print "*** Installing dependencies...\n";
-
- return unless _connected_to('cpan.org');
-
- my %args = @config;
- my %failed;
- local *FAILED;
- if ( $args{do_once} and open( FAILED, '.#autoinstall.failed' ) ) {
- while (<FAILED>) { chomp; $failed{$_}++ }
- close FAILED;
-
- my @newmod;
- while ( my ( $k, $v ) = splice( @modules, 0, 2 ) ) {
- push @newmod, ( $k => $v ) unless $failed{$k};
- }
- @modules = @newmod;
- }
-
- if ( _has_cpanplus() and not $ENV{PERL_AUTOINSTALL_PREFER_CPAN} ) {
- _install_cpanplus( \@modules, \@config );
- } else {
- _install_cpan( \@modules, \@config );
- }
-
- print "*** $class installation finished.\n";
-
- # see if we have successfully installed them
- while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
- if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
- push @installed, $pkg;
- }
- elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
- print FAILED "$pkg\n";
- }
- }
-
- close FAILED if $args{do_once};
-
- return @installed;
-}
-
-sub _install_cpanplus {
- my @modules = @{ +shift };
- my @config = _cpanplus_config( @{ +shift } );
- my $installed = 0;
-
- require CPANPLUS::Backend;
- my $cp = CPANPLUS::Backend->new;
- my $conf = $cp->configure_object;
-
- return unless $conf->can('conf') # 0.05x+ with "sudo" support
- or _can_write($conf->_get_build('base')); # 0.04x
-
- # if we're root, set UNINST=1 to avoid trouble unless user asked for it.
- my $makeflags = $conf->get_conf('makeflags') || '';
- if ( UNIVERSAL::isa( $makeflags, 'HASH' ) ) {
- # 0.03+ uses a hashref here
- $makeflags->{UNINST} = 1 unless exists $makeflags->{UNINST};
-
- } else {
- # 0.02 and below uses a scalar
- $makeflags = join( ' ', split( ' ', $makeflags ), 'UNINST=1' )
- if ( $makeflags !~ /\bUNINST\b/ and eval qq{ $> eq '0' } );
-
- }
- $conf->set_conf( makeflags => $makeflags );
- $conf->set_conf( prereqs => 1 );
-
-
-
- while ( my ( $key, $val ) = splice( @config, 0, 2 ) ) {
- $conf->set_conf( $key, $val );
- }
-
- my $modtree = $cp->module_tree;
- while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
- print "*** Installing $pkg...\n";
-
- MY::preinstall( $pkg, $ver ) or next if defined &MY::preinstall;
-
- my $success;
- my $obj = $modtree->{$pkg};
-
- if ( $obj and _version_cmp( $obj->{version}, $ver ) >= 0 ) {
- my $pathname = $pkg;
- $pathname =~ s/::/\\W/;
-
- foreach my $inc ( grep { m/$pathname.pm/i } keys(%INC) ) {
- delete $INC{$inc};
- }
-
- my $rv = $cp->install( modules => [ $obj->{module} ] );
-
- if ( $rv and ( $rv->{ $obj->{module} } or $rv->{ok} ) ) {
- print "*** $pkg successfully installed.\n";
- $success = 1;
- } else {
- print "*** $pkg installation cancelled.\n";
- $success = 0;
- }
-
- $installed += $success;
- } else {
- print << ".";
-*** Could not find a version $ver or above for $pkg; skipping.
-.
- }
-
- MY::postinstall( $pkg, $ver, $success ) if defined &MY::postinstall;
- }
-
- return $installed;
-}
-
-sub _cpanplus_config {
- my @config = ();
- while ( @_ ) {
- my ($key, $value) = (shift(), shift());
- if ( $key eq 'prerequisites_policy' ) {
- if ( $value eq 'follow' ) {
- $value = CPANPLUS::Internals::Constants::PREREQ_INSTALL();
- } elsif ( $value eq 'ask' ) {
- $value = CPANPLUS::Internals::Constants::PREREQ_ASK();
- } elsif ( $value eq 'ignore' ) {
- $value = CPANPLUS::Internals::Constants::PREREQ_IGNORE();
- } else {
- die "*** Cannot convert option $key = '$value' to CPANPLUS version.\n";
- }
- } else {
- die "*** Cannot convert option $key to CPANPLUS version.\n";
- }
- }
- return @config;
-}
-
-sub _install_cpan {
- my @modules = @{ +shift };
- my @config = @{ +shift };
- my $installed = 0;
- my %args;
-
- _load_cpan();
- require Config;
-
- if (CPAN->VERSION < 1.80) {
- # no "sudo" support, probe for writableness
- return unless _can_write( MM->catfile( $CPAN::Config->{cpan_home}, 'sources' ) )
- and _can_write( $Config::Config{sitelib} );
- }
-
- # if we're root, set UNINST=1 to avoid trouble unless user asked for it.
- my $makeflags = $CPAN::Config->{make_install_arg} || '';
- $CPAN::Config->{make_install_arg} =
- join( ' ', split( ' ', $makeflags ), 'UNINST=1' )
- if ( $makeflags !~ /\bUNINST\b/ and eval qq{ $> eq '0' } );
-
- # don't show start-up info
- $CPAN::Config->{inhibit_startup_message} = 1;
-
- # set additional options
- while ( my ( $opt, $arg ) = splice( @config, 0, 2 ) ) {
- ( $args{$opt} = $arg, next )
- if $opt =~ /^force$/; # pseudo-option
- $CPAN::Config->{$opt} = $arg;
- }
-
- local $CPAN::Config->{prerequisites_policy} = 'follow';
-
- while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
- MY::preinstall( $pkg, $ver ) or next if defined &MY::preinstall;
-
- print "*** Installing $pkg...\n";
-
- my $obj = CPAN::Shell->expand( Module => $pkg );
- my $success = 0;
-
- if ( $obj and _version_cmp( $obj->cpan_version, $ver ) >= 0 ) {
- my $pathname = $pkg;
- $pathname =~ s/::/\\W/;
-
- foreach my $inc ( grep { m/$pathname.pm/i } keys(%INC) ) {
- delete $INC{$inc};
- }
-
- my $rv = $args{force} ? CPAN::Shell->force( install => $pkg )
- : CPAN::Shell->install($pkg);
- $rv ||= eval {
- $CPAN::META->instance( 'CPAN::Distribution', $obj->cpan_file, )
- ->{install}
- if $CPAN::META;
- };
-
- if ( $rv eq 'YES' ) {
- print "*** $pkg successfully installed.\n";
- $success = 1;
- }
- else {
- print "*** $pkg installation failed.\n";
- $success = 0;
- }
-
- $installed += $success;
- }
- else {
- print << ".";
-*** Could not find a version $ver or above for $pkg; skipping.
-.
- }
-
- MY::postinstall( $pkg, $ver, $success ) if defined &MY::postinstall;
- }
-
- return $installed;
-}
-
-sub _has_cpanplus {
- return (
- $HasCPANPLUS = (
- $INC{'CPANPLUS/Config.pm'}
- or _load('CPANPLUS::Shell::Default')
- )
- );
-}
-
-# make guesses on whether we're under the CPAN installation directory
-sub _under_cpan {
- require Cwd;
- require File::Spec;
-
- my $cwd = File::Spec->canonpath( Cwd::cwd() );
- my $cpan = File::Spec->canonpath( $CPAN::Config->{cpan_home} );
-
- return ( index( $cwd, $cpan ) > -1 );
-}
-
-sub _update_to {
- my $class = __PACKAGE__;
- my $ver = shift;
-
- return
- if _version_cmp( _load($class), $ver ) >= 0; # no need to upgrade
-
- if (
- _prompt( "==> A newer version of $class ($ver) is required. Install?",
- 'y' ) =~ /^[Nn]/
- )
- {
- die "*** Please install $class $ver manually.\n";
- }
-
- print << ".";
-*** Trying to fetch it from CPAN...
-.
-
- # install ourselves
- _load($class) and return $class->import(@_)
- if $class->install( [], $class, $ver );
-
- print << '.'; exit 1;
-
-*** Cannot bootstrap myself. :-( Installation terminated.
-.
-}
-
-# check if we're connected to some host, using inet_aton
-sub _connected_to {
- my $site = shift;
-
- return (
- ( _load('Socket') and Socket::inet_aton($site) ) or _prompt(
- qq(
-*** Your host cannot resolve the domain name '$site', which
- probably means the Internet connections are unavailable.
-==> Should we try to install the required module(s) anyway?), 'n'
- ) =~ /^[Yy]/
- );
-}
-
-# check if a directory is writable; may create it on demand
-sub _can_write {
- my $path = shift;
- mkdir( $path, 0755 ) unless -e $path;
-
- return 1 if -w $path;
-
- print << ".";
-*** You are not allowed to write to the directory '$path';
- the installation may fail due to insufficient permissions.
-.
-
- if (
- eval '$>' and lc(`sudo -V`) =~ /version/ and _prompt(
- qq(
-==> Should we try to re-execute the autoinstall process with 'sudo'?),
- ((-t STDIN) ? 'y' : 'n')
- ) =~ /^[Yy]/
- )
- {
-
- # try to bootstrap ourselves from sudo
- print << ".";
-*** Trying to re-execute the autoinstall process with 'sudo'...
-.
- my $missing = join( ',', @Missing );
- my $config = join( ',',
- UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
- if $Config;
-
- return
- unless system( 'sudo', $^X, $0, "--config=$config",
- "--installdeps=$missing" );
-
- print << ".";
-*** The 'sudo' command exited with error! Resuming...
-.
- }
-
- return _prompt(
- qq(
-==> Should we try to install the required module(s) anyway?), 'n'
- ) =~ /^[Yy]/;
-}
-
-# load a module and return the version it reports
-sub _load {
- my $mod = pop; # class/instance doesn't matter
- my $file = $mod;
-
- $file =~ s|::|/|g;
- $file .= '.pm';
-
- local $@;
- return eval { require $file; $mod->VERSION } || ( $@ ? undef: 0 );
-}
-
-# Load CPAN.pm and it's configuration
-sub _load_cpan {
- return if $CPAN::VERSION and $CPAN::Config and not @_;
- require CPAN;
- if ( $CPAN::HandleConfig::VERSION ) {
- # Newer versions of CPAN have a HandleConfig module
- CPAN::HandleConfig->load;
- } else {
- # Older versions had the load method in Config directly
- CPAN::Config->load;
- }
-}
-
-# compare two versions, either use Sort::Versions or plain comparison
-# return values same as <=>
-sub _version_cmp {
- my ( $cur, $min ) = @_;
- return -1 unless defined $cur; # if 0 keep comparing
- return 1 unless $min;
-
- $cur =~ s/\s+$//;
-
- # check for version numbers that are not in decimal format
- if ( ref($cur) or ref($min) or $cur =~ /v|\..*\./ or $min =~ /v|\..*\./ ) {
- if ( ( $version::VERSION or defined( _load('version') )) and
- version->can('new')
- ) {
-
- # use version.pm if it is installed.
- return version->new($cur) <=> version->new($min);
- }
- elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) )
- {
-
- # use Sort::Versions as the sorting algorithm for a.b.c versions
- return Sort::Versions::versioncmp( $cur, $min );
- }
-
- warn "Cannot reliably compare non-decimal formatted versions.\n"
- . "Please install version.pm or Sort::Versions.\n";
- }
-
- # plain comparison
- local $^W = 0; # shuts off 'not numeric' bugs
- return $cur <=> $min;
-}
-
-# nothing; this usage is deprecated.
-sub main::PREREQ_PM { return {}; }
-
-sub _make_args {
- my %args = @_;
-
- $args{PREREQ_PM} = { %{ $args{PREREQ_PM} || {} }, @Existing, @Missing }
- if $UnderCPAN or $TestOnly;
-
- if ( $args{EXE_FILES} and -e 'MANIFEST' ) {
- require ExtUtils::Manifest;
- my $manifest = ExtUtils::Manifest::maniread('MANIFEST');
-
- $args{EXE_FILES} =
- [ grep { exists $manifest->{$_} } @{ $args{EXE_FILES} } ];
- }
-
- $args{test}{TESTS} ||= 't/*.t';
- $args{test}{TESTS} = join( ' ',
- grep { !exists( $DisabledTests{$_} ) }
- map { glob($_) } split( /\s+/, $args{test}{TESTS} ) );
-
- my $missing = join( ',', @Missing );
- my $config =
- join( ',', UNIVERSAL::isa( $Config, 'HASH' ) ? %{$Config} : @{$Config} )
- if $Config;
-
- $PostambleActions = (
- ($missing and not $UnderCPAN)
- ? "\$(PERL) $0 --config=$config --installdeps=$missing"
- : "\$(NOECHO) \$(NOOP)"
- );
-
- return %args;
-}
-
-# a wrapper to ExtUtils::MakeMaker::WriteMakefile
-sub Write {
- require Carp;
- Carp::croak "WriteMakefile: Need even number of args" if @_ % 2;
-
- if ($CheckOnly) {
- print << ".";
-*** Makefile not written in check-only mode.
-.
- return;
- }
-
- my %args = _make_args(@_);
-
- no strict 'refs';
-
- $PostambleUsed = 0;
- local *MY::postamble = \&postamble unless defined &MY::postamble;
- ExtUtils::MakeMaker::WriteMakefile(%args);
-
- print << "." unless $PostambleUsed;
-*** WARNING: Makefile written with customized MY::postamble() without
- including contents from Module::AutoInstall::postamble() --
- auto installation features disabled. Please contact the author.
-.
-
- return 1;
-}
-
-sub postamble {
- $PostambleUsed = 1;
-
- return <<"END_MAKE";
-
-config :: installdeps
-\t\$(NOECHO) \$(NOOP)
-
-checkdeps ::
-\t\$(PERL) $0 --checkdeps
-
-installdeps ::
-\t$PostambleActions
-
-END_MAKE
-
-}
-
-1;
-
-__END__
-
-#line 1056
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
deleted file mode 100644
index 51eda5d..0000000
--- a/inc/Module/Install.pm
+++ /dev/null
@@ -1,430 +0,0 @@
-#line 1
-package Module::Install;
-
-# For any maintainers:
-# The load order for Module::Install is a bit magic.
-# It goes something like this...
-#
-# IF ( host has Module::Install installed, creating author mode ) {
-# 1. Makefile.PL calls "use inc::Module::Install"
-# 2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install
-# 3. The installed version of inc::Module::Install loads
-# 4. inc::Module::Install calls "require Module::Install"
-# 5. The ./inc/ version of Module::Install loads
-# } ELSE {
-# 1. Makefile.PL calls "use inc::Module::Install"
-# 2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install
-# 3. The ./inc/ version of Module::Install loads
-# }
-
-use 5.005;
-use strict 'vars';
-
-use vars qw{$VERSION $MAIN};
-BEGIN {
- # All Module::Install core packages now require synchronised versions.
- # This will be used to ensure we don't accidentally load old or
- # different versions of modules.
- # 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.91';
-
- # Storage for the pseudo-singleton
- $MAIN = undef;
-
- *inc::Module::Install::VERSION = *VERSION;
- @inc::Module::Install::ISA = __PACKAGE__;
-
-}
-
-
-
-
-
-# Whether or not inc::Module::Install is actually loaded, the
-# $INC{inc/Module/Install.pm} is what will still get set as long as
-# the caller loaded module this in the documented manner.
-# If not set, the caller may NOT have loaded the bundled version, and thus
-# they may not have a MI version that works with the Makefile.PL. This would
-# result in false errors or unexpected behaviour. And we don't want that.
-my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
-unless ( $INC{$file} ) { die <<"END_DIE" }
-
-Please invoke ${\__PACKAGE__} with:
-
- use inc::${\__PACKAGE__};
-
-not:
-
- use ${\__PACKAGE__};
-
-END_DIE
-
-
-
-
-
-# If the script that is loading Module::Install is from the future,
-# then make will detect this and cause it to re-run over and over
-# again. This is bad. Rather than taking action to touch it (which
-# is unreliable on some platforms and requires write permissions)
-# for now we should catch this and refuse to run.
-if ( -f $0 ) {
- my $s = (stat($0))[9];
-
- # If the modification time is only slightly in the future,
- # sleep briefly to remove the problem.
- my $a = $s - time;
- if ( $a > 0 and $a < 5 ) { sleep 5 }
-
- # Too far in the future, throw an error.
- my $t = time;
- if ( $s > $t ) { die <<"END_DIE" }
-
-Your installer $0 has a modification time in the future ($s > $t).
-
-This is known to create infinite loops in make.
-
-Please correct this, then run $0 again.
-
-END_DIE
-}
-
-
-
-
-
-# Build.PL was formerly supported, but no longer is due to excessive
-# difficulty in implementing every single feature twice.
-if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" }
-
-Module::Install no longer supports Build.PL.
-
-It was impossible to maintain duel backends, and has been deprecated.
-
-Please remove all Build.PL files and only use the Makefile.PL installer.
-
-END_DIE
-
-
-
-
-
-# To save some more typing in Module::Install installers, every...
-# use inc::Module::Install
-# ...also acts as an implicit use strict.
-$^H |= strict::bits(qw(refs subs vars));
-
-
-
-
-
-use Cwd ();
-use File::Find ();
-use File::Path ();
-use FindBin;
-
-sub autoload {
- my $self = shift;
- my $who = $self->_caller;
- my $cwd = Cwd::cwd();
- my $sym = "${who}::AUTOLOAD";
- $sym->{$cwd} = sub {
- my $pwd = Cwd::cwd();
- if ( my $code = $sym->{$pwd} ) {
- # Delegate back to parent dirs
- goto &$code unless $cwd eq $pwd;
- }
- $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
- my $method = $1;
- if ( uc($method) eq $method ) {
- # Do nothing
- return;
- } elsif ( $method =~ /^_/ and $self->can($method) ) {
- # Dispatch to the root M:I class
- return $self->$method(@_);
- }
-
- # Dispatch to the appropriate plugin
- unshift @_, ( $self, $1 );
- goto &{$self->can('call')};
- };
-}
-
-sub import {
- my $class = shift;
- my $self = $class->new(@_);
- my $who = $self->_caller;
-
- unless ( -f $self->{file} ) {
- require "$self->{path}/$self->{dispatch}.pm";
- File::Path::mkpath("$self->{prefix}/$self->{author}");
- $self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self );
- $self->{admin}->init;
- @_ = ($class, _self => $self);
- goto &{"$self->{name}::import"};
- }
-
- *{"${who}::AUTOLOAD"} = $self->autoload;
- $self->preload;
-
- # Unregister loader and worker packages so subdirs can use them again
- delete $INC{"$self->{file}"};
- delete $INC{"$self->{path}.pm"};
-
- # Save to the singleton
- $MAIN = $self;
-
- return 1;
-}
-
-sub preload {
- my $self = shift;
- unless ( $self->{extensions} ) {
- $self->load_extensions(
- "$self->{prefix}/$self->{path}", $self
- );
- }
-
- my @exts = @{$self->{extensions}};
- unless ( @exts ) {
- @exts = $self->{admin}->load_all_extensions;
- }
-
- my %seen;
- foreach my $obj ( @exts ) {
- while (my ($method, $glob) = each %{ref($obj) . '::'}) {
- next unless $obj->can($method);
- next if $method =~ /^_/;
- next if $method eq uc($method);
- $seen{$method}++;
- }
- }
-
- my $who = $self->_caller;
- foreach my $name ( sort keys %seen ) {
- *{"${who}::$name"} = sub {
- ${"${who}::AUTOLOAD"} = "${who}::$name";
- goto &{"${who}::AUTOLOAD"};
- };
- }
-}
-
-sub new {
- my ($class, %args) = @_;
-
- # ignore the prefix on extension modules built from top level.
- my $base_path = Cwd::abs_path($FindBin::Bin);
- unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) {
- delete $args{prefix};
- }
-
- return $args{_self} if $args{_self};
-
- $args{dispatch} ||= 'Admin';
- $args{prefix} ||= 'inc';
- $args{author} ||= ($^O eq 'VMS' ? '_author' : '.author');
- $args{bundle} ||= 'inc/BUNDLES';
- $args{base} ||= $base_path;
- $class =~ s/^\Q$args{prefix}\E:://;
- $args{name} ||= $class;
- $args{version} ||= $class->VERSION;
- unless ( $args{path} ) {
- $args{path} = $args{name};
- $args{path} =~ s!::!/!g;
- }
- $args{file} ||= "$args{base}/$args{prefix}/$args{path}.pm";
- $args{wrote} = 0;
-
- bless( \%args, $class );
-}
-
-sub call {
- my ($self, $method) = @_;
- my $obj = $self->load($method) or return;
- splice(@_, 0, 2, $obj);
- goto &{$obj->can($method)};
-}
-
-sub load {
- my ($self, $method) = @_;
-
- $self->load_extensions(
- "$self->{prefix}/$self->{path}", $self
- ) unless $self->{extensions};
-
- foreach my $obj (@{$self->{extensions}}) {
- return $obj if $obj->can($method);
- }
-
- my $admin = $self->{admin} or die <<"END_DIE";
-The '$method' method does not exist in the '$self->{prefix}' path!
-Please remove the '$self->{prefix}' directory and run $0 again to load it.
-END_DIE
-
- my $obj = $admin->load($method, 1);
- push @{$self->{extensions}}, $obj;
-
- $obj;
-}
-
-sub load_extensions {
- my ($self, $path, $top) = @_;
-
- unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) {
- unshift @INC, $self->{prefix};
- }
-
- foreach my $rv ( $self->find_extensions($path) ) {
- my ($file, $pkg) = @{$rv};
- next if $self->{pathnames}{$pkg};
-
- local $@;
- my $new = eval { require $file; $pkg->can('new') };
- unless ( $new ) {
- warn $@ if $@;
- next;
- }
- $self->{pathnames}{$pkg} = delete $INC{$file};
- push @{$self->{extensions}}, &{$new}($pkg, _top => $top );
- }
-
- $self->{extensions} ||= [];
-}
-
-sub find_extensions {
- my ($self, $path) = @_;
-
- my @found;
- File::Find::find( sub {
- my $file = $File::Find::name;
- return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is;
- my $subpath = $1;
- return if lc($subpath) eq lc($self->{dispatch});
-
- $file = "$self->{path}/$subpath.pm";
- my $pkg = "$self->{name}::$subpath";
- $pkg =~ s!/!::!g;
-
- # If we have a mixed-case package name, assume case has been preserved
- # correctly. Otherwise, root through the file to locate the case-preserved
- # version of the package name.
- if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) {
- my $content = Module::Install::_read($subpath . '.pm');
- my $in_pod = 0;
- foreach ( split //, $content ) {
- $in_pod = 1 if /^=\w/;
- $in_pod = 0 if /^=cut/;
- next if ($in_pod || /^=cut/); # skip pod text
- next if /^\s*#/; # and comments
- if ( m/^\s*package\s+($pkg)\s*;/i ) {
- $pkg = $1;
- last;
- }
- }
- }
-
- push @found, [ $file, $pkg ];
- }, $path ) if -d $path;
-
- @found;
-}
-
-
-
-
-
-#####################################################################
-# Common Utility Functions
-
-sub _caller {
- my $depth = 0;
- my $call = caller($depth);
- while ( $call eq __PACKAGE__ ) {
- $depth++;
- $call = caller($depth);
- }
- return $call;
-}
-
-sub _read {
- local *FH;
- if ( $] >= 5.006 ) {
- open( FH, '<', $_[0] ) or die "open($_[0]): $!";
- } else {
- open( FH, "< $_[0]" ) or die "open($_[0]): $!";
- }
- my $string = do { local $/; <FH> };
- close FH or die "close($_[0]): $!";
- return $string;
-}
-
-sub _readperl {
- my $string = Module::Install::_read($_[0]);
- $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
- $string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s;
- $string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg;
- return $string;
-}
-
-sub _readpod {
- my $string = Module::Install::_read($_[0]);
- $string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
- return $string if $_[0] =~ /\.pod\z/;
- $string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg;
- $string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg;
- $string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg;
- $string =~ s/^\n+//s;
- return $string;
-}
-
-sub _write {
- local *FH;
- if ( $] >= 5.006 ) {
- open( FH, '>', $_[0] ) or die "open($_[0]): $!";
- } else {
- open( FH, "> $_[0]" ) or die "open($_[0]): $!";
- }
- foreach ( 1 .. $#_ ) {
- print FH $_[$_] or die "print($_[0]): $!";
- }
- close FH or die "close($_[0]): $!";
-}
-
-# _version is for processing module versions (eg, 1.03_05) not
-# Perl versions (eg, 5.8.1).
-sub _version ($) {
- my $s = shift || 0;
- my $d =()= $s =~ /(\.)/g;
- if ( $d >= 2 ) {
- # Normalise multipart versions
- $s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
- }
- $s =~ s/^(\d+)\.?//;
- my $l = $1 || 0;
- my @v = map {
- $_ . '0' x (3 - length $_)
- } $s =~ /(\d{1,3})\D?/g;
- $l = $l . '.' . join '', @v if @v;
- return $l + 0;
-}
-
-sub _cmp ($$) {
- _version($_[0]) <=> _version($_[1]);
-}
-
-# Cloned from Params::Util::_CLASS
-sub _CLASS ($) {
- (
- defined $_[0]
- and
- ! ref $_[0]
- and
- $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s
- ) ? $_[0] : undef;
-}
-
-1;
-
-# Copyright 2008 - 2009 Adam Kennedy.
diff --git a/inc/Module/Install/AutoInstall.pm b/inc/Module/Install/AutoInstall.pm
deleted file mode 100644
index 58dd026..0000000
--- a/inc/Module/Install/AutoInstall.pm
+++ /dev/null
@@ -1,61 +0,0 @@
-#line 1
-package Module::Install::AutoInstall;
-
-use strict;
-use Module::Install::Base ();
-
-use vars qw{$VERSION @ISA $ISCORE};
-BEGIN {
- $VERSION = '0.91';
- @ISA = 'Module::Install::Base';
- $ISCORE = 1;
-}
-
-sub AutoInstall { $_[0] }
-
-sub run {
- my $self = shift;
- $self->auto_install_now(@_);
-}
-
-sub write {
- my $self = shift;
- $self->auto_install(@_);
-}
-
-sub auto_install {
- my $self = shift;
- return if $self->{done}++;
-
- # Flatten array of arrays into a single array
- my @core = map @$_, map @$_, grep ref,
- $self->build_requires, $self->requires;
-
- my @config = @_;
-
- # We'll need Module::AutoInstall
- $self->include('Module::AutoInstall');
- require Module::AutoInstall;
-
- Module::AutoInstall->import(
- (@config ? (-config => \@config) : ()),
- (@core ? (-core => \@core) : ()),
- $self->features,
- );
-
- $self->makemaker_args( Module::AutoInstall::_make_args() );
-
- my $class = ref($self);
- $self->postamble(
- "# --- $class section:\n" .
- Module::AutoInstall::postamble()
- );
-}
-
-sub auto_install_now {
- my $self = shift;
- $self->auto_install(@_);
- Module::AutoInstall::do_install();
-}
-
-1;
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
deleted file mode 100644
index 60a74d2..0000000
--- a/inc/Module/Install/Base.pm
+++ /dev/null
@@ -1,78 +0,0 @@
-#line 1
-package Module::Install::Base;
-
-use strict 'vars';
-use vars qw{$VERSION};
-BEGIN {
- $VERSION = '0.91';
-}
-
-# Suspend handler for "redefined" warnings
-BEGIN {
- my $w = $SIG{__WARN__};
- $SIG{__WARN__} = sub { $w };
-}
-
-#line 42
-
-sub new {
- my $class = shift;
- unless ( defined &{"${class}::call"} ) {
- *{"${class}::call"} = sub { shift->_top->call(@_) };
- }
- unless ( defined &{"${class}::load"} ) {
- *{"${class}::load"} = sub { shift->_top->load(@_) };
- }
- bless { @_ }, $class;
-}
-
-#line 61
-
-sub AUTOLOAD {
- local $@;
- my $func = eval { shift->_top->autoload } or return;
- goto &$func;
-}
-
-#line 75
-
-sub _top {
- $_[0]->{_top};
-}
-
-#line 90
-
-sub admin {
- $_[0]->_top->{admin}
- or
- Module::Install::Base::FakeAdmin->new;
-}
-
-#line 106
-
-sub is_admin {
- $_[0]->admin->VERSION;
-}
-
-sub DESTROY {}
-
-package Module::Install::Base::FakeAdmin;
-
-my $fake;
-
-sub new {
- $fake ||= bless(\@_, $_[0]);
-}
-
-sub AUTOLOAD {}
-
-sub DESTROY {}
-
-# Restore warning handler
-BEGIN {
- $SIG{__WARN__} = $SIG{__WARN__}->();
-}
-
-1;
-
-#line 154
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
deleted file mode 100644
index e65e4f6..0000000
--- a/inc/Module/Install/Can.pm
+++ /dev/null
@@ -1,81 +0,0 @@
-#line 1
-package Module::Install::Can;
-
-use strict;
-use Config ();
-use File::Spec ();
-use ExtUtils::MakeMaker ();
-use Module::Install::Base ();
-
-use vars qw{$VERSION @ISA $ISCORE};
-BEGIN {
- $VERSION = '0.91';
- @ISA = 'Module::Install::Base';
- $ISCORE = 1;
-}
-
-# check if we can load some module
-### Upgrade this to not have to load the module if possible
-sub can_use {
- my ($self, $mod, $ver) = @_;
- $mod =~ s{::|\\}{/}g;
- $mod .= '.pm' unless $mod =~ /\.pm$/i;
-
- my $pkg = $mod;
- $pkg =~ s{/}{::}g;
- $pkg =~ s{\.pm$}{}i;
-
- local $@;
- eval { require $mod; $pkg->VERSION($ver || 0); 1 };
-}
-
-# check if we can run some command
-sub can_run {
- my ($self, $cmd) = @_;
-
- my $_cmd = $cmd;
- return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
-
- for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
- next if $dir eq '';
- my $abs = File::Spec->catfile($dir, $_[1]);
- return $abs if (-x $abs or $abs = MM->maybe_command($abs));
- }
-
- return;
-}
-
-# can we locate a (the) C compiler
-sub can_cc {
- my $self = shift;
- my @chunks = split(/ /, $Config::Config{cc}) or return;
-
- # $Config{cc} may contain args; try to find out the program part
- while (@chunks) {
- return $self->can_run("@chunks") || (pop(@chunks), next);
- }
-
- return;
-}
-
-# Fix Cygwin bug on maybe_command();
-if ( $^O eq 'cygwin' ) {
- require ExtUtils::MM_Cygwin;
- require ExtUtils::MM_Win32;
- if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) {
- *ExtUtils::MM_Cygwin::maybe_command = sub {
- my ($self, $file) = @_;
- if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) {
- ExtUtils::MM_Win32->maybe_command($file);
- } else {
- ExtUtils::MM_Unix->maybe_command($file);
- }
- }
- }
-}
-
-1;
-
-__END__
-
-#line 156
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
deleted file mode 100644
index 05f2079..0000000
--- a/inc/Module/Install/Fetch.pm
+++ /dev/null
@@ -1,93 +0,0 @@
-#line 1
-package Module::Install::Fetch;
-
-use strict;
-use Module::Install::Base ();
-
-use vars qw{$VERSION @ISA $ISCORE};
-BEGIN {
- $VERSION = '0.91';
- @ISA = 'Module::Install::Base';
- $ISCORE = 1;
-}
-
-sub get_file {
- my ($self, %args) = @_;
- 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) =
- $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
- }
-
- $|++;
- print "Fetching '$file' from $host... ";
-
- unless (eval { require Socket; Socket::inet_aton($host) }) {
- warn "'$host' resolve failed!\n";
- return;
- }
-
- return unless $scheme eq 'ftp' or $scheme eq 'http';
-
- require Cwd;
- my $dir = Cwd::getcwd();
- chdir $args{local_dir} or return if exists $args{local_dir};
-
- if (eval { require LWP::Simple; 1 }) {
- LWP::Simple::mirror($args{url}, $file);
- }
- elsif (eval { require Net::FTP; 1 }) { eval {
- # use Net::FTP to get past firewall
- my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600);
- $ftp->login("anonymous", 'anonymous at example.com');
- $ftp->cwd($path);
- $ftp->binary;
- $ftp->get($file) or (warn("$!\n"), return);
- $ftp->quit;
- } }
- elsif (my $ftp = $self->can_run('ftp')) { eval {
- # no Net::FTP, fallback to ftp.exe
- require FileHandle;
- my $fh = FileHandle->new;
-
- local $SIG{CHLD} = 'IGNORE';
- unless ($fh->open("|$ftp -n")) {
- warn "Couldn't open ftp: $!\n";
- chdir $dir; return;
- }
-
- my @dialog = split(/\n/, <<"END_FTP");
-open $host
-user anonymous anonymous\@example.com
-cd $path
-binary
-get $file $file
-quit
-END_FTP
- foreach (@dialog) { $fh->print("$_\n") }
- $fh->close;
- } }
- else {
- warn "No working 'ftp' program available!\n";
- chdir $dir; return;
- }
-
- unless (-f $file) {
- warn "Fetching failed: $@\n";
- chdir $dir; return;
- }
-
- return if exists $args{size} and -s $file != $args{size};
- system($args{run}) if exists $args{run};
- unlink($file) if $args{remove};
-
- print(((!exists $args{check_for} or -e $args{check_for})
- ? "done!" : "failed! ($!)"), "\n");
- chdir $dir; return !$?;
-}
-
-1;
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
deleted file mode 100644
index 7e792e0..0000000
--- a/inc/Module/Install/Include.pm
+++ /dev/null
@@ -1,34 +0,0 @@
-#line 1
-package Module::Install::Include;
-
-use strict;
-use Module::Install::Base ();
-
-use vars qw{$VERSION @ISA $ISCORE};
-BEGIN {
- $VERSION = '0.91';
- @ISA = 'Module::Install::Base';
- $ISCORE = 1;
-}
-
-sub include {
- shift()->admin->include(@_);
-}
-
-sub include_deps {
- shift()->admin->include_deps(@_);
-}
-
-sub auto_include {
- shift()->admin->auto_include(@_);
-}
-
-sub auto_include_deps {
- shift()->admin->auto_include_deps(@_);
-}
-
-sub auto_include_dependent_dists {
- shift()->admin->auto_include_dependent_dists(@_);
-}
-
-1;
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
deleted file mode 100644
index 98779db..0000000
--- a/inc/Module/Install/Makefile.pm
+++ /dev/null
@@ -1,268 +0,0 @@
-#line 1
-package Module::Install::Makefile;
-
-use strict 'vars';
-use ExtUtils::MakeMaker ();
-use Module::Install::Base ();
-
-use vars qw{$VERSION @ISA $ISCORE};
-BEGIN {
- $VERSION = '0.91';
- @ISA = 'Module::Install::Base';
- $ISCORE = 1;
-}
-
-sub Makefile { $_[0] }
-
-my %seen = ();
-
-sub prompt {
- shift;
-
- # Infinite loop protection
- my @c = caller();
- if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
- die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
- }
-
- # In automated testing, always use defaults
- if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
- local $ENV{PERL_MM_USE_DEFAULT} = 1;
- goto &ExtUtils::MakeMaker::prompt;
- } else {
- goto &ExtUtils::MakeMaker::prompt;
- }
-}
-
-sub makemaker_args {
- my $self = shift;
- my $args = ( $self->{makemaker_args} ||= {} );
- %$args = ( %$args, @_ );
- return $args;
-}
-
-# For mm args that take multiple space-seperated args,
-# append an argument to the current list.
-sub makemaker_append {
- my $self = sShift;
- my $name = shift;
- my $args = $self->makemaker_args;
- $args->{name} = defined $args->{$name}
- ? join( ' ', $args->{name}, @_ )
- : join( ' ', @_ );
-}
-
-sub build_subdirs {
- my $self = shift;
- my $subdirs = $self->makemaker_args->{DIR} ||= [];
- for my $subdir (@_) {
- push @$subdirs, $subdir;
- }
-}
-
-sub clean_files {
- my $self = shift;
- my $clean = $self->makemaker_args->{clean} ||= {};
- %$clean = (
- %$clean,
- FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_),
- );
-}
-
-sub realclean_files {
- my $self = shift;
- my $realclean = $self->makemaker_args->{realclean} ||= {};
- %$realclean = (
- %$realclean,
- FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_),
- );
-}
-
-sub libs {
- my $self = shift;
- my $libs = ref $_[0] ? shift : [ shift ];
- $self->makemaker_args( LIBS => $libs );
-}
-
-sub inc {
- my $self = shift;
- $self->makemaker_args( INC => shift );
-}
-
-my %test_dir = ();
-
-sub _wanted_t {
- /\.t$/ and -f $_ and $test_dir{$File::Find::dir} = 1;
-}
-
-sub tests_recursive {
- my $self = shift;
- if ( $self->tests ) {
- die "tests_recursive will not work if tests are already defined";
- }
- my $dir = shift || 't';
- unless ( -d $dir ) {
- die "tests_recursive dir '$dir' does not exist";
- }
- %test_dir = ();
- require File::Find;
- File::Find::find( \&_wanted_t, $dir );
- $self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir );
-}
-
-sub write {
- my $self = shift;
- die "&Makefile->write() takes no arguments\n" if @_;
-
- # Check the current Perl version
- my $perl_version = $self->perl_version;
- if ( $perl_version ) {
- eval "use $perl_version; 1"
- or die "ERROR: perl: Version $] is installed, "
- . "but we need version >= $perl_version";
- }
-
- # Make sure we have a new enough MakeMaker
- require ExtUtils::MakeMaker;
-
- if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
- # MakeMaker can complain about module versions that include
- # an underscore, even though its own version may contain one!
- # Hence the funny regexp to get rid of it. See RT #35800
- # for details.
- $self->build_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
- $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
- } else {
- # Allow legacy-compatibility with 5.005 by depending on the
- # most recent EU:MM that supported 5.005.
- $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 );
- $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 );
- }
-
- # Generate the MakeMaker params
- my $args = $self->makemaker_args;
- $args->{DISTNAME} = $self->name;
- $args->{NAME} = $self->module_name || $self->name;
- $args->{VERSION} = $self->version;
- $args->{NAME} =~ s/-/::/g;
- if ( $self->tests ) {
- $args->{test} = { TESTS => $self->tests };
- }
- if ( $] >= 5.005 ) {
- $args->{ABSTRACT} = $self->abstract;
- $args->{AUTHOR} = $self->author;
- }
- if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) {
- $args->{NO_META} = 1;
- }
- if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) {
- $args->{SIGN} = 1;
- }
- unless ( $self->is_admin ) {
- delete $args->{SIGN};
- }
-
- # Merge both kinds of requires into prereq_pm
- my $prereq = ($args->{PREREQ_PM} ||= {});
- %$prereq = ( %$prereq,
- map { @$_ }
- map { @$_ }
- grep $_,
- ($self->configure_requires, $self->build_requires, $self->requires)
- );
-
- # Remove any reference to perl, PREREQ_PM doesn't support it
- delete $args->{PREREQ_PM}->{perl};
-
- # merge both kinds of requires into prereq_pm
- my $subdirs = ($args->{DIR} ||= []);
- if ($self->bundles) {
- foreach my $bundle (@{ $self->bundles }) {
- my ($file, $dir) = @$bundle;
- push @$subdirs, $dir if -d $dir;
- delete $prereq->{$file};
- }
- }
-
- if ( my $perl_version = $self->perl_version ) {
- eval "use $perl_version; 1"
- or die "ERROR: perl: Version $] is installed, "
- . "but we need version >= $perl_version";
- }
-
- $args->{INSTALLDIRS} = $self->installdirs;
-
- my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args;
-
- my $user_preop = delete $args{dist}->{PREOP};
- if (my $preop = $self->admin->preop($user_preop)) {
- foreach my $key ( keys %$preop ) {
- $args{dist}->{$key} = $preop->{$key};
- }
- }
-
- my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
- $self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile');
-}
-
-sub fix_up_makefile {
- my $self = shift;
- my $makefile_name = shift;
- my $top_class = ref($self->_top) || '';
- my $top_version = $self->_top->VERSION || '';
-
- my $preamble = $self->preamble
- ? "# Preamble by $top_class $top_version\n"
- . $self->preamble
- : '';
- my $postamble = "# Postamble by $top_class $top_version\n"
- . ($self->postamble || '');
-
- local *MAKEFILE;
- open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
- my $makefile = do { local $/; <MAKEFILE> };
- close MAKEFILE or die $!;
-
- $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
- $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
- $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g;
- $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m;
- $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m;
-
- # Module::Install will never be used to build the Core Perl
- # Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks
- # PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist
- $makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
- #$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;
-
- # Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
- $makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g;
-
- # XXX - This is currently unused; not sure if it breaks other MM-users
- # $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
-
- open MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
- print MAKEFILE "$preamble$makefile$postamble" or die $!;
- close MAKEFILE or die $!;
-
- 1;
-}
-
-sub preamble {
- my ($self, $text) = @_;
- $self->{preamble} = $text . $self->{preamble} if defined $text;
- $self->{preamble};
-}
-
-sub postamble {
- my ($self, $text) = @_;
- $self->{postamble} ||= $self->admin->postamble;
- $self->{postamble} .= $text if defined $text;
- $self->{postamble}
-}
-
-1;
-
-__END__
-
-#line 394
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
deleted file mode 100644
index 653193d..0000000
--- a/inc/Module/Install/Metadata.pm
+++ /dev/null
@@ -1,624 +0,0 @@
-#line 1
-package Module::Install::Metadata;
-
-use strict 'vars';
-use Module::Install::Base ();
-
-use vars qw{$VERSION @ISA $ISCORE};
-BEGIN {
- $VERSION = '0.91';
- @ISA = 'Module::Install::Base';
- $ISCORE = 1;
-}
-
-my @boolean_keys = qw{
- sign
-};
-
-my @scalar_keys = qw{
- name
- module_name
- abstract
- author
- version
- distribution_type
- tests
- installdirs
-};
-
-my @tuple_keys = qw{
- configure_requires
- build_requires
- requires
- recommends
- bundles
- resources
-};
-
-my @resource_keys = qw{
- homepage
- bugtracker
- repository
-};
-
-my @array_keys = qw{
- keywords
-};
-
-sub Meta { shift }
-sub Meta_BooleanKeys { @boolean_keys }
-sub Meta_ScalarKeys { @scalar_keys }
-sub Meta_TupleKeys { @tuple_keys }
-sub Meta_ResourceKeys { @resource_keys }
-sub Meta_ArrayKeys { @array_keys }
-
-foreach my $key ( @boolean_keys ) {
- *$key = sub {
- my $self = shift;
- if ( defined wantarray and not @_ ) {
- return $self->{values}->{$key};
- }
- $self->{values}->{$key} = ( @_ ? $_[0] : 1 );
- return $self;
- };
-}
-
-foreach my $key ( @scalar_keys ) {
- *$key = sub {
- my $self = shift;
- return $self->{values}->{$key} if defined wantarray and !@_;
- $self->{values}->{$key} = shift;
- return $self;
- };
-}
-
-foreach my $key ( @array_keys ) {
- *$key = sub {
- my $self = shift;
- return $self->{values}->{$key} if defined wantarray and !@_;
- $self->{values}->{$key} ||= [];
- push @{$self->{values}->{$key}}, @_;
- return $self;
- };
-}
-
-foreach my $key ( @resource_keys ) {
- *$key = sub {
- my $self = shift;
- unless ( @_ ) {
- return () unless $self->{values}->{resources};
- return map { $_->[1] }
- grep { $_->[0] eq $key }
- @{ $self->{values}->{resources} };
- }
- return $self->{values}->{resources}->{$key} unless @_;
- my $uri = shift or die(
- "Did not provide a value to $key()"
- );
- $self->resources( $key => $uri );
- return 1;
- };
-}
-
-foreach my $key ( grep { $_ ne "resources" } @tuple_keys) {
- *$key = sub {
- my $self = shift;
- return $self->{values}->{$key} unless @_;
- my @added;
- while ( @_ ) {
- my $module = shift or last;
- my $version = shift || 0;
- push @added, [ $module, $version ];
- }
- push @{ $self->{values}->{$key} }, @added;
- return map {@$_} @added;
- };
-}
-
-# Resource handling
-my %lc_resource = map { $_ => 1 } qw{
- homepage
- license
- bugtracker
- repository
-};
-
-sub resources {
- my $self = shift;
- while ( @_ ) {
- my $name = shift or last;
- my $value = shift or next;
- if ( $name eq lc $name and ! $lc_resource{$name} ) {
- die("Unsupported reserved lowercase resource '$name'");
- }
- $self->{values}->{resources} ||= [];
- push @{ $self->{values}->{resources} }, [ $name, $value ];
- }
- $self->{values}->{resources};
-}
-
-# Aliases for build_requires that will have alternative
-# meanings in some future version of META.yml.
-sub test_requires { shift->build_requires(@_) }
-sub install_requires { shift->build_requires(@_) }
-
-# Aliases for installdirs options
-sub install_as_core { $_[0]->installdirs('perl') }
-sub install_as_cpan { $_[0]->installdirs('site') }
-sub install_as_site { $_[0]->installdirs('site') }
-sub install_as_vendor { $_[0]->installdirs('vendor') }
-
-sub dynamic_config {
- my $self = shift;
- unless ( @_ ) {
- warn "You MUST provide an explicit true/false value to dynamic_config\n";
- return $self;
- }
- $self->{values}->{dynamic_config} = $_[0] ? 1 : 0;
- return 1;
-}
-
-sub perl_version {
- my $self = shift;
- return $self->{values}->{perl_version} unless @_;
- my $version = shift or die(
- "Did not provide a value to perl_version()"
- );
-
- # 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;
-}
-
-#Stolen from M::B
-my %license_urls = (
- perl => 'http://dev.perl.org/licenses/',
- apache => 'http://apache.org/licenses/LICENSE-2.0',
- artistic => 'http://opensource.org/licenses/artistic-license.php',
- artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php',
- lgpl => 'http://opensource.org/licenses/lgpl-license.php',
- lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php',
- lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html',
- bsd => 'http://opensource.org/licenses/bsd-license.php',
- gpl => 'http://opensource.org/licenses/gpl-license.php',
- gpl2 => 'http://opensource.org/licenses/gpl-2.0.php',
- gpl3 => 'http://opensource.org/licenses/gpl-3.0.html',
- mit => 'http://opensource.org/licenses/mit-license.php',
- mozilla => 'http://opensource.org/licenses/mozilla1.1.php',
- open_source => undef,
- unrestricted => undef,
- restrictive => undef,
- unknown => undef,
-);
-
-sub license {
- my $self = shift;
- return $self->{values}->{license} unless @_;
- my $license = shift or die(
- 'Did not provide a value to license()'
- );
- $self->{values}->{license} = $license;
-
- # Automatically fill in license URLs
- if ( $license_urls{$license} ) {
- $self->resources( license => $license_urls{$license} );
- }
-
- return 1;
-}
-
-sub all_from {
- my ( $self, $file ) = @_;
-
- unless ( defined($file) ) {
- my $name = $self->name or die(
- "all_from called with no args without setting name() first"
- );
- $file = join('/', 'lib', split(/-/, $name)) . '.pm';
- $file =~ s{.*/}{} unless -e $file;
- unless ( -e $file ) {
- die("all_from cannot find $file from $name");
- }
- }
- unless ( -f $file ) {
- die("The path '$file' does not exist, or is not a file");
- }
-
- # Some methods pull from POD instead of code.
- # If there is a matching .pod, use that instead
- my $pod = $file;
- $pod =~ s/\.pm$/.pod/i;
- $pod = $file unless -e $pod;
-
- # Pull the different values
- $self->name_from($file) unless $self->name;
- $self->version_from($file) unless $self->version;
- $self->perl_version_from($file) unless $self->perl_version;
- $self->author_from($pod) unless $self->author;
- $self->license_from($pod) unless $self->license;
- $self->abstract_from($pod) unless $self->abstract;
-
- return 1;
-}
-
-sub provides {
- my $self = shift;
- my $provides = ( $self->{values}->{provides} ||= {} );
- %$provides = (%$provides, @_) if @_;
- return $provides;
-}
-
-sub auto_provides {
- my $self = shift;
- return $self unless $self->is_admin;
- unless (-e 'MANIFEST') {
- warn "Cannot deduce auto_provides without a MANIFEST, skipping\n";
- return $self;
- }
- # Avoid spurious warnings as we are not checking manifest here.
- local $SIG{__WARN__} = sub {1};
- require ExtUtils::Manifest;
- local *ExtUtils::Manifest::manicheck = sub { return };
-
- require Module::Build;
- my $build = Module::Build->new(
- dist_name => $self->name,
- dist_version => $self->version,
- license => $self->license,
- );
- $self->provides( %{ $build->find_dist_packages || {} } );
-}
-
-sub feature {
- my $self = shift;
- my $name = shift;
- my $features = ( $self->{values}->{features} ||= [] );
- my $mods;
-
- if ( @_ == 1 and ref( $_[0] ) ) {
- # The user used ->feature like ->features by passing in the second
- # argument as a reference. Accomodate for that.
- $mods = $_[0];
- } else {
- $mods = \@_;
- }
-
- my $count = 0;
- push @$features, (
- $name => [
- map {
- ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_
- } @$mods
- ]
- );
-
- return @$features;
-}
-
-sub features {
- my $self = shift;
- while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) {
- $self->feature( $name, @$mods );
- }
- return $self->{values}->{features}
- ? @{ $self->{values}->{features} }
- : ();
-}
-
-sub no_index {
- my $self = shift;
- my $type = shift;
- push @{ $self->{values}->{no_index}->{$type} }, @_ if $type;
- return $self->{values}->{no_index};
-}
-
-sub read {
- my $self = shift;
- $self->include_deps( 'YAML::Tiny', 0 );
-
- require YAML::Tiny;
- my $data = YAML::Tiny::LoadFile('META.yml');
-
- # Call methods explicitly in case user has already set some values.
- while ( my ( $key, $value ) = each %$data ) {
- next unless $self->can($key);
- if ( ref $value eq 'HASH' ) {
- while ( my ( $module, $version ) = each %$value ) {
- $self->can($key)->($self, $module => $version );
- }
- } else {
- $self->can($key)->($self, $value);
- }
- }
- return $self;
-}
-
-sub write {
- my $self = shift;
- return $self unless $self->is_admin;
- $self->admin->write_meta;
- return $self;
-}
-
-sub version_from {
- require ExtUtils::MM_Unix;
- my ( $self, $file ) = @_;
- $self->version( ExtUtils::MM_Unix->parse_version($file) );
-}
-
-sub abstract_from {
- require ExtUtils::MM_Unix;
- my ( $self, $file ) = @_;
- $self->abstract(
- bless(
- { DISTNAME => $self->name },
- 'ExtUtils::MM_Unix'
- )->parse_abstract($file)
- );
-}
-
-# Add both distribution and module name
-sub name_from {
- my ($self, $file) = @_;
- if (
- Module::Install::_read($file) =~ m/
- ^ \s*
- package \s*
- ([\w:]+)
- \s* ;
- /ixms
- ) {
- my ($name, $module_name) = ($1, $1);
- $name =~ s{::}{-}g;
- $self->name($name);
- unless ( $self->module_name ) {
- $self->module_name($module_name);
- }
- } else {
- die("Cannot determine name from $file\n");
- }
-}
-
-sub perl_version_from {
- my $self = shift;
- if (
- Module::Install::_read($_[0]) =~ m/
- ^
- (?:use|require) \s*
- v?
- ([\d_\.]+)
- \s* ;
- /ixms
- ) {
- my $perl_version = $1;
- $perl_version =~ s{_}{}g;
- $self->perl_version($perl_version);
- } else {
- warn "Cannot determine perl version info from $_[0]\n";
- return;
- }
-}
-
-sub author_from {
- my $self = shift;
- my $content = Module::Install::_read($_[0]);
- if ($content =~ m/
- =head \d \s+ (?:authors?)\b \s*
- ([^\n]*)
- |
- =head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s*
- .*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s*
- ([^\n]*)
- /ixms) {
- my $author = $1 || $2;
- $author =~ s{E<lt>}{<}g;
- $author =~ s{E<gt>}{>}g;
- $self->author($author);
- } else {
- warn "Cannot determine author info from $_[0]\n";
- }
-}
-
-sub license_from {
- my $self = shift;
- if (
- Module::Install::_read($_[0]) =~ m/
- (
- =head \d \s+
- (?:licen[cs]e|licensing|copyright|legal)\b
- .*?
- )
- (=head\\d.*|=cut.*|)
- \z
- /ixms ) {
- my $license_text = $1;
- my @phrases = (
- 'under the same (?:terms|license) as (?:perl|the perl programming language) itself' => 'perl', 1,
- 'GNU general public license' => 'gpl', 1,
- 'GNU public license' => 'gpl', 1,
- 'GNU lesser general public license' => 'lgpl', 1,
- 'GNU lesser public license' => 'lgpl', 1,
- 'GNU library general public license' => 'lgpl', 1,
- 'GNU library public license' => 'lgpl', 1,
- 'BSD license' => 'bsd', 1,
- 'Artistic license' => 'artistic', 1,
- 'GPL' => 'gpl', 1,
- 'LGPL' => 'lgpl', 1,
- 'BSD' => 'bsd', 1,
- 'Artistic' => 'artistic', 1,
- 'MIT' => 'mit', 1,
- 'proprietary' => 'proprietary', 0,
- );
- while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
- $pattern =~ s{\s+}{\\s+}g;
- if ( $license_text =~ /\b$pattern\b/i ) {
- $self->license($license);
- return 1;
- }
- }
- }
-
- warn "Cannot determine license info from $_[0]\n";
- return 'unknown';
-}
-
-sub _extract_bugtracker {
- my @links = $_[0] =~ m#L<(\Qhttp://rt.cpan.org/\E[^>]+)>#g;
- my %links;
- @links{@links}=();
- @links=keys %links;
- return @links;
-}
-
-sub bugtracker_from {
- my $self = shift;
- my $content = Module::Install::_read($_[0]);
- my @links = _extract_bugtracker($content);
- unless ( @links ) {
- warn "Cannot determine bugtracker info from $_[0]\n";
- return 0;
- }
- if ( @links > 1 ) {
- warn "Found more than on rt.cpan.org link in $_[0]\n";
- return 0;
- }
-
- # Set the bugtracker
- bugtracker( $links[0] );
- return 1;
-}
-
-sub requires_from {
- my $self = shift;
- my $content = Module::Install::_readperl($_[0]);
- my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
- while ( @requires ) {
- my $module = shift @requires;
- my $version = shift @requires;
- $self->requires( $module => $version );
- }
-}
-
-sub test_requires_from {
- my $self = shift;
- my $content = Module::Install::_readperl($_[0]);
- my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
- while ( @requires ) {
- my $module = shift @requires;
- my $version = shift @requires;
- $self->test_requires( $module => $version );
- }
-}
-
-# 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) ) {
- # Numify
- $v = $v + 0;
- }
- return $v;
-}
-
-
-
-
-
-######################################################################
-# MYMETA Support
-
-sub WriteMyMeta {
- die "WriteMyMeta has been deprecated";
-}
-
-sub write_mymeta_yaml {
- my $self = shift;
-
- # We need YAML::Tiny to write the MYMETA.yml file
- unless ( eval { require YAML::Tiny; 1; } ) {
- return 1;
- }
-
- # Generate the data
- my $meta = $self->_write_mymeta_data or return 1;
-
- # Save as the MYMETA.yml file
- print "Writing MYMETA.yml\n";
- YAML::Tiny::DumpFile('MYMETA.yml', $meta);
-}
-
-sub write_mymeta_json {
- my $self = shift;
-
- # We need JSON to write the MYMETA.json file
- unless ( eval { require JSON; 1; } ) {
- return 1;
- }
-
- # Generate the data
- my $meta = $self->_write_mymeta_data or return 1;
-
- # Save as the MYMETA.yml file
- print "Writing MYMETA.json\n";
- Module::Install::_write(
- 'MYMETA.json',
- JSON->new->pretty(1)->canonical->encode($meta),
- );
-}
-
-sub _write_mymeta_data {
- my $self = shift;
-
- # If there's no existing META.yml there is nothing we can do
- return undef unless -f 'META.yml';
-
- # We need Parse::CPAN::Meta to load the file
- unless ( eval { require Parse::CPAN::Meta; 1; } ) {
- return undef;
- }
-
- # 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
- my @yaml = Parse::CPAN::Meta::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} } };
- }
-
- return $meta;
-}
-
-1;
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
deleted file mode 100644
index f2f99df..0000000
--- a/inc/Module/Install/Win32.pm
+++ /dev/null
@@ -1,64 +0,0 @@
-#line 1
-package Module::Install::Win32;
-
-use strict;
-use Module::Install::Base ();
-
-use vars qw{$VERSION @ISA $ISCORE};
-BEGIN {
- $VERSION = '0.91';
- @ISA = 'Module::Install::Base';
- $ISCORE = 1;
-}
-
-# determine if the user needs nmake, and download it if needed
-sub check_nmake {
- my $self = shift;
- $self->load('can_run');
- $self->load('get_file');
-
- require Config;
- return unless (
- $^O eq 'MSWin32' and
- $Config::Config{make} and
- $Config::Config{make} =~ /^nmake\b/i and
- ! $self->can_run('nmake')
- );
-
- print "The required 'nmake' executable not found, fetching it...\n";
-
- require File::Basename;
- my $rv = $self->get_file(
- url => 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe',
- ftp_url => 'ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe',
- local_dir => File::Basename::dirname($^X),
- size => 51928,
- run => 'Nmake15.exe /o > nul',
- check_for => 'Nmake.exe',
- remove => 1,
- );
-
- die <<'END_MESSAGE' unless $rv;
-
--------------------------------------------------------------------------------
-
-Since you are using Microsoft Windows, you will need the 'nmake' utility
-before installation. It's available at:
-
- http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe
- or
- ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe
-
-Please download the file manually, save it to a directory in %PATH% (e.g.
-C:\WINDOWS\COMMAND\), then launch the MS-DOS command line shell, "cd" to
-that directory, and run "Nmake15.exe" from there; that will create the
-'nmake.exe' file needed by this module.
-
-You may then resume the installation process described in README.
-
--------------------------------------------------------------------------------
-END_MESSAGE
-
-}
-
-1;
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
deleted file mode 100644
index 12471e5..0000000
--- a/inc/Module/Install/WriteAll.pm
+++ /dev/null
@@ -1,60 +0,0 @@
-#line 1
-package Module::Install::WriteAll;
-
-use strict;
-use Module::Install::Base ();
-
-use vars qw{$VERSION @ISA $ISCORE};
-BEGIN {
- $VERSION = '0.91';;
- @ISA = qw{Module::Install::Base};
- $ISCORE = 1;
-}
-
-sub WriteAll {
- my $self = shift;
- my %args = (
- meta => 1,
- sign => 0,
- inline => 0,
- check_nmake => 1,
- @_,
- );
-
- $self->sign(1) if $args{sign};
- $self->admin->WriteAll(%args) if $self->is_admin;
-
- $self->check_nmake if $args{check_nmake};
- unless ( $self->makemaker_args->{PL_FILES} ) {
- $self->makemaker_args( PL_FILES => {} );
- }
-
- # Until ExtUtils::MakeMaker support MYMETA.yml, make sure
- # we clean it up properly ourself.
- $self->realclean_files('MYMETA.yml');
-
- if ( $args{inline} ) {
- $self->Inline->write;
- } else {
- $self->Makefile->write;
- }
-
- # The Makefile write process adds a couple of dependencies,
- # so write the META.yml files after the Makefile.
- if ( $args{meta} ) {
- $self->Meta->write;
- }
-
- # Experimental support for MYMETA
- if ( $ENV{X_MYMETA} ) {
- if ( $ENV{X_MYMETA} eq 'JSON' ) {
- $self->Meta->write_mymeta_json;
- } else {
- $self->Meta->write_mymeta_yaml;
- }
- }
-
- return 1;
-}
-
-1;
diff --git a/inc/PerlIO.pm b/inc/PerlIO.pm
deleted file mode 100644
index 19c4a47..0000000
--- a/inc/PerlIO.pm
+++ /dev/null
@@ -1,33 +0,0 @@
-#line 1
-package PerlIO;
-
-our $VERSION = '1.04';
-
-# Map layer name to package that defines it
-our %alias;
-
-sub import
-{
- my $class = shift;
- while (@_)
- {
- my $layer = shift;
- if (exists $alias{$layer})
- {
- $layer = $alias{$layer}
- }
- else
- {
- $layer = "${class}::$layer";
- }
- eval "require $layer";
- warn $@ if $@;
- }
-}
-
-sub F_UTF8 () { 0x8000 }
-
-1;
-__END__
-
-#line 344
diff --git a/inc/Test/Builder.pm b/inc/Test/Builder.pm
deleted file mode 100644
index 795361f..0000000
--- a/inc/Test/Builder.pm
+++ /dev/null
@@ -1,1589 +0,0 @@
-#line 1
-package Test::Builder;
-
-use 5.006;
-use strict;
-use warnings;
-
-our $VERSION = '0.94';
-$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
-
-BEGIN {
- if( $] < 5.008 ) {
- require Test::Builder::IO::Scalar;
- }
-}
-
-
-# Make Test::Builder thread-safe for ithreads.
-BEGIN {
- use Config;
- # Load threads::shared when threads are turned on.
- # 5.8.0's threads are so busted we no longer support them.
- if( $] >= 5.008001 && $Config{useithreads} && $INC{'threads.pm'} ) {
- require threads::shared;
-
- # Hack around YET ANOTHER threads::shared bug. It would
- # occassionally forget the contents of the variable when sharing it.
- # So we first copy the data, then share, then put our copy back.
- *share = sub (\[$@%]) {
- my $type = ref $_[0];
- my $data;
-
- if( $type eq 'HASH' ) {
- %$data = %{ $_[0] };
- }
- elsif( $type eq 'ARRAY' ) {
- @$data = @{ $_[0] };
- }
- elsif( $type eq 'SCALAR' ) {
- $$data = ${ $_[0] };
- }
- else {
- die( "Unknown type: " . $type );
- }
-
- $_[0] = &threads::shared::share( $_[0] );
-
- if( $type eq 'HASH' ) {
- %{ $_[0] } = %$data;
- }
- elsif( $type eq 'ARRAY' ) {
- @{ $_[0] } = @$data;
- }
- elsif( $type eq 'SCALAR' ) {
- ${ $_[0] } = $$data;
- }
- else {
- die( "Unknown type: " . $type );
- }
-
- return $_[0];
- };
- }
- # 5.8.0's threads::shared is busted when threads are off
- # and earlier Perls just don't have that module at all.
- else {
- *share = sub { return $_[0] };
- *lock = sub { 0 };
- }
-}
-
-#line 117
-
-our $Test = Test::Builder->new;
-
-sub new {
- my($class) = shift;
- $Test ||= $class->create;
- return $Test;
-}
-
-#line 139
-
-sub create {
- my $class = shift;
-
- my $self = bless {}, $class;
- $self->reset;
-
- return $self;
-}
-
-#line 168
-
-sub child {
- my( $self, $name ) = @_;
-
- if( $self->{Child_Name} ) {
- $self->croak("You already have a child named ($self->{Child_Name}) running");
- }
-
- my $child = bless {}, ref $self;
- $child->reset;
-
- # Add to our indentation
- $child->_indent( $self->_indent . ' ' );
- $child->{$_} = $self->{$_} foreach qw{Out_FH Todo_FH Fail_FH};
-
- # This will be reset in finalize. We do this here lest one child failure
- # cause all children to fail.
- $child->{Child_Error} = $?;
- $? = 0;
- $child->{Parent} = $self;
- $child->{Name} = $name || "Child of " . $self->name;
- $self->{Child_Name} = $child->name;
- return $child;
-}
-
-
-#line 201
-
-sub subtest {
- my $self = shift;
- my($name, $subtests) = @_;
-
- if ('CODE' ne ref $subtests) {
- $self->croak("subtest()'s second argument must be a code ref");
- }
-
- # Turn the child into the parent so anyone who has stored a copy of
- # the Test::Builder singleton will get the child.
- my $child = $self->child($name);
- my %parent = %$self;
- %$self = %$child;
-
- my $error;
- if( !eval { $subtests->(); 1 } ) {
- $error = $@;
- }
-
- # Restore the parent and the copied child.
- %$child = %$self;
- %$self = %parent;
-
- # Die *after* we restore the parent.
- die $error if $error and !eval { $error->isa('Test::Builder::Exception') };
-
- return $child->finalize;
-}
-
-
-#line 250
-
-sub finalize {
- my $self = shift;
-
- return unless $self->parent;
- if( $self->{Child_Name} ) {
- $self->croak("Can't call finalize() with child ($self->{Child_Name}) active");
- }
- $self->_ending;
-
- # XXX This will only be necessary for TAP envelopes (we think)
- #$self->_print( $self->is_passing ? "PASS\n" : "FAIL\n" );
-
- my $ok = 1;
- $self->parent->{Child_Name} = undef;
- if ( $self->{Skip_All} ) {
- $self->parent->skip($self->{Skip_All});
- }
- elsif ( not @{ $self->{Test_Results} } ) {
- $self->parent->ok( 0, sprintf q[No tests run for subtest "%s"], $self->name );
- }
- else {
- $self->parent->ok( $self->is_passing, $self->name );
- }
- $? = $self->{Child_Error};
- delete $self->{Parent};
-
- return $self->is_passing;
-}
-
-sub _indent {
- my $self = shift;
-
- if( @_ ) {
- $self->{Indent} = shift;
- }
-
- return $self->{Indent};
-}
-
-#line 300
-
-sub parent { shift->{Parent} }
-
-#line 312
-
-sub name { shift->{Name} }
-
-sub DESTROY {
- my $self = shift;
- if ( $self->parent ) {
- my $name = $self->name;
- $self->diag(<<"FAIL");
-Child ($name) exited without calling finalize()
-FAIL
- $self->parent->{In_Destroy} = 1;
- $self->parent->ok(0, $name);
- }
-}
-
-#line 336
-
-our $Level;
-
-sub reset { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
- my($self) = @_;
-
- # We leave this a global because it has to be localized and localizing
- # hash keys is just asking for pain. Also, it was documented.
- $Level = 1;
-
- $self->{Name} = $0;
- $self->is_passing(1);
- $self->{Ending} = 0;
- $self->{Have_Plan} = 0;
- $self->{No_Plan} = 0;
- $self->{Have_Output_Plan} = 0;
-
- $self->{Original_Pid} = $$;
- $self->{Child_Name} = undef;
- $self->{Indent} ||= '';
-
- share( $self->{Curr_Test} );
- $self->{Curr_Test} = 0;
- $self->{Test_Results} = &share( [] );
-
- $self->{Exported_To} = undef;
- $self->{Expected_Tests} = 0;
-
- $self->{Skip_All} = 0;
-
- $self->{Use_Nums} = 1;
-
- $self->{No_Header} = 0;
- $self->{No_Ending} = 0;
-
- $self->{Todo} = undef;
- $self->{Todo_Stack} = [];
- $self->{Start_Todo} = 0;
- $self->{Opened_Testhandles} = 0;
-
- $self->_dup_stdhandles;
-
- return;
-}
-
-#line 414
-
-my %plan_cmds = (
- no_plan => \&no_plan,
- skip_all => \&skip_all,
- tests => \&_plan_tests,
-);
-
-sub plan {
- my( $self, $cmd, $arg ) = @_;
-
- return unless $cmd;
-
- local $Level = $Level + 1;
-
- $self->croak("You tried to plan twice") if $self->{Have_Plan};
-
- if( my $method = $plan_cmds{$cmd} ) {
- local $Level = $Level + 1;
- $self->$method($arg);
- }
- else {
- my @args = grep { defined } ( $cmd, $arg );
- $self->croak("plan() doesn't understand @args");
- }
-
- return 1;
-}
-
-
-sub _plan_tests {
- my($self, $arg) = @_;
-
- if($arg) {
- local $Level = $Level + 1;
- return $self->expected_tests($arg);
- }
- elsif( !defined $arg ) {
- $self->croak("Got an undefined number of tests");
- }
- else {
- $self->croak("You said to run 0 tests");
- }
-
- return;
-}
-
-
-#line 470
-
-sub expected_tests {
- my $self = shift;
- my($max) = @_;
-
- if(@_) {
- $self->croak("Number of tests must be a positive integer. You gave it '$max'")
- unless $max =~ /^\+?\d+$/;
-
- $self->{Expected_Tests} = $max;
- $self->{Have_Plan} = 1;
-
- $self->_output_plan($max) unless $self->no_header;
- }
- return $self->{Expected_Tests};
-}
-
-#line 494
-
-sub no_plan {
- my($self, $arg) = @_;
-
- $self->carp("no_plan takes no arguments") if $arg;
-
- $self->{No_Plan} = 1;
- $self->{Have_Plan} = 1;
-
- return 1;
-}
-
-
-#line 528
-
-sub _output_plan {
- my($self, $max, $directive, $reason) = @_;
-
- $self->carp("The plan was already output") if $self->{Have_Output_Plan};
-
- my $plan = "1..$max";
- $plan .= " # $directive" if defined $directive;
- $plan .= " $reason" if defined $reason;
-
- $self->_print("$plan\n");
-
- $self->{Have_Output_Plan} = 1;
-
- return;
-}
-
-#line 579
-
-sub done_testing {
- my($self, $num_tests) = @_;
-
- # If done_testing() specified the number of tests, shut off no_plan.
- if( defined $num_tests ) {
- $self->{No_Plan} = 0;
- }
- else {
- $num_tests = $self->current_test;
- }
-
- if( $self->{Done_Testing} ) {
- my($file, $line) = @{$self->{Done_Testing}}[1,2];
- $self->ok(0, "done_testing() was already called at $file line $line");
- return;
- }
-
- $self->{Done_Testing} = [caller];
-
- if( $self->expected_tests && $num_tests != $self->expected_tests ) {
- $self->ok(0, "planned to run @{[ $self->expected_tests ]} ".
- "but done_testing() expects $num_tests");
- }
- else {
- $self->{Expected_Tests} = $num_tests;
- }
-
- $self->_output_plan($num_tests) unless $self->{Have_Output_Plan};
-
- $self->{Have_Plan} = 1;
-
- # The wrong number of tests were run
- $self->is_passing(0) if $self->{Expected_Tests} != $self->{Curr_Test};
-
- # No tests were run
- $self->is_passing(0) if $self->{Curr_Test} == 0;
-
- return 1;
-}
-
-
-#line 630
-
-sub has_plan {
- my $self = shift;
-
- return( $self->{Expected_Tests} ) if $self->{Expected_Tests};
- return('no_plan') if $self->{No_Plan};
- return(undef);
-}
-
-#line 647
-
-sub skip_all {
- my( $self, $reason ) = @_;
-
- $self->{Skip_All} = $self->parent ? $reason : 1;
-
- $self->_output_plan(0, "SKIP", $reason) unless $self->no_header;
- if ( $self->parent ) {
- die bless {} => 'Test::Builder::Exception';
- }
- exit(0);
-}
-
-#line 672
-
-sub exported_to {
- my( $self, $pack ) = @_;
-
- if( defined $pack ) {
- $self->{Exported_To} = $pack;
- }
- return $self->{Exported_To};
-}
-
-#line 702
-
-sub ok {
- my( $self, $test, $name ) = @_;
-
- if ( $self->{Child_Name} and not $self->{In_Destroy} ) {
- $name = 'unnamed test' unless defined $name;
- $self->is_passing(0);
- $self->croak("Cannot run test ($name) with active children");
- }
- # $test might contain an object which we don't want to accidentally
- # store, so we turn it into a boolean.
- $test = $test ? 1 : 0;
-
- lock $self->{Curr_Test};
- $self->{Curr_Test}++;
-
- # In case $name is a string overloaded object, force it to stringify.
- $self->_unoverload_str( \$name );
-
- $self->diag(<<"ERR") if defined $name and $name =~ /^[\d\s]+$/;
- You named your test '$name'. You shouldn't use numbers for your test names.
- Very confusing.
-ERR
-
- # Capture the value of $TODO for the rest of this ok() call
- # so it can more easily be found by other routines.
- my $todo = $self->todo();
- my $in_todo = $self->in_todo;
- local $self->{Todo} = $todo if $in_todo;
-
- $self->_unoverload_str( \$todo );
-
- my $out;
- my $result = &share( {} );
-
- unless($test) {
- $out .= "not ";
- @$result{ 'ok', 'actual_ok' } = ( ( $self->in_todo ? 1 : 0 ), 0 );
- }
- else {
- @$result{ 'ok', 'actual_ok' } = ( 1, $test );
- }
-
- $out .= "ok";
- $out .= " $self->{Curr_Test}" if $self->use_numbers;
-
- if( defined $name ) {
- $name =~ s|#|\\#|g; # # in a name can confuse Test::Harness.
- $out .= " - $name";
- $result->{name} = $name;
- }
- else {
- $result->{name} = '';
- }
-
- if( $self->in_todo ) {
- $out .= " # TODO $todo";
- $result->{reason} = $todo;
- $result->{type} = 'todo';
- }
- else {
- $result->{reason} = '';
- $result->{type} = '';
- }
-
- $self->{Test_Results}[ $self->{Curr_Test} - 1 ] = $result;
- $out .= "\n";
-
- $self->_print($out);
-
- unless($test) {
- my $msg = $self->in_todo ? "Failed (TODO)" : "Failed";
- $self->_print_to_fh( $self->_diag_fh, "\n" ) if $ENV{HARNESS_ACTIVE};
-
- my( undef, $file, $line ) = $self->caller;
- if( defined $name ) {
- $self->diag(qq[ $msg test '$name'\n]);
- $self->diag(qq[ at $file line $line.\n]);
- }
- else {
- $self->diag(qq[ $msg test at $file line $line.\n]);
- }
- }
-
- $self->is_passing(0) unless $test || $self->in_todo;
-
- # Check that we haven't violated the plan
- $self->_check_is_passing_plan();
-
- return $test ? 1 : 0;
-}
-
-
-# Check that we haven't yet violated the plan and set
-# is_passing() accordingly
-sub _check_is_passing_plan {
- my $self = shift;
-
- my $plan = $self->has_plan;
- return unless defined $plan; # no plan yet defined
- return unless $plan !~ /\D/; # no numeric plan
- $self->is_passing(0) if $plan < $self->{Curr_Test};
-}
-
-
-sub _unoverload {
- my $self = shift;
- my $type = shift;
-
- $self->_try(sub { require overload; }, die_on_fail => 1);
-
- foreach my $thing (@_) {
- if( $self->_is_object($$thing) ) {
- if( my $string_meth = overload::Method( $$thing, $type ) ) {
- $$thing = $$thing->$string_meth();
- }
- }
- }
-
- return;
-}
-
-sub _is_object {
- my( $self, $thing ) = @_;
-
- return $self->_try( sub { ref $thing && $thing->isa('UNIVERSAL') } ) ? 1 : 0;
-}
-
-sub _unoverload_str {
- my $self = shift;
-
- return $self->_unoverload( q[""], @_ );
-}
-
-sub _unoverload_num {
- my $self = shift;
-
- $self->_unoverload( '0+', @_ );
-
- for my $val (@_) {
- next unless $self->_is_dualvar($$val);
- $$val = $$val + 0;
- }
-
- return;
-}
-
-# This is a hack to detect a dualvar such as $!
-sub _is_dualvar {
- my( $self, $val ) = @_;
-
- # Objects are not dualvars.
- return 0 if ref $val;
-
- no warnings 'numeric';
- my $numval = $val + 0;
- return $numval != 0 and $numval ne $val ? 1 : 0;
-}
-
-#line 876
-
-sub is_eq {
- my( $self, $got, $expect, $name ) = @_;
- local $Level = $Level + 1;
-
- $self->_unoverload_str( \$got, \$expect );
-
- if( !defined $got || !defined $expect ) {
- # undef only matches undef and nothing else
- my $test = !defined $got && !defined $expect;
-
- $self->ok( $test, $name );
- $self->_is_diag( $got, 'eq', $expect ) unless $test;
- return $test;
- }
-
- return $self->cmp_ok( $got, 'eq', $expect, $name );
-}
-
-sub is_num {
- my( $self, $got, $expect, $name ) = @_;
- local $Level = $Level + 1;
-
- $self->_unoverload_num( \$got, \$expect );
-
- if( !defined $got || !defined $expect ) {
- # undef only matches undef and nothing else
- my $test = !defined $got && !defined $expect;
-
- $self->ok( $test, $name );
- $self->_is_diag( $got, '==', $expect ) unless $test;
- return $test;
- }
-
- return $self->cmp_ok( $got, '==', $expect, $name );
-}
-
-sub _diag_fmt {
- my( $self, $type, $val ) = @_;
-
- if( defined $$val ) {
- if( $type eq 'eq' or $type eq 'ne' ) {
- # quote and force string context
- $$val = "'$$val'";
- }
- else {
- # force numeric context
- $self->_unoverload_num($val);
- }
- }
- else {
- $$val = 'undef';
- }
-
- return;
-}
-
-sub _is_diag {
- my( $self, $got, $type, $expect ) = @_;
-
- $self->_diag_fmt( $type, $_ ) for \$got, \$expect;
-
- local $Level = $Level + 1;
- return $self->diag(<<"DIAGNOSTIC");
- got: $got
- expected: $expect
-DIAGNOSTIC
-
-}
-
-sub _isnt_diag {
- my( $self, $got, $type ) = @_;
-
- $self->_diag_fmt( $type, \$got );
-
- local $Level = $Level + 1;
- return $self->diag(<<"DIAGNOSTIC");
- got: $got
- expected: anything else
-DIAGNOSTIC
-}
-
-#line 973
-
-sub isnt_eq {
- my( $self, $got, $dont_expect, $name ) = @_;
- local $Level = $Level + 1;
-
- if( !defined $got || !defined $dont_expect ) {
- # undef only matches undef and nothing else
- my $test = defined $got || defined $dont_expect;
-
- $self->ok( $test, $name );
- $self->_isnt_diag( $got, 'ne' ) unless $test;
- return $test;
- }
-
- return $self->cmp_ok( $got, 'ne', $dont_expect, $name );
-}
-
-sub isnt_num {
- my( $self, $got, $dont_expect, $name ) = @_;
- local $Level = $Level + 1;
-
- if( !defined $got || !defined $dont_expect ) {
- # undef only matches undef and nothing else
- my $test = defined $got || defined $dont_expect;
-
- $self->ok( $test, $name );
- $self->_isnt_diag( $got, '!=' ) unless $test;
- return $test;
- }
-
- return $self->cmp_ok( $got, '!=', $dont_expect, $name );
-}
-
-#line 1022
-
-sub like {
- my( $self, $this, $regex, $name ) = @_;
-
- local $Level = $Level + 1;
- return $self->_regex_ok( $this, $regex, '=~', $name );
-}
-
-sub unlike {
- my( $self, $this, $regex, $name ) = @_;
-
- local $Level = $Level + 1;
- return $self->_regex_ok( $this, $regex, '!~', $name );
-}
-
-#line 1046
-
-my %numeric_cmps = map { ( $_, 1 ) } ( "<", "<=", ">", ">=", "==", "!=", "<=>" );
-
-sub cmp_ok {
- my( $self, $got, $type, $expect, $name ) = @_;
-
- my $test;
- my $error;
- {
- ## no critic (BuiltinFunctions::ProhibitStringyEval)
-
- local( $@, $!, $SIG{__DIE__} ); # isolate eval
-
- my($pack, $file, $line) = $self->caller();
-
- $test = eval qq[
-#line 1 "cmp_ok [from $file line $line]"
-\$got $type \$expect;
-];
- $error = $@;
- }
- local $Level = $Level + 1;
- my $ok = $self->ok( $test, $name );
-
- # Treat overloaded objects as numbers if we're asked to do a
- # numeric comparison.
- my $unoverload
- = $numeric_cmps{$type}
- ? '_unoverload_num'
- : '_unoverload_str';
-
- $self->diag(<<"END") if $error;
-An error occurred while using $type:
-------------------------------------
-$error
-------------------------------------
-END
-
- unless($ok) {
- $self->$unoverload( \$got, \$expect );
-
- if( $type =~ /^(eq|==)$/ ) {
- $self->_is_diag( $got, $type, $expect );
- }
- elsif( $type =~ /^(ne|!=)$/ ) {
- $self->_isnt_diag( $got, $type );
- }
- else {
- $self->_cmp_diag( $got, $type, $expect );
- }
- }
- return $ok;
-}
-
-sub _cmp_diag {
- my( $self, $got, $type, $expect ) = @_;
-
- $got = defined $got ? "'$got'" : 'undef';
- $expect = defined $expect ? "'$expect'" : 'undef';
-
- local $Level = $Level + 1;
- return $self->diag(<<"DIAGNOSTIC");
- $got
- $type
- $expect
-DIAGNOSTIC
-}
-
-sub _caller_context {
- my $self = shift;
-
- my( $pack, $file, $line ) = $self->caller(1);
-
- my $code = '';
- $code .= "#line $line $file\n" if defined $file and defined $line;
-
- return $code;
-}
-
-#line 1145
-
-sub BAIL_OUT {
- my( $self, $reason ) = @_;
-
- $self->{Bailed_Out} = 1;
- $self->_print("Bail out! $reason");
- exit 255;
-}
-
-#line 1158
-
-{
- no warnings 'once';
- *BAILOUT = \&BAIL_OUT;
-}
-
-#line 1172
-
-sub skip {
- my( $self, $why ) = @_;
- $why ||= '';
- $self->_unoverload_str( \$why );
-
- lock( $self->{Curr_Test} );
- $self->{Curr_Test}++;
-
- $self->{Test_Results}[ $self->{Curr_Test} - 1 ] = &share(
- {
- 'ok' => 1,
- actual_ok => 1,
- name => '',
- type => 'skip',
- reason => $why,
- }
- );
-
- my $out = "ok";
- $out .= " $self->{Curr_Test}" if $self->use_numbers;
- $out .= " # skip";
- $out .= " $why" if length $why;
- $out .= "\n";
-
- $self->_print($out);
-
- return 1;
-}
-
-#line 1213
-
-sub todo_skip {
- my( $self, $why ) = @_;
- $why ||= '';
-
- lock( $self->{Curr_Test} );
- $self->{Curr_Test}++;
-
- $self->{Test_Results}[ $self->{Curr_Test} - 1 ] = &share(
- {
- 'ok' => 1,
- actual_ok => 0,
- name => '',
- type => 'todo_skip',
- reason => $why,
- }
- );
-
- my $out = "not ok";
- $out .= " $self->{Curr_Test}" if $self->use_numbers;
- $out .= " # TODO & SKIP $why\n";
-
- $self->_print($out);
-
- return 1;
-}
-
-#line 1293
-
-sub maybe_regex {
- my( $self, $regex ) = @_;
- my $usable_regex = undef;
-
- return $usable_regex unless defined $regex;
-
- my( $re, $opts );
-
- # Check for qr/foo/
- if( _is_qr($regex) ) {
- $usable_regex = $regex;
- }
- # Check for '/foo/' or 'm,foo,'
- elsif(( $re, $opts ) = $regex =~ m{^ /(.*)/ (\w*) $ }sx or
- ( undef, $re, $opts ) = $regex =~ m,^ m([^\w\s]) (.+) \1 (\w*) $,sx
- )
- {
- $usable_regex = length $opts ? "(?$opts)$re" : $re;
- }
-
- return $usable_regex;
-}
-
-sub _is_qr {
- my $regex = shift;
-
- # is_regexp() checks for regexes in a robust manner, say if they're
- # blessed.
- return re::is_regexp($regex) if defined &re::is_regexp;
- return ref $regex eq 'Regexp';
-}
-
-sub _regex_ok {
- my( $self, $this, $regex, $cmp, $name ) = @_;
-
- my $ok = 0;
- my $usable_regex = $self->maybe_regex($regex);
- unless( defined $usable_regex ) {
- local $Level = $Level + 1;
- $ok = $self->ok( 0, $name );
- $self->diag(" '$regex' doesn't look much like a regex to me.");
- return $ok;
- }
-
- {
- ## no critic (BuiltinFunctions::ProhibitStringyEval)
-
- my $test;
- my $context = $self->_caller_context;
-
- local( $@, $!, $SIG{__DIE__} ); # isolate eval
-
- $test = eval $context . q{$test = $this =~ /$usable_regex/ ? 1 : 0};
-
- $test = !$test if $cmp eq '!~';
-
- local $Level = $Level + 1;
- $ok = $self->ok( $test, $name );
- }
-
- unless($ok) {
- $this = defined $this ? "'$this'" : 'undef';
- my $match = $cmp eq '=~' ? "doesn't match" : "matches";
-
- local $Level = $Level + 1;
- $self->diag( sprintf <<'DIAGNOSTIC', $this, $match, $regex );
- %s
- %13s '%s'
-DIAGNOSTIC
-
- }
-
- return $ok;
-}
-
-# I'm not ready to publish this. It doesn't deal with array return
-# values from the code or context.
-
-#line 1389
-
-sub _try {
- my( $self, $code, %opts ) = @_;
-
- my $error;
- my $return;
- {
- local $!; # eval can mess up $!
- local $@; # don't set $@ in the test
- local $SIG{__DIE__}; # don't trip an outside DIE handler.
- $return = eval { $code->() };
- $error = $@;
- }
-
- die $error if $error and $opts{die_on_fail};
-
- return wantarray ? ( $return, $error ) : $return;
-}
-
-#line 1418
-
-sub is_fh {
- my $self = shift;
- my $maybe_fh = shift;
- return 0 unless defined $maybe_fh;
-
- return 1 if ref $maybe_fh eq 'GLOB'; # its a glob ref
- return 1 if ref \$maybe_fh eq 'GLOB'; # its a glob
-
- return eval { $maybe_fh->isa("IO::Handle") } ||
- eval { tied($maybe_fh)->can('TIEHANDLE') };
-}
-
-#line 1461
-
-sub level {
- my( $self, $level ) = @_;
-
- if( defined $level ) {
- $Level = $level;
- }
- return $Level;
-}
-
-#line 1493
-
-sub use_numbers {
- my( $self, $use_nums ) = @_;
-
- if( defined $use_nums ) {
- $self->{Use_Nums} = $use_nums;
- }
- return $self->{Use_Nums};
-}
-
-#line 1526
-
-foreach my $attribute (qw(No_Header No_Ending No_Diag)) {
- my $method = lc $attribute;
-
- my $code = sub {
- my( $self, $no ) = @_;
-
- if( defined $no ) {
- $self->{$attribute} = $no;
- }
- return $self->{$attribute};
- };
-
- no strict 'refs'; ## no critic
- *{ __PACKAGE__ . '::' . $method } = $code;
-}
-
-#line 1579
-
-sub diag {
- my $self = shift;
-
- $self->_print_comment( $self->_diag_fh, @_ );
-}
-
-#line 1594
-
-sub note {
- my $self = shift;
-
- $self->_print_comment( $self->output, @_ );
-}
-
-sub _diag_fh {
- my $self = shift;
-
- local $Level = $Level + 1;
- return $self->in_todo ? $self->todo_output : $self->failure_output;
-}
-
-sub _print_comment {
- my( $self, $fh, @msgs ) = @_;
-
- return if $self->no_diag;
- return unless @msgs;
-
- # Prevent printing headers when compiling (i.e. -c)
- return if $^C;
-
- # Smash args together like print does.
- # Convert undef to 'undef' so its readable.
- my $msg = join '', map { defined($_) ? $_ : 'undef' } @msgs;
-
- # Escape the beginning, _print will take care of the rest.
- $msg =~ s/^/# /;
-
- local $Level = $Level + 1;
- $self->_print_to_fh( $fh, $msg );
-
- return 0;
-}
-
-#line 1644
-
-sub explain {
- my $self = shift;
-
- return map {
- ref $_
- ? do {
- $self->_try(sub { require Data::Dumper }, die_on_fail => 1);
-
- my $dumper = Data::Dumper->new( [$_] );
- $dumper->Indent(1)->Terse(1);
- $dumper->Sortkeys(1) if $dumper->can("Sortkeys");
- $dumper->Dump;
- }
- : $_
- } @_;
-}
-
-#line 1673
-
-sub _print {
- my $self = shift;
- return $self->_print_to_fh( $self->output, @_ );
-}
-
-sub _print_to_fh {
- my( $self, $fh, @msgs ) = @_;
-
- # Prevent printing headers when only compiling. Mostly for when
- # tests are deparsed with B::Deparse
- return if $^C;
-
- my $msg = join '', @msgs;
-
- local( $\, $", $, ) = ( undef, ' ', '' );
-
- # Escape each line after the first with a # so we don't
- # confuse Test::Harness.
- $msg =~ s{\n(?!\z)}{\n# }sg;
-
- # Stick a newline on the end if it needs it.
- $msg .= "\n" unless $msg =~ /\n\z/;
-
- return print $fh $self->_indent, $msg;
-}
-
-#line 1732
-
-sub output {
- my( $self, $fh ) = @_;
-
- if( defined $fh ) {
- $self->{Out_FH} = $self->_new_fh($fh);
- }
- return $self->{Out_FH};
-}
-
-sub failure_output {
- my( $self, $fh ) = @_;
-
- if( defined $fh ) {
- $self->{Fail_FH} = $self->_new_fh($fh);
- }
- return $self->{Fail_FH};
-}
-
-sub todo_output {
- my( $self, $fh ) = @_;
-
- if( defined $fh ) {
- $self->{Todo_FH} = $self->_new_fh($fh);
- }
- return $self->{Todo_FH};
-}
-
-sub _new_fh {
- my $self = shift;
- my($file_or_fh) = shift;
-
- my $fh;
- if( $self->is_fh($file_or_fh) ) {
- $fh = $file_or_fh;
- }
- elsif( ref $file_or_fh eq 'SCALAR' ) {
- # Scalar refs as filehandles was added in 5.8.
- if( $] >= 5.008 ) {
- open $fh, ">>", $file_or_fh
- or $self->croak("Can't open scalar ref $file_or_fh: $!");
- }
- # Emulate scalar ref filehandles with a tie.
- else {
- $fh = Test::Builder::IO::Scalar->new($file_or_fh)
- or $self->croak("Can't tie scalar ref $file_or_fh");
- }
- }
- else {
- open $fh, ">", $file_or_fh
- or $self->croak("Can't open test output log $file_or_fh: $!");
- _autoflush($fh);
- }
-
- return $fh;
-}
-
-sub _autoflush {
- my($fh) = shift;
- my $old_fh = select $fh;
- $| = 1;
- select $old_fh;
-
- return;
-}
-
-my( $Testout, $Testerr );
-
-sub _dup_stdhandles {
- my $self = shift;
-
- $self->_open_testhandles;
-
- # Set everything to unbuffered else plain prints to STDOUT will
- # come out in the wrong order from our own prints.
- _autoflush($Testout);
- _autoflush( \*STDOUT );
- _autoflush($Testerr);
- _autoflush( \*STDERR );
-
- $self->reset_outputs;
-
- return;
-}
-
-sub _open_testhandles {
- my $self = shift;
-
- return if $self->{Opened_Testhandles};
-
- # We dup STDOUT and STDERR so people can change them in their
- # test suites while still getting normal test output.
- open( $Testout, ">&STDOUT" ) or die "Can't dup STDOUT: $!";
- open( $Testerr, ">&STDERR" ) or die "Can't dup STDERR: $!";
-
- # $self->_copy_io_layers( \*STDOUT, $Testout );
- # $self->_copy_io_layers( \*STDERR, $Testerr );
-
- $self->{Opened_Testhandles} = 1;
-
- return;
-}
-
-sub _copy_io_layers {
- my( $self, $src, $dst ) = @_;
-
- $self->_try(
- sub {
- require PerlIO;
- my @src_layers = PerlIO::get_layers($src);
-
- binmode $dst, join " ", map ":$_", @src_layers if @src_layers;
- }
- );
-
- return;
-}
-
-#line 1857
-
-sub reset_outputs {
- my $self = shift;
-
- $self->output ($Testout);
- $self->failure_output($Testerr);
- $self->todo_output ($Testout);
-
- return;
-}
-
-#line 1883
-
-sub _message_at_caller {
- my $self = shift;
-
- local $Level = $Level + 1;
- my( $pack, $file, $line ) = $self->caller;
- return join( "", @_ ) . " at $file line $line.\n";
-}
-
-sub carp {
- my $self = shift;
- return warn $self->_message_at_caller(@_);
-}
-
-sub croak {
- my $self = shift;
- return die $self->_message_at_caller(@_);
-}
-
-
-#line 1923
-
-sub current_test {
- my( $self, $num ) = @_;
-
- lock( $self->{Curr_Test} );
- if( defined $num ) {
- $self->{Curr_Test} = $num;
-
- # If the test counter is being pushed forward fill in the details.
- my $test_results = $self->{Test_Results};
- if( $num > @$test_results ) {
- my $start = @$test_results ? @$test_results : 0;
- for( $start .. $num - 1 ) {
- $test_results->[$_] = &share(
- {
- 'ok' => 1,
- actual_ok => undef,
- reason => 'incrementing test number',
- type => 'unknown',
- name => undef
- }
- );
- }
- }
- # If backward, wipe history. Its their funeral.
- elsif( $num < @$test_results ) {
- $#{$test_results} = $num - 1;
- }
- }
- return $self->{Curr_Test};
-}
-
-#line 1971
-
-sub is_passing {
- my $self = shift;
-
- if( @_ ) {
- $self->{Is_Passing} = shift;
- }
-
- return $self->{Is_Passing};
-}
-
-
-#line 1993
-
-sub summary {
- my($self) = shift;
-
- return map { $_->{'ok'} } @{ $self->{Test_Results} };
-}
-
-#line 2048
-
-sub details {
- my $self = shift;
- return @{ $self->{Test_Results} };
-}
-
-#line 2077
-
-sub todo {
- my( $self, $pack ) = @_;
-
- return $self->{Todo} if defined $self->{Todo};
-
- local $Level = $Level + 1;
- my $todo = $self->find_TODO($pack);
- return $todo if defined $todo;
-
- return '';
-}
-
-#line 2099
-
-sub find_TODO {
- my( $self, $pack ) = @_;
-
- $pack = $pack || $self->caller(1) || $self->exported_to;
- return unless $pack;
-
- no strict 'refs'; ## no critic
- return ${ $pack . '::TODO' };
-}
-
-#line 2117
-
-sub in_todo {
- my $self = shift;
-
- local $Level = $Level + 1;
- return( defined $self->{Todo} || $self->find_TODO ) ? 1 : 0;
-}
-
-#line 2167
-
-sub todo_start {
- my $self = shift;
- my $message = @_ ? shift : '';
-
- $self->{Start_Todo}++;
- if( $self->in_todo ) {
- push @{ $self->{Todo_Stack} } => $self->todo;
- }
- $self->{Todo} = $message;
-
- return;
-}
-
-#line 2189
-
-sub todo_end {
- my $self = shift;
-
- if( !$self->{Start_Todo} ) {
- $self->croak('todo_end() called without todo_start()');
- }
-
- $self->{Start_Todo}--;
-
- if( $self->{Start_Todo} && @{ $self->{Todo_Stack} } ) {
- $self->{Todo} = pop @{ $self->{Todo_Stack} };
- }
- else {
- delete $self->{Todo};
- }
-
- return;
-}
-
-#line 2222
-
-sub caller { ## no critic (Subroutines::ProhibitBuiltinHomonyms)
- my( $self, $height ) = @_;
- $height ||= 0;
-
- my $level = $self->level + $height + 1;
- my @caller;
- do {
- @caller = CORE::caller( $level );
- $level--;
- } until @caller;
- return wantarray ? @caller : $caller[0];
-}
-
-#line 2239
-
-#line 2253
-
-#'#
-sub _sanity_check {
- my $self = shift;
-
- $self->_whoa( $self->{Curr_Test} < 0, 'Says here you ran a negative number of tests!' );
- $self->_whoa( $self->{Curr_Test} != @{ $self->{Test_Results} },
- 'Somehow you got a different number of results than tests ran!' );
-
- return;
-}
-
-#line 2274
-
-sub _whoa {
- my( $self, $check, $desc ) = @_;
- if($check) {
- local $Level = $Level + 1;
- $self->croak(<<"WHOA");
-WHOA! $desc
-This should never happen! Please contact the author immediately!
-WHOA
- }
-
- return;
-}
-
-#line 2298
-
-sub _my_exit {
- $? = $_[0]; ## no critic (Variables::RequireLocalizedPunctuationVars)
-
- return 1;
-}
-
-#line 2310
-
-sub _ending {
- my $self = shift;
- return if $self->no_ending;
- return if $self->{Ending}++;
-
- my $real_exit_code = $?;
-
- # Don't bother with an ending if this is a forked copy. Only the parent
- # should do the ending.
- if( $self->{Original_Pid} != $$ ) {
- return;
- }
-
- # Ran tests but never declared a plan or hit done_testing
- if( !$self->{Have_Plan} and $self->{Curr_Test} ) {
- $self->is_passing(0);
- $self->diag("Tests were run but no plan was declared and done_testing() was not seen.");
- }
-
- # Exit if plan() was never called. This is so "require Test::Simple"
- # doesn't puke.
- if( !$self->{Have_Plan} ) {
- return;
- }
-
- # Don't do an ending if we bailed out.
- if( $self->{Bailed_Out} ) {
- $self->is_passing(0);
- return;
- }
- # Figure out if we passed or failed and print helpful messages.
- my $test_results = $self->{Test_Results};
- if(@$test_results) {
- # The plan? We have no plan.
- if( $self->{No_Plan} ) {
- $self->_output_plan($self->{Curr_Test}) unless $self->no_header;
- $self->{Expected_Tests} = $self->{Curr_Test};
- }
-
- # Auto-extended arrays and elements which aren't explicitly
- # filled in with a shared reference will puke under 5.8.0
- # ithreads. So we have to fill them in by hand. :(
- my $empty_result = &share( {} );
- for my $idx ( 0 .. $self->{Expected_Tests} - 1 ) {
- $test_results->[$idx] = $empty_result
- unless defined $test_results->[$idx];
- }
-
- my $num_failed = grep !$_->{'ok'}, @{$test_results}[ 0 .. $self->{Curr_Test} - 1 ];
-
- my $num_extra = $self->{Curr_Test} - $self->{Expected_Tests};
-
- if( $num_extra != 0 ) {
- my $s = $self->{Expected_Tests} == 1 ? '' : 's';
- $self->diag(<<"FAIL");
-Looks like you planned $self->{Expected_Tests} test$s but ran $self->{Curr_Test}.
-FAIL
- $self->is_passing(0);
- }
-
- if($num_failed) {
- my $num_tests = $self->{Curr_Test};
- my $s = $num_failed == 1 ? '' : 's';
-
- my $qualifier = $num_extra == 0 ? '' : ' run';
-
- $self->diag(<<"FAIL");
-Looks like you failed $num_failed test$s of $num_tests$qualifier.
-FAIL
- $self->is_passing(0);
- }
-
- if($real_exit_code) {
- $self->diag(<<"FAIL");
-Looks like your test exited with $real_exit_code just after $self->{Curr_Test}.
-FAIL
- $self->is_passing(0);
- _my_exit($real_exit_code) && return;
- }
-
- my $exit_code;
- if($num_failed) {
- $exit_code = $num_failed <= 254 ? $num_failed : 254;
- }
- elsif( $num_extra != 0 ) {
- $exit_code = 255;
- }
- else {
- $exit_code = 0;
- }
-
- _my_exit($exit_code) && return;
- }
- elsif( $self->{Skip_All} ) {
- _my_exit(0) && return;
- }
- elsif($real_exit_code) {
- $self->diag(<<"FAIL");
-Looks like your test exited with $real_exit_code before it could output anything.
-FAIL
- $self->is_passing(0);
- _my_exit($real_exit_code) && return;
- }
- else {
- $self->diag("No tests run!\n");
- $self->is_passing(0);
- _my_exit(255) && return;
- }
-
- $self->is_passing(0);
- $self->_whoa( 1, "We fell off the end of _ending()" );
-}
-
-END {
- $Test->_ending if defined $Test;
-}
-
-#line 2498
-
-1;
-
diff --git a/inc/Test/Builder/IO/Scalar.pm b/inc/Test/Builder/IO/Scalar.pm
deleted file mode 100644
index ac0e90c..0000000
--- a/inc/Test/Builder/IO/Scalar.pm
+++ /dev/null
@@ -1,406 +0,0 @@
-#line 1
-package Test::Builder::IO::Scalar;
-
-
-#line 28
-
-# This is copied code, I don't care.
-##no critic
-
-use Carp;
-use strict;
-use vars qw($VERSION @ISA);
-use IO::Handle;
-
-use 5.005;
-
-### The package version, both in 1.23 style *and* usable by MakeMaker:
-$VERSION = "2.110";
-
-### Inheritance:
- at ISA = qw(IO::Handle);
-
-#==============================
-
-#line 52
-
-#------------------------------
-
-#line 62
-
-sub new {
- my $proto = shift;
- my $class = ref($proto) || $proto;
- my $self = bless \do { local *FH }, $class;
- tie *$self, $class, $self;
- $self->open(@_); ### open on anonymous by default
- $self;
-}
-sub DESTROY {
- shift->close;
-}
-
-#------------------------------
-
-#line 87
-
-sub open {
- my ($self, $sref) = @_;
-
- ### Sanity:
- defined($sref) or do {my $s = ''; $sref = \$s};
- (ref($sref) eq "SCALAR") or croak "open() needs a ref to a scalar";
-
- ### Setup:
- *$self->{Pos} = 0; ### seek position
- *$self->{SR} = $sref; ### scalar reference
- $self;
-}
-
-#------------------------------
-
-#line 109
-
-sub opened {
- *{shift()}->{SR};
-}
-
-#------------------------------
-
-#line 123
-
-sub close {
- my $self = shift;
- %{*$self} = ();
- 1;
-}
-
-#line 133
-
-
-
-#==============================
-
-#line 143
-
-
-#------------------------------
-
-#line 153
-
-sub flush { "0 but true" }
-
-#------------------------------
-
-#line 164
-
-sub getc {
- my $self = shift;
-
- ### Return undef right away if at EOF; else, move pos forward:
- return undef if $self->eof;
- substr(${*$self->{SR}}, *$self->{Pos}++, 1);
-}
-
-#------------------------------
-
-#line 183
-
-sub getline {
- my $self = shift;
-
- ### Return undef right away if at EOF:
- return undef if $self->eof;
-
- ### Get next line:
- my $sr = *$self->{SR};
- my $i = *$self->{Pos}; ### Start matching at this point.
-
- ### Minimal impact implementation!
- ### We do the fast fast thing (no regexps) if using the
- ### classic input record separator.
-
- ### Case 1: $/ is undef: slurp all...
- if (!defined($/)) {
- *$self->{Pos} = length $$sr;
- return substr($$sr, $i);
- }
-
- ### Case 2: $/ is "\n": zoom zoom zoom...
- elsif ($/ eq "\012") {
-
- ### Seek ahead for "\n"... yes, this really is faster than regexps.
- my $len = length($$sr);
- for (; $i < $len; ++$i) {
- last if ord (substr ($$sr, $i, 1)) == 10;
- }
-
- ### Extract the line:
- my $line;
- if ($i < $len) { ### We found a "\n":
- $line = substr ($$sr, *$self->{Pos}, $i - *$self->{Pos} + 1);
- *$self->{Pos} = $i+1; ### Remember where we finished up.
- }
- else { ### No "\n"; slurp the remainder:
- $line = substr ($$sr, *$self->{Pos}, $i - *$self->{Pos});
- *$self->{Pos} = $len;
- }
- return $line;
- }
-
- ### Case 3: $/ is ref to int. Do fixed-size records.
- ### (Thanks to Dominique Quatravaux.)
- elsif (ref($/)) {
- my $len = length($$sr);
- my $i = ${$/} + 0;
- my $line = substr ($$sr, *$self->{Pos}, $i);
- *$self->{Pos} += $i;
- *$self->{Pos} = $len if (*$self->{Pos} > $len);
- return $line;
- }
-
- ### Case 4: $/ is either "" (paragraphs) or something weird...
- ### This is Graham's general-purpose stuff, which might be
- ### a tad slower than Case 2 for typical data, because
- ### of the regexps.
- else {
- pos($$sr) = $i;
-
- ### If in paragraph mode, skip leading lines (and update i!):
- length($/) or
- (($$sr =~ m/\G\n*/g) and ($i = pos($$sr)));
-
- ### If we see the separator in the buffer ahead...
- if (length($/)
- ? $$sr =~ m,\Q$/\E,g ### (ordinary sep) TBD: precomp!
- : $$sr =~ m,\n\n,g ### (a paragraph)
- ) {
- *$self->{Pos} = pos $$sr;
- return substr($$sr, $i, *$self->{Pos}-$i);
- }
- ### Else if no separator remains, just slurp the rest:
- else {
- *$self->{Pos} = length $$sr;
- return substr($$sr, $i);
- }
- }
-}
-
-#------------------------------
-
-#line 273
-
-sub getlines {
- my $self = shift;
- wantarray or croak("can't call getlines in scalar context!");
- my ($line, @lines);
- push @lines, $line while (defined($line = $self->getline));
- @lines;
-}
-
-#------------------------------
-
-#line 294
-
-sub print {
- my $self = shift;
- *$self->{Pos} = length(${*$self->{SR}} .= join('', @_) . (defined($\) ? $\ : ""));
- 1;
-}
-sub _unsafe_print {
- my $self = shift;
- my $append = join('', @_) . $\;
- ${*$self->{SR}} .= $append;
- *$self->{Pos} += length($append);
- 1;
-}
-sub _old_print {
- my $self = shift;
- ${*$self->{SR}} .= join('', @_) . $\;
- *$self->{Pos} = length(${*$self->{SR}});
- 1;
-}
-
-
-#------------------------------
-
-#line 324
-
-sub read {
- my $self = $_[0];
- my $n = $_[2];
- my $off = $_[3] || 0;
-
- my $read = substr(${*$self->{SR}}, *$self->{Pos}, $n);
- $n = length($read);
- *$self->{Pos} += $n;
- ($off ? substr($_[1], $off) : $_[1]) = $read;
- return $n;
-}
-
-#------------------------------
-
-#line 345
-
-sub write {
- my $self = $_[0];
- my $n = $_[2];
- my $off = $_[3] || 0;
-
- my $data = substr($_[1], $off, $n);
- $n = length($data);
- $self->print($data);
- return $n;
-}
-
-#------------------------------
-
-#line 366
-
-sub sysread {
- my $self = shift;
- $self->read(@_);
-}
-
-#------------------------------
-
-#line 380
-
-sub syswrite {
- my $self = shift;
- $self->write(@_);
-}
-
-#line 389
-
-
-#==============================
-
-#line 398
-
-
-#------------------------------
-
-#line 408
-
-sub autoflush {}
-
-#------------------------------
-
-#line 419
-
-sub binmode {}
-
-#------------------------------
-
-#line 429
-
-sub clearerr { 1 }
-
-#------------------------------
-
-#line 439
-
-sub eof {
- my $self = shift;
- (*$self->{Pos} >= length(${*$self->{SR}}));
-}
-
-#------------------------------
-
-#line 452
-
-sub seek {
- my ($self, $pos, $whence) = @_;
- my $eofpos = length(${*$self->{SR}});
-
- ### Seek:
- if ($whence == 0) { *$self->{Pos} = $pos } ### SEEK_SET
- elsif ($whence == 1) { *$self->{Pos} += $pos } ### SEEK_CUR
- elsif ($whence == 2) { *$self->{Pos} = $eofpos + $pos} ### SEEK_END
- else { croak "bad seek whence ($whence)" }
-
- ### Fixup:
- if (*$self->{Pos} < 0) { *$self->{Pos} = 0 }
- if (*$self->{Pos} > $eofpos) { *$self->{Pos} = $eofpos }
- return 1;
-}
-
-#------------------------------
-
-#line 476
-
-sub sysseek {
- my $self = shift;
- $self->seek (@_);
-}
-
-#------------------------------
-
-#line 490
-
-sub tell { *{shift()}->{Pos} }
-
-#------------------------------
-
-#line 503
-
-sub use_RS {
- my ($self, $yesno) = @_;
- carp "use_RS is deprecated and ignored; \$/ is always consulted\n";
- }
-
-#------------------------------
-
-#line 517
-
-sub setpos { shift->seek($_[0],0) }
-
-#------------------------------
-
-#line 528
-
-*getpos = \&tell;
-
-
-#------------------------------
-
-#line 540
-
-sub sref { *{shift()}->{SR} }
-
-
-#------------------------------
-# Tied handle methods...
-#------------------------------
-
-# Conventional tiehandle interface:
-sub TIEHANDLE {
- ((defined($_[1]) && UNIVERSAL::isa($_[1], __PACKAGE__))
- ? $_[1]
- : shift->new(@_));
-}
-sub GETC { shift->getc(@_) }
-sub PRINT { shift->print(@_) }
-sub PRINTF { shift->print(sprintf(shift, @_)) }
-sub READ { shift->read(@_) }
-sub READLINE { wantarray ? shift->getlines(@_) : shift->getline(@_) }
-sub WRITE { shift->write(@_); }
-sub CLOSE { shift->close(@_); }
-sub SEEK { shift->seek(@_); }
-sub TELL { shift->tell(@_); }
-sub EOF { shift->eof(@_); }
-
-#------------------------------------------------------------
-
-1;
-
-__END__
-
-
-
-#line 576
-
-
-#line 657
-
diff --git a/inc/Test/Builder/Module.pm b/inc/Test/Builder/Module.pm
deleted file mode 100644
index ffef230..0000000
--- a/inc/Test/Builder/Module.pm
+++ /dev/null
@@ -1,73 +0,0 @@
-#line 1
-package Test::Builder::Module;
-
-use strict;
-
-use Test::Builder;
-
-require Exporter;
-our @ISA = qw(Exporter);
-
-our $VERSION = '0.94';
-$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
-
-
-#line 74
-
-sub import {
- my($class) = shift;
-
- # Don't run all this when loading ourself.
- return 1 if $class eq 'Test::Builder::Module';
-
- my $test = $class->builder;
-
- my $caller = caller;
-
- $test->exported_to($caller);
-
- $class->import_extra( \@_ );
- my(@imports) = $class->_strip_imports( \@_ );
-
- $test->plan(@_);
-
- $class->export_to_level( 1, $class, @imports );
-}
-
-sub _strip_imports {
- my $class = shift;
- my $list = shift;
-
- my @imports = ();
- my @other = ();
- my $idx = 0;
- while( $idx <= $#{$list} ) {
- my $item = $list->[$idx];
-
- if( defined $item and $item eq 'import' ) {
- push @imports, @{ $list->[ $idx + 1 ] };
- $idx++;
- }
- else {
- push @other, $item;
- }
-
- $idx++;
- }
-
- @$list = @other;
-
- return @imports;
-}
-
-#line 137
-
-sub import_extra { }
-
-#line 167
-
-sub builder {
- return Test::Builder->new;
-}
-
-1;
diff --git a/inc/Test/More.pm b/inc/Test/More.pm
deleted file mode 100644
index 9d41458..0000000
--- a/inc/Test/More.pm
+++ /dev/null
@@ -1,746 +0,0 @@
-#line 1
-package Test::More;
-
-use 5.006;
-use strict;
-use warnings;
-
-#---- perlcritic exemptions. ----#
-
-# We use a lot of subroutine prototypes
-## no critic (Subroutines::ProhibitSubroutinePrototypes)
-
-# Can't use Carp because it might cause use_ok() to accidentally succeed
-# even though the module being used forgot to use Carp. Yes, this
-# actually happened.
-sub _carp {
- my( $file, $line ) = ( caller(1) )[ 1, 2 ];
- return warn @_, " at $file line $line\n";
-}
-
-our $VERSION = '0.94';
-$VERSION = eval $VERSION; ## no critic (BuiltinFunctions::ProhibitStringyEval)
-
-use Test::Builder::Module;
-our @ISA = qw(Test::Builder::Module);
-our @EXPORT = qw(ok use_ok require_ok
- is isnt like unlike is_deeply
- cmp_ok
- skip todo todo_skip
- pass fail
- eq_array eq_hash eq_set
- $TODO
- plan
- done_testing
- can_ok isa_ok new_ok
- diag note explain
- subtest
- BAIL_OUT
-);
-
-#line 164
-
-sub plan {
- my $tb = Test::More->builder;
-
- return $tb->plan(@_);
-}
-
-# This implements "use Test::More 'no_diag'" but the behavior is
-# deprecated.
-sub import_extra {
- my $class = shift;
- my $list = shift;
-
- my @other = ();
- my $idx = 0;
- while( $idx <= $#{$list} ) {
- my $item = $list->[$idx];
-
- if( defined $item and $item eq 'no_diag' ) {
- $class->builder->no_diag(1);
- }
- else {
- push @other, $item;
- }
-
- $idx++;
- }
-
- @$list = @other;
-
- return;
-}
-
-#line 217
-
-sub done_testing {
- my $tb = Test::More->builder;
- $tb->done_testing(@_);
-}
-
-#line 289
-
-sub ok ($;$) {
- my( $test, $name ) = @_;
- my $tb = Test::More->builder;
-
- return $tb->ok( $test, $name );
-}
-
-#line 367
-
-sub is ($$;$) {
- my $tb = Test::More->builder;
-
- return $tb->is_eq(@_);
-}
-
-sub isnt ($$;$) {
- my $tb = Test::More->builder;
-
- return $tb->isnt_eq(@_);
-}
-
-*isn't = \&isnt;
-
-#line 411
-
-sub like ($$;$) {
- my $tb = Test::More->builder;
-
- return $tb->like(@_);
-}
-
-#line 426
-
-sub unlike ($$;$) {
- my $tb = Test::More->builder;
-
- return $tb->unlike(@_);
-}
-
-#line 471
-
-sub cmp_ok($$$;$) {
- my $tb = Test::More->builder;
-
- return $tb->cmp_ok(@_);
-}
-
-#line 506
-
-sub can_ok ($@) {
- my( $proto, @methods ) = @_;
- my $class = ref $proto || $proto;
- my $tb = Test::More->builder;
-
- unless($class) {
- my $ok = $tb->ok( 0, "->can(...)" );
- $tb->diag(' can_ok() called with empty class or reference');
- return $ok;
- }
-
- unless(@methods) {
- my $ok = $tb->ok( 0, "$class->can(...)" );
- $tb->diag(' can_ok() called with no methods');
- return $ok;
- }
-
- my @nok = ();
- foreach my $method (@methods) {
- $tb->_try( sub { $proto->can($method) } ) or push @nok, $method;
- }
-
- my $name = (@methods == 1) ? "$class->can('$methods[0]')" :
- "$class->can(...)" ;
-
- my $ok = $tb->ok( !@nok, $name );
-
- $tb->diag( map " $class->can('$_') failed\n", @nok );
-
- return $ok;
-}
-
-#line 572
-
-sub isa_ok ($$;$) {
- my( $object, $class, $obj_name ) = @_;
- my $tb = Test::More->builder;
-
- my $diag;
-
- if( !defined $object ) {
- $obj_name = 'The thing' unless defined $obj_name;
- $diag = "$obj_name isn't defined";
- }
- else {
- my $whatami = ref $object ? 'object' : 'class';
- # We can't use UNIVERSAL::isa because we want to honor isa() overrides
- my( $rslt, $error ) = $tb->_try( sub { $object->isa($class) } );
- if($error) {
- if( $error =~ /^Can't call method "isa" on unblessed reference/ ) {
- # Its an unblessed reference
- $obj_name = 'The reference' unless defined $obj_name;
- if( !UNIVERSAL::isa( $object, $class ) ) {
- my $ref = ref $object;
- $diag = "$obj_name isn't a '$class' it's a '$ref'";
- }
- }
- elsif( $error =~ /Can't call method "isa" without a package/ ) {
- # It's something that can't even be a class
- $obj_name = 'The thing' unless defined $obj_name;
- $diag = "$obj_name isn't a class or reference";
- }
- else {
- die <<WHOA;
-WHOA! I tried to call ->isa on your $whatami and got some weird error.
-Here's the error.
-$error
-WHOA
- }
- }
- else {
- $obj_name = "The $whatami" unless defined $obj_name;
- if( !$rslt ) {
- my $ref = ref $object;
- $diag = "$obj_name isn't a '$class' it's a '$ref'";
- }
- }
- }
-
- my $name = "$obj_name isa $class";
- my $ok;
- if($diag) {
- $ok = $tb->ok( 0, $name );
- $tb->diag(" $diag\n");
- }
- else {
- $ok = $tb->ok( 1, $name );
- }
-
- return $ok;
-}
-
-#line 651
-
-sub new_ok {
- my $tb = Test::More->builder;
- $tb->croak("new_ok() must be given at least a class") unless @_;
-
- my( $class, $args, $object_name ) = @_;
-
- $args ||= [];
- $object_name = "The object" unless defined $object_name;
-
- my $obj;
- my( $success, $error ) = $tb->_try( sub { $obj = $class->new(@$args); 1 } );
- if($success) {
- local $Test::Builder::Level = $Test::Builder::Level + 1;
- isa_ok $obj, $class, $object_name;
- }
- else {
- $tb->ok( 0, "new() died" );
- $tb->diag(" Error was: $error");
- }
-
- return $obj;
-}
-
-#line 719
-
-sub subtest($&) {
- my ($name, $subtests) = @_;
-
- my $tb = Test::More->builder;
- return $tb->subtest(@_);
-}
-
-#line 743
-
-sub pass (;$) {
- my $tb = Test::More->builder;
-
- return $tb->ok( 1, @_ );
-}
-
-sub fail (;$) {
- my $tb = Test::More->builder;
-
- return $tb->ok( 0, @_ );
-}
-
-#line 806
-
-sub use_ok ($;@) {
- my( $module, @imports ) = @_;
- @imports = () unless @imports;
- my $tb = Test::More->builder;
-
- my( $pack, $filename, $line ) = caller;
-
- my $code;
- if( @imports == 1 and $imports[0] =~ /^\d+(?:\.\d+)?$/ ) {
- # probably a version check. Perl needs to see the bare number
- # for it to work with non-Exporter based modules.
- $code = <<USE;
-package $pack;
-use $module $imports[0];
-1;
-USE
- }
- else {
- $code = <<USE;
-package $pack;
-use $module \@{\$args[0]};
-1;
-USE
- }
-
- my( $eval_result, $eval_error ) = _eval( $code, \@imports );
- my $ok = $tb->ok( $eval_result, "use $module;" );
-
- unless($ok) {
- chomp $eval_error;
- $@ =~ s{^BEGIN failed--compilation aborted at .*$}
- {BEGIN failed--compilation aborted at $filename line $line.}m;
- $tb->diag(<<DIAGNOSTIC);
- Tried to use '$module'.
- Error: $eval_error
-DIAGNOSTIC
-
- }
-
- return $ok;
-}
-
-sub _eval {
- my( $code, @args ) = @_;
-
- # Work around oddities surrounding resetting of $@ by immediately
- # storing it.
- my( $sigdie, $eval_result, $eval_error );
- {
- local( $@, $!, $SIG{__DIE__} ); # isolate eval
- $eval_result = eval $code; ## no critic (BuiltinFunctions::ProhibitStringyEval)
- $eval_error = $@;
- $sigdie = $SIG{__DIE__} || undef;
- }
- # make sure that $code got a chance to set $SIG{__DIE__}
- $SIG{__DIE__} = $sigdie if defined $sigdie;
-
- return( $eval_result, $eval_error );
-}
-
-#line 875
-
-sub require_ok ($) {
- my($module) = shift;
- my $tb = Test::More->builder;
-
- my $pack = caller;
-
- # Try to deterine if we've been given a module name or file.
- # Module names must be barewords, files not.
- $module = qq['$module'] unless _is_module_name($module);
-
- my $code = <<REQUIRE;
-package $pack;
-require $module;
-1;
-REQUIRE
-
- my( $eval_result, $eval_error ) = _eval($code);
- my $ok = $tb->ok( $eval_result, "require $module;" );
-
- unless($ok) {
- chomp $eval_error;
- $tb->diag(<<DIAGNOSTIC);
- Tried to require '$module'.
- Error: $eval_error
-DIAGNOSTIC
-
- }
-
- return $ok;
-}
-
-sub _is_module_name {
- my $module = shift;
-
- # Module names start with a letter.
- # End with an alphanumeric.
- # The rest is an alphanumeric or ::
- $module =~ s/\b::\b//g;
-
- return $module =~ /^[a-zA-Z]\w*$/ ? 1 : 0;
-}
-
-#line 952
-
-our( @Data_Stack, %Refs_Seen );
-my $DNE = bless [], 'Does::Not::Exist';
-
-sub _dne {
- return ref $_[0] eq ref $DNE;
-}
-
-## no critic (Subroutines::RequireArgUnpacking)
-sub is_deeply {
- my $tb = Test::More->builder;
-
- unless( @_ == 2 or @_ == 3 ) {
- my $msg = <<'WARNING';
-is_deeply() takes two or three args, you gave %d.
-This usually means you passed an array or hash instead
-of a reference to it
-WARNING
- chop $msg; # clip off newline so carp() will put in line/file
-
- _carp sprintf $msg, scalar @_;
-
- return $tb->ok(0);
- }
-
- my( $got, $expected, $name ) = @_;
-
- $tb->_unoverload_str( \$expected, \$got );
-
- my $ok;
- if( !ref $got and !ref $expected ) { # neither is a reference
- $ok = $tb->is_eq( $got, $expected, $name );
- }
- elsif( !ref $got xor !ref $expected ) { # one's a reference, one isn't
- $ok = $tb->ok( 0, $name );
- $tb->diag( _format_stack({ vals => [ $got, $expected ] }) );
- }
- else { # both references
- local @Data_Stack = ();
- if( _deep_check( $got, $expected ) ) {
- $ok = $tb->ok( 1, $name );
- }
- else {
- $ok = $tb->ok( 0, $name );
- $tb->diag( _format_stack(@Data_Stack) );
- }
- }
-
- return $ok;
-}
-
-sub _format_stack {
- my(@Stack) = @_;
-
- my $var = '$FOO';
- my $did_arrow = 0;
- foreach my $entry (@Stack) {
- my $type = $entry->{type} || '';
- my $idx = $entry->{'idx'};
- if( $type eq 'HASH' ) {
- $var .= "->" unless $did_arrow++;
- $var .= "{$idx}";
- }
- elsif( $type eq 'ARRAY' ) {
- $var .= "->" unless $did_arrow++;
- $var .= "[$idx]";
- }
- elsif( $type eq 'REF' ) {
- $var = "\${$var}";
- }
- }
-
- my @vals = @{ $Stack[-1]{vals} }[ 0, 1 ];
- my @vars = ();
- ( $vars[0] = $var ) =~ s/\$FOO/ \$got/;
- ( $vars[1] = $var ) =~ s/\$FOO/\$expected/;
-
- my $out = "Structures begin differing at:\n";
- foreach my $idx ( 0 .. $#vals ) {
- my $val = $vals[$idx];
- $vals[$idx]
- = !defined $val ? 'undef'
- : _dne($val) ? "Does not exist"
- : ref $val ? "$val"
- : "'$val'";
- }
-
- $out .= "$vars[0] = $vals[0]\n";
- $out .= "$vars[1] = $vals[1]\n";
-
- $out =~ s/^/ /msg;
- return $out;
-}
-
-sub _type {
- my $thing = shift;
-
- return '' if !ref $thing;
-
- for my $type (qw(ARRAY HASH REF SCALAR GLOB CODE Regexp)) {
- return $type if UNIVERSAL::isa( $thing, $type );
- }
-
- return '';
-}
-
-#line 1112
-
-sub diag {
- return Test::More->builder->diag(@_);
-}
-
-sub note {
- return Test::More->builder->note(@_);
-}
-
-#line 1138
-
-sub explain {
- return Test::More->builder->explain(@_);
-}
-
-#line 1204
-
-## no critic (Subroutines::RequireFinalReturn)
-sub skip {
- my( $why, $how_many ) = @_;
- my $tb = Test::More->builder;
-
- unless( defined $how_many ) {
- # $how_many can only be avoided when no_plan is in use.
- _carp "skip() needs to know \$how_many tests are in the block"
- unless $tb->has_plan eq 'no_plan';
- $how_many = 1;
- }
-
- if( defined $how_many and $how_many =~ /\D/ ) {
- _carp
- "skip() was passed a non-numeric number of tests. Did you get the arguments backwards?";
- $how_many = 1;
- }
-
- for( 1 .. $how_many ) {
- $tb->skip($why);
- }
-
- no warnings 'exiting';
- last SKIP;
-}
-
-#line 1288
-
-sub todo_skip {
- my( $why, $how_many ) = @_;
- my $tb = Test::More->builder;
-
- unless( defined $how_many ) {
- # $how_many can only be avoided when no_plan is in use.
- _carp "todo_skip() needs to know \$how_many tests are in the block"
- unless $tb->has_plan eq 'no_plan';
- $how_many = 1;
- }
-
- for( 1 .. $how_many ) {
- $tb->todo_skip($why);
- }
-
- no warnings 'exiting';
- last TODO;
-}
-
-#line 1343
-
-sub BAIL_OUT {
- my $reason = shift;
- my $tb = Test::More->builder;
-
- $tb->BAIL_OUT($reason);
-}
-
-#line 1382
-
-#'#
-sub eq_array {
- local @Data_Stack = ();
- _deep_check(@_);
-}
-
-sub _eq_array {
- my( $a1, $a2 ) = @_;
-
- if( grep _type($_) ne 'ARRAY', $a1, $a2 ) {
- warn "eq_array passed a non-array ref";
- return 0;
- }
-
- return 1 if $a1 eq $a2;
-
- my $ok = 1;
- my $max = $#$a1 > $#$a2 ? $#$a1 : $#$a2;
- for( 0 .. $max ) {
- my $e1 = $_ > $#$a1 ? $DNE : $a1->[$_];
- my $e2 = $_ > $#$a2 ? $DNE : $a2->[$_];
-
- push @Data_Stack, { type => 'ARRAY', idx => $_, vals => [ $e1, $e2 ] };
- $ok = _deep_check( $e1, $e2 );
- pop @Data_Stack if $ok;
-
- last unless $ok;
- }
-
- return $ok;
-}
-
-sub _deep_check {
- my( $e1, $e2 ) = @_;
- my $tb = Test::More->builder;
-
- my $ok = 0;
-
- # Effectively turn %Refs_Seen into a stack. This avoids picking up
- # the same referenced used twice (such as [\$a, \$a]) to be considered
- # circular.
- local %Refs_Seen = %Refs_Seen;
-
- {
- # Quiet uninitialized value warnings when comparing undefs.
- no warnings 'uninitialized';
-
- $tb->_unoverload_str( \$e1, \$e2 );
-
- # Either they're both references or both not.
- my $same_ref = !( !ref $e1 xor !ref $e2 );
- my $not_ref = ( !ref $e1 and !ref $e2 );
-
- if( defined $e1 xor defined $e2 ) {
- $ok = 0;
- }
- elsif( !defined $e1 and !defined $e2 ) {
- # Shortcut if they're both defined.
- $ok = 1;
- }
- elsif( _dne($e1) xor _dne($e2) ) {
- $ok = 0;
- }
- elsif( $same_ref and( $e1 eq $e2 ) ) {
- $ok = 1;
- }
- elsif($not_ref) {
- push @Data_Stack, { type => '', vals => [ $e1, $e2 ] };
- $ok = 0;
- }
- else {
- if( $Refs_Seen{$e1} ) {
- return $Refs_Seen{$e1} eq $e2;
- }
- else {
- $Refs_Seen{$e1} = "$e2";
- }
-
- my $type = _type($e1);
- $type = 'DIFFERENT' unless _type($e2) eq $type;
-
- if( $type eq 'DIFFERENT' ) {
- push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] };
- $ok = 0;
- }
- elsif( $type eq 'ARRAY' ) {
- $ok = _eq_array( $e1, $e2 );
- }
- elsif( $type eq 'HASH' ) {
- $ok = _eq_hash( $e1, $e2 );
- }
- elsif( $type eq 'REF' ) {
- push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] };
- $ok = _deep_check( $$e1, $$e2 );
- pop @Data_Stack if $ok;
- }
- elsif( $type eq 'SCALAR' ) {
- push @Data_Stack, { type => 'REF', vals => [ $e1, $e2 ] };
- $ok = _deep_check( $$e1, $$e2 );
- pop @Data_Stack if $ok;
- }
- elsif($type) {
- push @Data_Stack, { type => $type, vals => [ $e1, $e2 ] };
- $ok = 0;
- }
- else {
- _whoa( 1, "No type in _deep_check" );
- }
- }
- }
-
- return $ok;
-}
-
-sub _whoa {
- my( $check, $desc ) = @_;
- if($check) {
- die <<"WHOA";
-WHOA! $desc
-This should never happen! Please contact the author immediately!
-WHOA
- }
-}
-
-#line 1515
-
-sub eq_hash {
- local @Data_Stack = ();
- return _deep_check(@_);
-}
-
-sub _eq_hash {
- my( $a1, $a2 ) = @_;
-
- if( grep _type($_) ne 'HASH', $a1, $a2 ) {
- warn "eq_hash passed a non-hash ref";
- return 0;
- }
-
- return 1 if $a1 eq $a2;
-
- my $ok = 1;
- my $bigger = keys %$a1 > keys %$a2 ? $a1 : $a2;
- foreach my $k ( keys %$bigger ) {
- my $e1 = exists $a1->{$k} ? $a1->{$k} : $DNE;
- my $e2 = exists $a2->{$k} ? $a2->{$k} : $DNE;
-
- push @Data_Stack, { type => 'HASH', idx => $k, vals => [ $e1, $e2 ] };
- $ok = _deep_check( $e1, $e2 );
- pop @Data_Stack if $ok;
-
- last unless $ok;
- }
-
- return $ok;
-}
-
-#line 1572
-
-sub eq_set {
- my( $a1, $a2 ) = @_;
- return 0 unless @$a1 == @$a2;
-
- no warnings 'uninitialized';
-
- # It really doesn't matter how we sort them, as long as both arrays are
- # sorted with the same algorithm.
- #
- # Ensure that references are not accidentally treated the same as a
- # string containing the reference.
- #
- # Have to inline the sort routine due to a threading/sort bug.
- # See [rt.cpan.org 6782]
- #
- # I don't know how references would be sorted so we just don't sort
- # them. This means eq_set doesn't really work with refs.
- return eq_array(
- [ grep( ref, @$a1 ), sort( grep( !ref, @$a1 ) ) ],
- [ grep( ref, @$a2 ), sort( grep( !ref, @$a2 ) ) ],
- );
-}
-
-#line 1774
-
-1;
diff --git a/inc/ok.pm b/inc/ok.pm
deleted file mode 100644
index 5243ff9..0000000
--- a/inc/ok.pm
+++ /dev/null
@@ -1,19 +0,0 @@
-#line 1
-package ok;
-$ok::VERSION = 0.02;
-
-use strict;
-use Test::More ();
-
-sub import {
- shift; goto &Test::More::use_ok if @_;
-
- # No argument list - croak as if we are prototyped like use_ok()
- my (undef, $file, $line) = caller();
- ($file =~ /^\(eval/) or die "Not enough arguments for 'use ok' at $file line $line\n";
-}
-
-
-__END__
-
-#line 59
diff --git a/inc/parent.pm b/inc/parent.pm
deleted file mode 100644
index 31f8dd9..0000000
--- a/inc/parent.pm
+++ /dev/null
@@ -1,37 +0,0 @@
-#line 1
-package parent;
-use strict;
-use vars qw($VERSION);
-$VERSION = '0.223';
-
-sub import {
- my $class = shift;
-
- my $inheritor = caller(0);
-
- if ( @_ and $_[0] eq '-norequire' ) {
- shift @_;
- } else {
- for ( my @filename = @_ ) {
- if ( $_ eq $inheritor ) {
- warn "Class '$inheritor' tried to inherit from itself\n";
- };
-
- s{::|'}{/}g;
- require "$_.pm"; # dies if the file is not found
- }
- }
-
- {
- no strict 'refs';
- # This is more efficient than push for the new MRO
- # at least until the new MRO is fixed
- @{"$inheritor\::ISA"} = (@{"$inheritor\::ISA"} , @_);
- };
-};
-
-"All your base are belong to us"
-
-__END__
-
-#line 136
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list