PAR-1.007/0000755000372000037200000000000012041335453012321 5ustar roderichroderichPAR-1.007/MANIFEST.SKIP0000644000372000037200000000016011701600526014212 0ustar roderichroderich#defaults ^\..*\.sw.$ ^MANIFEST.bak$ ^Makefile$ ^Makefile.old$ ^blib/ ^pm_to_blib ^blibdirs \B\.svn\b ^MYMETA\. PAR-1.007/inc/0000755000372000037200000000000012041335453013072 5ustar roderichroderichPAR-1.007/inc/Module/0000755000372000037200000000000012041335453014317 5ustar roderichroderichPAR-1.007/inc/Module/Install.pm0000644000372000037200000003013512040532036016260 0ustar roderichroderich#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 Cwd (); use File::Find (); use File::Path (); 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 = '1.06'; # Storage for the pseudo-singleton $MAIN = undef; *inc::Module::Install::VERSION = *VERSION; @inc::Module::Install::ISA = __PACKAGE__; } sub import { my $class = shift; my $self = $class->new(@_); my $who = $self->_caller; #------------------------------------------------------------- # all of the following checks should be included in import(), # to allow "eval 'require Module::Install; 1' to test # installation of Module::Install. (RT #51267) #------------------------------------------------------------- # 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 # This reportedly fixes a rare Win32 UTC file time issue, but # as this is a non-cross-platform XS module not in the core, # we shouldn't really depend on it. See RT #24194 for detail. # (Also, this module only supports Perl 5.6 and above). eval "use Win32::UTCFileTime" if $^O eq 'MSWin32' && $] >= 5.006; # 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)); #------------------------------------------------------------- unless ( -f $self->{file} ) { foreach my $key (keys %INC) { delete $INC{$key} if $key =~ /Module\/Install/; } local $^W; 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"}; } local $^W; *{"${who}::AUTOLOAD"} = $self->autoload; $self->preload; # Unregister loader and worker packages so subdirs can use them again delete $INC{'inc/Module/Install.pm'}; delete $INC{'Module/Install.pm'}; # Save to the singleton $MAIN = $self; return 1; } 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; } unless ($$sym =~ s/([^:]+)$//) { # XXX: it looks like we can't retrieve the missing function # via $$sym (usually $main::AUTOLOAD) in this case. # I'm still wondering if we should slurp Makefile.PL to # get some context or not ... my ($package, $file, $line) = caller; die <<"EOT"; Unknown function is found at $file line $line. Execution of $file aborted due to runtime errors. If you're a contributor to a project, you may need to install some Module::Install extensions from CPAN (or other repository). If you're a user of a module, please contact the author. EOT } 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 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 ) { local $^W; *{"${who}::$name"} = sub { ${"${who}::AUTOLOAD"} = "${who}::$name"; goto &{"${who}::AUTOLOAD"}; }; } } sub new { my ($class, %args) = @_; delete $INC{'FindBin.pm'}; { # to suppress the redefine warning local $SIG{__WARN__} = sub {}; require FindBin; } # 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) = @_; my $should_reload = 0; unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) { unshift @INC, $self->{prefix}; $should_reload = 1; } foreach my $rv ( $self->find_extensions($path) ) { my ($file, $pkg) = @{$rv}; next if $self->{pathnames}{$pkg}; local $@; my $new = eval { local $^W; require $file; $pkg->can('new') }; unless ( $new ) { warn $@ if $@; next; } $self->{pathnames}{$pkg} = $should_reload ? delete $INC{$file} : $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; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _read { local *FH; open( FH, '<', $_[0] ) or die "open($_[0]): $!"; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_NEW sub _read { local *FH; open( FH, "< $_[0]" ) or die "open($_[0]): $!"; my $string = do { local $/; }; close FH or die "close($_[0]): $!"; return $string; } END_OLD 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; } # Done in evals to avoid confusing Perl::MinimumVersion eval( $] >= 5.006 ? <<'END_NEW' : <<'END_OLD' ); die $@ if $@; sub _write { local *FH; open( FH, '>', $_[0] ) or die "open($_[0]): $!"; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_NEW sub _write { local *FH; open( FH, "> $_[0]" ) or die "open($_[0]): $!"; foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!"; } close FH or die "close($_[0]): $!"; } END_OLD # _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($_[1]) <=> _version($_[2]); } # 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 - 2012 Adam Kennedy. PAR-1.007/inc/Module/Install/0000755000372000037200000000000012041335453015725 5ustar roderichroderichPAR-1.007/inc/Module/Install/Win32.pm0000644000372000037200000000340312040532037017161 0ustar roderichroderich#line 1 package Module::Install::Win32; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @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; PAR-1.007/inc/Module/Install/Makefile.pm0000644000372000037200000002743712040532037020011 0ustar roderichroderich#line 1 package Module::Install::Makefile; use strict 'vars'; use ExtUtils::MakeMaker (); use Module::Install::Base (); use Fcntl qw/:flock :seek/; use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @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 or non-interactive session, always use defaults if ( ($ENV{AUTOMATED_TESTING} or -! -t STDIN) and ! $ENV{PERL_MM_USE_DEFAULT} ) { local $ENV{PERL_MM_USE_DEFAULT} = 1; goto &ExtUtils::MakeMaker::prompt; } else { goto &ExtUtils::MakeMaker::prompt; } } # Store a cleaned up version of the MakeMaker version, # since we need to behave differently in a variety of # ways based on the MM version. my $makemaker = eval $ExtUtils::MakeMaker::VERSION; # If we are passed a param, do a "newer than" comparison. # Otherwise, just return the MakeMaker version. sub makemaker { ( @_ < 2 or $makemaker >= eval($_[1]) ) ? $makemaker : 0 } # Ripped from ExtUtils::MakeMaker 6.56, and slightly modified # as we only need to know here whether the attribute is an array # or a hash or something else (which may or may not be appendable). my %makemaker_argtype = ( C => 'ARRAY', CONFIG => 'ARRAY', # CONFIGURE => 'CODE', # ignore DIR => 'ARRAY', DL_FUNCS => 'HASH', DL_VARS => 'ARRAY', EXCLUDE_EXT => 'ARRAY', EXE_FILES => 'ARRAY', FUNCLIST => 'ARRAY', H => 'ARRAY', IMPORTS => 'HASH', INCLUDE_EXT => 'ARRAY', LIBS => 'ARRAY', # ignore '' MAN1PODS => 'HASH', MAN3PODS => 'HASH', META_ADD => 'HASH', META_MERGE => 'HASH', PL_FILES => 'HASH', PM => 'HASH', PMLIBDIRS => 'ARRAY', PMLIBPARENTDIRS => 'ARRAY', PREREQ_PM => 'HASH', CONFIGURE_REQUIRES => 'HASH', SKIP => 'ARRAY', TYPEMAPS => 'ARRAY', XS => 'HASH', # VERSION => ['version',''], # ignore # _KEEP_AFTER_FLUSH => '', clean => 'HASH', depend => 'HASH', dist => 'HASH', dynamic_lib=> 'HASH', linkext => 'HASH', macro => 'HASH', postamble => 'HASH', realclean => 'HASH', test => 'HASH', tool_autosplit => 'HASH', # special cases where you can use makemaker_append CCFLAGS => 'APPENDABLE', DEFINE => 'APPENDABLE', INC => 'APPENDABLE', LDDLFLAGS => 'APPENDABLE', LDFROM => 'APPENDABLE', ); sub makemaker_args { my ($self, %new_args) = @_; my $args = ( $self->{makemaker_args} ||= {} ); foreach my $key (keys %new_args) { if ($makemaker_argtype{$key}) { if ($makemaker_argtype{$key} eq 'ARRAY') { $args->{$key} = [] unless defined $args->{$key}; unless (ref $args->{$key} eq 'ARRAY') { $args->{$key} = [$args->{$key}] } push @{$args->{$key}}, ref $new_args{$key} eq 'ARRAY' ? @{$new_args{$key}} : $new_args{$key}; } elsif ($makemaker_argtype{$key} eq 'HASH') { $args->{$key} = {} unless defined $args->{$key}; foreach my $skey (keys %{ $new_args{$key} }) { $args->{$key}{$skey} = $new_args{$key}{$skey}; } } elsif ($makemaker_argtype{$key} eq 'APPENDABLE') { $self->makemaker_append($key => $new_args{$key}); } } else { if (defined $args->{$key}) { warn qq{MakeMaker attribute "$key" is overriden; use "makemaker_append" to append values\n}; } $args->{$key} = $new_args{$key}; } } return $args; } # For mm args that take multiple space-seperated args, # append an argument to the current list. sub makemaker_append { my $self = shift; 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 ); } sub _wanted_t { } sub tests_recursive { my $self = shift; my $dir = shift || 't'; unless ( -d $dir ) { die "tests_recursive dir '$dir' does not exist"; } my %tests = map { $_ => 1 } split / /, ($self->tests || ''); require File::Find; File::Find::find( sub { /\.t$/ and -f $_ and $tests{"$File::Find::dir/*.t"} = 1 }, $dir ); $self->tests( join ' ', sort keys %tests ); } 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 ) { # This previous attempted to inherit the version of # ExtUtils::MakeMaker in use by the module author, but this # was found to be untenable as some authors build releases # using future dev versions of EU:MM that nobody else has. # Instead, #toolchain suggests we use 6.59 which is the most # stable version on CPAN at time of writing and is, to quote # ribasushi, "not terminally fucked, > and tested enough". # TODO: We will now need to maintain this over time to push # the version up as new versions are released. $self->build_requires( 'ExtUtils::MakeMaker' => 6.59 ); $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 ); } 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.36 ); $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 ); } # Generate the MakeMaker params my $args = $self->makemaker_args; $args->{DISTNAME} = $self->name; $args->{NAME} = $self->module_name || $self->name; $args->{NAME} =~ s/-/::/g; $args->{VERSION} = $self->version or die <<'EOT'; ERROR: Can't determine distribution version. Please specify it explicitly via 'version' in Makefile.PL, or set a valid $VERSION in a module, and provide its file path via 'version_from' (or 'all_from' if you prefer) in Makefile.PL. EOT if ( $self->tests ) { my @tests = split ' ', $self->tests; my %seen; $args->{test} = { TESTS => (join ' ', grep {!$seen{$_}++} @tests), }; } elsif ( $Module::Install::ExtraTests::use_extratests ) { # Module::Install::ExtraTests doesn't set $self->tests and does its own tests via harness. # So, just ignore our xt tests here. } elsif ( -d 'xt' and ($Module::Install::AUTHOR or $ENV{RELEASE_TESTING}) ) { $args->{test} = { TESTS => join( ' ', map { "$_/*.t" } grep { -d $_ } qw{ t xt } ), }; } if ( $] >= 5.005 ) { $args->{ABSTRACT} = $self->abstract; $args->{AUTHOR} = join ', ', @{$self->author || []}; } if ( $self->makemaker(6.10) ) { $args->{NO_META} = 1; #$args->{NO_MYMETA} = 1; } if ( $self->makemaker(6.17) and $self->sign ) { $args->{SIGN} = 1; } unless ( $self->is_admin ) { delete $args->{SIGN}; } if ( $self->makemaker(6.31) and $self->license ) { $args->{LICENSE} = $self->license; } my $prereq = ($args->{PREREQ_PM} ||= {}); %$prereq = ( %$prereq, map { @$_ } # flatten [module => version] map { @$_ } grep $_, ($self->requires) ); # Remove any reference to perl, PREREQ_PM doesn't support it delete $args->{PREREQ_PM}->{perl}; # Merge both kinds of requires into BUILD_REQUIRES my $build_prereq = ($args->{BUILD_REQUIRES} ||= {}); %$build_prereq = ( %$build_prereq, map { @$_ } # flatten [module => version] map { @$_ } grep $_, ($self->configure_requires, $self->build_requires) ); # Remove any reference to perl, BUILD_REQUIRES doesn't support it delete $args->{BUILD_REQUIRES}->{perl}; # Delete bundled dists from prereq_pm, add it to Makefile DIR my $subdirs = ($args->{DIR} || []); if ($self->bundles) { my %processed; foreach my $bundle (@{ $self->bundles }) { my ($mod_name, $dist_dir) = @$bundle; delete $prereq->{$mod_name}; $dist_dir = File::Basename::basename($dist_dir); # dir for building this module if (not exists $processed{$dist_dir}) { if (-d $dist_dir) { # List as sub-directory to be processed by make push @$subdirs, $dist_dir; } # Else do nothing: the module is already present on the system $processed{$dist_dir} = undef; } } } unless ( $self->makemaker('6.55_03') ) { %$prereq = (%$prereq,%$build_prereq); delete $args->{BUILD_REQUIRES}; } 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"; if ( $self->makemaker(6.48) ) { $args->{MIN_PERL_VERSION} = $perl_version; } } if ($self->installdirs) { warn qq{old INSTALLDIRS (probably set by makemaker_args) is overriden by installdirs\n} if $args->{INSTALLDIRS}; $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: $!"; eval { flock MAKEFILE, LOCK_EX }; my $makefile = do { local $/; }; $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; seek MAKEFILE, 0, SEEK_SET; truncate MAKEFILE, 0; 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 544 PAR-1.007/inc/Module/Install/WriteAll.pm0000644000372000037200000000237612040532037020012 0ustar roderichroderich#line 1 package Module::Install::WriteAll; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @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} ) { # XXX: This still may be a bit over-defensive... unless ($self->makemaker(6.25)) { $self->makemaker_args( PL_FILES => {} ) if -f 'Build.PL'; } } # 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; PAR-1.007/inc/Module/Install/Fetch.pm0000644000372000037200000000462712040532037017321 0ustar roderichroderich#line 1 package Module::Install::Fetch; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @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@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; PAR-1.007/inc/Module/Install/Include.pm0000644000372000037200000000101512040532037017637 0ustar roderichroderich#line 1 package Module::Install::Include; use strict; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @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; PAR-1.007/inc/Module/Install/Metadata.pm0000644000372000037200000004327712040532037020014 0ustar roderichroderich#line 1 package Module::Install::Metadata; use strict 'vars'; use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @ISA = 'Module::Install::Base'; $ISCORE = 1; } my @boolean_keys = qw{ sign }; my @scalar_keys = qw{ name module_name abstract 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 author }; *authors = \&author; 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; my $value = @_ ? shift : 1; if ( $self->{values}->{dynamic_config} ) { # Once dynamic we never change to static, for safety return 0; } $self->{values}->{dynamic_config} = $value ? 1 : 0; return 1; } # Convenience command sub static_config { shift->dynamic_config(0); } 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 really old versions unless ( $version >= 5.005 ) { die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n"; } $self->{values}->{perl_version} = $version; } 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"); } $self->{values}{all_from} = $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) ); # for version integrity check $self->makemaker_args( VERSION_FROM => $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 _extract_perl_version { if ( $_[0] =~ m/ ^\s* (?:use|require) \s* v? ([\d_\.]+) \s* ; /ixms ) { my $perl_version = $1; $perl_version =~ s{_}{}g; return $perl_version; } else { return; } } sub perl_version_from { my $self = shift; my $perl_version=_extract_perl_version(Module::Install::_read($_[0])); if ($perl_version) { $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; # XXX: ugly but should work anyway... if (eval "require Pod::Escapes; 1") { # Pod::Escapes has a mapping table. # It's in core of perl >= 5.9.3, and should be installed # as one of the Pod::Simple's prereqs, which is a prereq # of Pod::Text 3.x (see also below). $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $Pod::Escapes::Name2character_number{$1} ? chr($Pod::Escapes::Name2character_number{$1}) : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) { # Pod::Text < 3.0 has yet another mapping table, # though the table name of 2.x and 1.x are different. # (1.x is in core of Perl < 5.6, 2.x is in core of # Perl < 5.9.3) my $mapping = ($Pod::Text::VERSION < 2) ? \%Pod::Text::HTML_Escapes : \%Pod::Text::ESCAPES; $author =~ s{ E<( (\d+) | ([A-Za-z]+) )> } { defined $2 ? chr($2) : defined $mapping->{$1} ? $mapping->{$1} : do { warn "Unknown escape: E<$1>"; "E<$1>"; }; }gex; } else { $author =~ s{E}{<}g; $author =~ s{E}{>}g; } $self->author($author); } else { warn "Cannot determine author info from $_[0]\n"; } } #Stolen from M::B my %license_urls = ( perl => 'http://dev.perl.org/licenses/', apache => 'http://apache.org/licenses/LICENSE-2.0', apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1', 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()' ); $license = __extract_license($license) || lc $license; $self->{values}->{license} = $license; # Automatically fill in license URLs if ( $license_urls{$license} ) { $self->resources( license => $license_urls{$license} ); } return 1; } sub _extract_license { my $pod = shift; my $matched; return __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ L(?i:ICEN[CS]E|ICENSING)\b.*?) (=head \d.*|=cut.*|)\z /xms ) || __extract_license( ($matched) = $pod =~ m/ (=head \d \s+ (?:C(?i:OPYRIGHTS?)|L(?i:EGAL))\b.*?) (=head \d.*|=cut.*|)\z /xms ); } sub __extract_license { my $license_text = shift or return; my @phrases = ( '(?:under )?the same (?:terms|license) as (?:perl|the perl (?:\d )?programming language)' => 'perl', 1, '(?:under )?the terms of (?:perl|the perl programming language) itself' => 'perl', 1, 'Artistic and GPL' => '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, 'GNU Free Documentation license' => 'unrestricted', 1, 'GNU Affero General Public License' => 'open_source', 1, '(?:Free)?BSD license' => 'bsd', 1, 'Artistic license 2\.0' => 'artistic_2', 1, 'Artistic license' => 'artistic', 1, 'Apache (?:Software )?license' => 'apache', 1, 'GPL' => 'gpl', 1, 'LGPL' => 'lgpl', 1, 'BSD' => 'bsd', 1, 'Artistic' => 'artistic', 1, 'MIT' => 'mit', 1, 'Mozilla Public License' => 'mozilla', 1, 'Q Public License' => 'open_source', 1, 'OpenSSL License' => 'unrestricted', 1, 'SSLeay License' => 'unrestricted', 1, 'zlib License' => 'open_source', 1, 'proprietary' => 'proprietary', 0, ); while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { $pattern =~ s#\s+#\\s+#gs; if ( $license_text =~ /\b$pattern\b/i ) { return $license; } } return ''; } sub license_from { my $self = shift; if (my $license=_extract_license(Module::Install::_read($_[0]))) { $self->license($license); } else { warn "Cannot determine license info from $_[0]\n"; return 'unknown'; } } sub _extract_bugtracker { my @links = $_[0] =~ m#L<( https?\Q://rt.cpan.org/\E[^>]+| https?\Q://github.com/\E[\w_]+/[\w_]+/issues| https?\Q://code.google.com/p/\E[\w_\-]+/issues/list )>#gx; 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 one bugtracker 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+(v?[\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; } sub add_metadata { my $self = shift; my %hash = @_; for my $key (keys %hash) { warn "add_metadata: $key is not prefixed with 'x_'.\n" . "Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/; $self->{values}->{$key} = $hash{$key}; } } ###################################################################### # 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; PAR-1.007/inc/Module/Install/Can.pm0000644000372000037200000000615712040532037016771 0ustar roderichroderich#line 1 package Module::Install::Can; use strict; use Config (); use ExtUtils::MakeMaker (); use Module::Install::Base (); use vars qw{$VERSION @ISA $ISCORE}; BEGIN { $VERSION = '1.06'; @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 ''; require File::Spec; my $abs = File::Spec->catfile($dir, $cmd); return $abs if (-x $abs or $abs = MM->maybe_command($abs)); } return; } # Can our C compiler environment build XS files sub can_xs { my $self = shift; # Ensure we have the CBuilder module $self->configure_requires( 'ExtUtils::CBuilder' => 0.27 ); # Do we have the configure_requires checker? local $@; eval "require ExtUtils::CBuilder;"; if ( $@ ) { # They don't obey configure_requires, so it is # someone old and delicate. Try to avoid hurting # them by falling back to an older simpler test. return $self->can_cc(); } # Do we have a working C compiler my $builder = ExtUtils::CBuilder->new( quiet => 1, ); unless ( $builder->have_compiler ) { # No working C compiler return 0; } # Write a C file representative of what XS becomes require File::Temp; my ( $FH, $tmpfile ) = File::Temp::tempfile( "compilexs-XXXXX", SUFFIX => '.c', ); binmode $FH; print $FH <<'END_C'; #include "EXTERN.h" #include "perl.h" #include "XSUB.h" int main(int argc, char **argv) { return 0; } int boot_sanexs() { return 1; } END_C close $FH; # Can the C compiler access the same headers XS does my @libs = (); my $object = undef; eval { local $^W = 0; $object = $builder->compile( source => $tmpfile, ); @libs = $builder->link( objects => $object, module_name => 'sanexs', ); }; my $result = $@ ? 0 : 1; # Clean up all the build files foreach ( $tmpfile, $object, @libs ) { next unless defined $_; 1 while unlink; } return $result; } # 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 236 PAR-1.007/inc/Module/Install/Base.pm0000644000372000037200000000214712040532037017135 0ustar roderichroderich#line 1 package Module::Install::Base; use strict 'vars'; use vars qw{$VERSION}; BEGIN { $VERSION = '1.06'; } # 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->isa('Module::Install::Base::FakeAdmin'); } sub DESTROY {} package Module::Install::Base::FakeAdmin; use vars qw{$VERSION}; BEGIN { $VERSION = $Module::Install::Base::VERSION; } my $fake; sub new { $fake ||= bless(\@_, $_[0]); } sub AUTOLOAD {} sub DESTROY {} # Restore warning handler BEGIN { $SIG{__WARN__} = $SIG{__WARN__}->(); } 1; #line 159 PAR-1.007/inc/PerlIO.pm0000644000372000037200000000062112040532125014553 0ustar roderichroderich#line 1 package PerlIO; our $VERSION = '1.07'; # 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 332 PAR-1.007/inc/Test/0000755000372000037200000000000012041335453014011 5ustar roderichroderichPAR-1.007/inc/Test/More.pm0000644000372000037200000004140012040532125015242 0ustar roderichroderich#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.98'; $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 372 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 416 sub like ($$;$) { my $tb = Test::More->builder; return $tb->like(@_); } #line 431 sub unlike ($$;$) { my $tb = Test::More->builder; return $tb->unlike(@_); } #line 476 sub cmp_ok($$$;$) { my $tb = Test::More->builder; return $tb->cmp_ok(@_); } #line 511 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 577 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 <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 656 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 741 sub subtest { my ($name, $subtests) = @_; my $tb = Test::More->builder; return $tb->subtest(@_); } #line 765 sub pass (;$) { my $tb = Test::More->builder; return $tb->ok( 1, @_ ); } sub fail (;$) { my $tb = Test::More->builder; return $tb->ok( 0, @_ ); } #line 833 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 = <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(<builder; my $pack = caller; # Try to determine 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 = <ok( $eval_result, "require $module;" ); unless($ok) { chomp $eval_error; $tb->diag(<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(Regexp ARRAY HASH REF SCALAR GLOB CODE)) { return $type if UNIVERSAL::isa( $thing, $type ); } return ''; } #line 1139 sub diag { return Test::More->builder->diag(@_); } sub note { return Test::More->builder->note(@_); } #line 1165 sub explain { return Test::More->builder->explain(@_); } #line 1231 ## 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 1315 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 1370 sub BAIL_OUT { my $reason = shift; my $tb = Test::More->builder; $tb->BAIL_OUT($reason); } #line 1409 #'# 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->[$_]; next if _equal_nonrefs($e1, $e2); 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 _equal_nonrefs { my( $e1, $e2 ) = @_; return if ref $e1 or ref $e2; if ( defined $e1 ) { return 1 if defined $e2 and $e1 eq $e2; } else { return 1 if !defined $e2; } return; } 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; { $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 undefined. $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 1556 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; next if _equal_nonrefs($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; } return $ok; } #line 1615 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 1817 1; PAR-1.007/inc/Test/Builder/0000755000372000037200000000000012041335453015377 5ustar roderichroderichPAR-1.007/inc/Test/Builder/Module.pm0000644000372000037200000000224112040532125017153 0ustar roderichroderich#line 1 package Test::Builder::Module; use strict; use Test::Builder; require Exporter; our @ISA = qw(Exporter); our $VERSION = '0.98'; $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; PAR-1.007/inc/Test/Builder.pm0000644000372000037200000010671512040532125015741 0ustar roderichroderich#line 1 package Test::Builder; use 5.006; use strict; use warnings; our $VERSION = '0.98'; $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 # occasionally 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 $parent_in_todo = $self->in_todo; # Clear $TODO for the child. my $orig_TODO = $self->find_TODO(undef, 1, undef); 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}; if ($parent_in_todo) { $child->{Fail_FH} = $self->{Todo_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->{Parent_TODO} = $orig_TODO; $child->{Name} = $name || "Child of " . $self->name; $self->{Child_Name} = $child->name; return $child; } #line 211 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($error, $child, %parent); { # child() calls reset() which sets $Level to 1, so we localize # $Level first to limit the scope of the reset to the subtest. local $Test::Builder::Level = $Test::Builder::Level + 1; $child = $self->child($name); %parent = %$self; %$self = %$child; my $run_the_subtests = sub { $subtests->(); $self->done_testing unless $self->_plan_handled; 1; }; if( !eval { $run_the_subtests->() } ) { $error = $@; } } # Restore the parent and the copied child. %$child = %$self; %$self = %parent; # Restore the parent's $TODO $self->find_TODO(undef, 1, $child->{Parent_TODO}); # Die *after* we restore the parent. die $error if $error and !eval { $error->isa('Test::Builder::Exception') }; local $Test::Builder::Level = $Test::Builder::Level + 1; return $child->finalize; } #line 281 sub _plan_handled { my $self = shift; return $self->{Have_Plan} || $self->{No_Plan} || $self->{Skip_All}; } #line 306 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"); } local $? = 0; # don't fail if $subtests happened to set $? nonzero $self->_ending; # XXX This will only be necessary for TAP envelopes (we think) #$self->_print( $self->is_passing ? "PASS\n" : "FAIL\n" ); local $Test::Builder::Level = $Test::Builder::Level + 1; 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 359 sub parent { shift->{Parent} } #line 371 sub name { shift->{Name} } sub DESTROY { my $self = shift; if ( $self->parent and $$ == $self->{Original_Pid} ) { 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 395 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->{Done_Testing} = 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 474 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 529 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 553 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 586 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 638 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 689 sub has_plan { my $self = shift; return( $self->{Expected_Tests} ) if $self->{Expected_Tests}; return('no_plan') if $self->{No_Plan}; return(undef); } #line 706 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 731 sub exported_to { my( $self, $pack ) = @_; if( defined $pack ) { $self->{Exported_To} = $pack; } return $self->{Exported_To}; } #line 761 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 939 sub is_eq { my( $self, $got, $expect, $name ) = @_; local $Level = $Level + 1; 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; 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 1032 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 1081 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 1105 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(); # This is so that warnings come out at the caller's level $test = eval qq[ #line $line "(eval in cmp_ok) $file" \$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 1205 sub BAIL_OUT { my( $self, $reason ) = @_; $self->{Bailed_Out} = 1; $self->_print("Bail out! $reason"); exit 255; } #line 1218 { no warnings 'once'; *BAILOUT = \&BAIL_OUT; } #line 1232 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 1273 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 1353 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 1449 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 1478 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 1521 sub level { my( $self, $level ) = @_; if( defined $level ) { $Level = $level; } return $Level; } #line 1553 sub use_numbers { my( $self, $use_nums ) = @_; if( defined $use_nums ) { $self->{Use_Nums} = $use_nums; } return $self->{Use_Nums}; } #line 1586 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 1639 sub diag { my $self = shift; $self->_print_comment( $self->_diag_fh, @_ ); } #line 1654 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 1704 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 1733 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; my $indent = $self->_indent; local( $\, $", $, ) = ( undef, ' ', '' ); # Escape each line after the first with a # so we don't # confuse Test::Harness. $msg =~ s{\n(?!\z)}{\n$indent# }sg; # Stick a newline on the end if it needs it. $msg .= "\n" unless $msg =~ /\n\z/; return print $fh $indent, $msg; } #line 1793 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); _apply_layers($dst, @src_layers) if @src_layers; } ); return; } sub _apply_layers { my ($fh, @layers) = @_; my %seen; my @unique = grep { $_ ne 'unix' and !$seen{$_}++ } @layers; binmode($fh, join(":", "", "raw", @unique)); } #line 1926 sub reset_outputs { my $self = shift; $self->output ($Testout); $self->failure_output($Testerr); $self->todo_output ($Testout); return; } #line 1952 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 1992 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 2040 sub is_passing { my $self = shift; if( @_ ) { $self->{Is_Passing} = shift; } return $self->{Is_Passing}; } #line 2062 sub summary { my($self) = shift; return map { $_->{'ok'} } @{ $self->{Test_Results} }; } #line 2117 sub details { my $self = shift; return @{ $self->{Test_Results} }; } #line 2146 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 2173 sub find_TODO { my( $self, $pack, $set, $new_value ) = @_; $pack = $pack || $self->caller(1) || $self->exported_to; return unless $pack; no strict 'refs'; ## no critic my $old_value = ${ $pack . '::TODO' }; $set and ${ $pack . '::TODO' } = $new_value; return $old_value; } #line 2193 sub in_todo { my $self = shift; local $Level = $Level + 1; return( defined $self->{Todo} || $self->find_TODO ) ? 1 : 0; } #line 2243 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 2265 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 2298 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 2315 #line 2329 #'# 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 2350 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 2374 sub _my_exit { $? = $_[0]; ## no critic (Variables::RequireLocalizedPunctuationVars) return 1; } #line 2386 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 2574 1; PAR-1.007/inc/parent.pm0000644000372000037200000000120112040532125014705 0ustar roderichroderich#line 1 package parent; use strict; use vars qw($VERSION); $VERSION = '0.225'; 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'; push @{"$inheritor\::ISA"}, @_; }; }; "All your base are belong to us" __END__ =encoding utf8 #line 136 PAR-1.007/t/0000755000372000037200000000000012041335453012564 5ustar roderichroderichPAR-1.007/t/60-cleanup.t0000644000372000037200000000121411701600525014616 0ustar roderichroderich#!/usr/bin/perl use strict; use warnings; # This test is supposed to make sure that # the /tmp/par-$USER/temp-$$ directories get cleaned up when # in CLEAN mode. use File::Temp (); use Test::More tests => 5; BEGIN { $ENV{PAR_TMPDIR} = File::Temp::tempdir(TMPDIR => 1, CLEANUP => 1); $ENV{PAR_CLEAN} = 1; delete $ENV{PAR_TEMP}; } ok(!defined $ENV{PAR_TEMP}, "No PAR_TEMP to start with"); require PAR; PAR->import(); ok(1, "Loaded PAR"); ok(defined $ENV{PAR_TEMP}, "Loading PAR defined PAR_TEMP"); ok(-d $ENV{PAR_TEMP}, "Loading PAR created the PAR_TEMP directory"); my $partemp = $ENV{PAR_TEMP}; END { ok(not -d $partemp); } __END__ PAR-1.007/t/Hello.pm0000644000372000037200000000016211701600525014161 0ustar roderichroderichpackage Hello; # This package (and file) is used by 40-par-hashref.t use strict; sub hello { return(); } 1; PAR-1.007/t/40-par-hashref.t0000644000372000037200000000206611701600525015373 0ustar roderichroderich#!/usr/bin/perl -w use strict; use Test::More tests => 7; use File::Spec; use File::Temp (); use FindBin; use vars qw/@INC %INC/; $ENV{PAR_TMPDIR} = File::Temp::tempdir(TMPDIR => 1, CLEANUP => 1); unshift @INC, ($FindBin::Bin); use_ok('PAR'); my $par = File::Spec->catfile($FindBin::Bin, 'hello.par'); ok(-f $par, 'PAR file for testing exists.'); eval "use PAR { file => '$par'};"; warn $@ if $@; ok(!$@, "use PAR {file =>...} threw error"); require Hello; my $res = Hello::hello(); ok($res, "Hello from PAR returned true"); delete $INC{'Hello.pm'}; %PAR::PAR_INC = %PAR::PAR_INC = (); @PAR::PAR_INC = @PAR::PAR_INC = (); @PAR::PAR_INC_LATE = @PAR::PAR_INC_LATE = (); eval "use PAR { file => '$par', fallback => 1 };"; warn $@ if $@; ok(!$@, "use PAR {file=>...,fallback=>1} threw error"); undef *Hello::hello; require Hello; $res = Hello::hello(); ok(!$res, "Hello from filesys returned false"); ok(eval("require Data; 1;"), 'fallback works'); print PAR->import({run => 'hello', file => $par}); ok(0, 'should not be reached if hello from par file is executed!'); PAR-1.007/t/50-autoloaderfix.t0000644000372000037200000000115211701600525016035 0ustar roderichroderich#!/usr/bin/perl # Problem doesn't manifest if Test::More is in effect? # What the hell? use File::Temp (); BEGIN { $ENV{PAR_TMPDIR} = File::Temp::tempdir(TMPDIR => 1, CLEANUP => 1); } $|=1; print "1..1\n"; use PAR; package Bar; use AutoLoader 'AUTOLOAD'; # Can't use strict and warnings because in case of the # erroneous recursion, we'll require ourselves and get a # "subroutine redefined" error which doesn't matter. sub new { return bless {} => $_[0]; } package main; $INC{"Bar.pm"} = $0; # <-- { my $p = Bar->new(); } # <-- looping while looking for Bar::DESTROY print "ok 1 - AutoLoader works\n"; PAR-1.007/t/hello.par0000644000372000037200000000242111701600525014367 0ustar roderichroderichPK °±S-lib/UT Œh±=­O¼=UxéPK- S-ŸcúFK lib/Hello.pmUT –h°=yh±=Uxé+HLÎNLOUđHÍÉÉ·æâ*-NU(.)ÊL.±æ*.MRȉ+Ts)AAQf^‰‚X©By~QNbL’5W-—¡5PK­±S-J»]mOT lib/Data.pmUT …h±=°h±=Uxé+HLÎNLOUpI,I´æâ*-NU(.)ÊL.±æ*.MRH +Ts)AAQf^‰‚‹cˆ£5W-—¡5W|<ˆÏ̉®Pœ\’™ŸÇPK F%\-script/UT £O¼=­O¼=UxéPKÀ±S-ïêpôDHscript/hello.plUT ¨h±=¨h±=UxéSVÔ/-.̉OỀÓ/H-Êáâ*-NUđHÍÉÉ·æâÓVV JCÓ« (3¯DAÉ=??%©2UG¡<¿('E1&OÉ PK¼±S-ç!rJRscript/data.plUT ¤h±=nO¼=UxéSVÔ/-.̉OỀÓ/H-Êáâ*-NUpI,I´æâQVV)@RCÓ« (3¯DÁÆÅ1ÄÑ(bÅǃU)¥¦å¤&—dæçqPK E%\-’#˜44script/nostrict.plUT ¢O¼=¢O¼=Uxé#!/usr/bin/perl ${'a'} = "No Strict!\n"; print $a; PK °±S- íAlib/UTŒh±=UxPK- S-ŸcúFK ¤7lib/Hello.pmUT–h°=UxPK­±S-J»]mOT ¤¼lib/Data.pmUT…h±=UxPK F%\- íAIscript/UT£O¼=UxPKÀ±S-ïêpôDH ¤ƒscript/hello.plUT¨h±=UxPK¼±S-ç!rJR ¤ script/data.plUT¤h±=UxPK E%\-’#˜44 ¤”script/nostrict.plUT¢O¼=UxPKî PAR-1.007/t/00-pod.t0000644000372000037200000000040411701600525013743 0ustar roderichroderichuse strict; use warnings; use Test::More; plan skip_all => "Set environment variable PERL_TEST_POD=1 to test POD" if not $ENV{PERL_TEST_POD}; eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; all_pod_files_ok(); PAR-1.007/t/01-basic.t0000644000372000037200000000153011701600525014244 0ustar roderichroderich#!/usr/bin/perl use strict; use warnings; use Test::More tests => 8; use File::Spec; use File::Path; use File::Temp (); BEGIN { $ENV{PAR_TMPDIR} = File::Temp::tempdir(TMPDIR => 1, CLEANUP => 1); $ENV{PAR_CLEAN} = 1; } ok( `"$^X" -Mblib -MPAR -It/hello -MHello -e Hello::hello`, "Hello, world!\n", ); ok( `"$^X" -Mblib -MPAR t/hello.par hello.pl`, "Hello, world!\nGoodbye, world!\n", ); ok( `"$^X" -Mblib -MPAR t/hello.par nostrict.pl`, "No Strict!\n", ); ok( `"$^X" -Mblib -MPAR t/hello.par data.pl`, "Data section\nData reflection\n", ); require PAR; PAR->import('t/hello.par'); ok( PAR::read_file('script/hello.pl'), qr/Hello::hello/, ); ok( my $zip = PAR::par_handle('t/hello.par') ); ok( my $member = $zip->memberNamed('lib/Hello.pm') ); ok( $member->contents, qr/package Hello/, ); __END__ PAR-1.007/Makefile.PL0000644000372000037200000000165711701600526014302 0ustar roderichroderich use strict; use 5.008001; use inc::Module::Install; name 'PAR'; abstract 'Perl Archive Tookit'; all_from 'lib/PAR.pm'; perl_version '5.008001'; requires 'File::Temp' => 0.05; requires 'Compress::Zlib' => ($^O eq 'MSWin32') ? 1.16 : 1.30; requires 'Archive::Zip' => 1.00; requires 'PAR::Dist' => 0.32; requires 'AutoLoader' => '5.66_02'; if (can_use('Crypt::OpenPGP') or can_run('gpg')) { my $has_sha1 = ( can_use('Digest::SHA1') or can_use('Digest::SHA') or can_use('Digest::SHA::PurePerl') ); feature 'Digital signature support', recommends 'Digest', ($has_sha1 ? () : (can_cc() ? 'Digest::SHA' : 'Digest::SHA::PurePerl')), 'Module::Signature'; } include_deps 'Test::More'; no_index directory => 'contrib'; auto_provides; WriteAll sign => 0; PAR-1.007/META.json0000644000372000037200000000202212041335237013736 0ustar roderichroderich{ "abstract" : "Perl Archive Tookit", "author" : [ "Audrey Tang " ], "dynamic_config" : 0, "generated_by" : "ExtUtils::MakeMaker version 6.6302, CPAN::Meta::Converter version 2.120921", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "PAR", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "6.59" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "runtime" : { "requires" : { "Archive::Zip" : "1", "AutoLoader" : "5.66_02", "Compress::Zlib" : "1.3", "File::Temp" : "0.05", "PAR::Dist" : "0.32", "perl" : "5.008001" } } }, "release_status" : "stable", "version" : "1.007" } PAR-1.007/ChangeLog0000644000372000037200000013134312041335001014065 0ustar roderichroderich[Changes for 1.007 - Oct 22, 2012] - Hopefully fix "pp -C ..." for any modules that assume an actual tree of files, e.g. looking for all installed modules Foo::Bar::*; call _extract_inc even when $ENV{PAR_CLEAN} is true - update to Module::Install 1.06 [Changes for 1.006 - Oct 15, 2012] - Fix RT #78633: PAR::import ignores url => $repo_client_object applied patch from KENO, thanks! - Fix RT #73491: cache directory naming problem In PAR::SetupTemp::_get_par_user_tempdir (actually _find_username) we try to sanitize username (so that there are no problematic characters in the name of the per-user cache directory), but the strategy fails miserably for some charset encodings. E.g. for EUC-KR or CP949 (as in the bug report) we may produce an illegal sequence of bytes; in other cases we may cause collisions (different usernames mapping to the same directory name). Fix the problem once and for all by encoding the username (bytewise) as 2 hex digits. [Changes for 1.005 - Dec 2, 2011] - bump Perl version requirement to 5.8.1 (Schwern: The End Of 5.6 Is Nigh!) - run all tests using a nonce PAR_TMPDIR (otherwise CPAN Testers goes crazy as top level /tmp/par-USER directories (or similar) from previous tests may now be considered "unsafe") [Changes for 1.004 - Nov 30, 2011] - back out r1241: it causes errors in PAR::Packer's test suite - change "unsafe directory" error message to match the wording used by PAR::Packer - remove "debian" sub directory: it isn't released to CPAN and Debian will supply its own anyway - remove some cruft from MANIFEST.SKIP [Changes for 1.003 - Nov 28, 2011] - RT #69560/CVE-2011-4114: PAR packed files are extracted to unsafe and predictable temporary directories (Note: this bug was originally reported against PAR::Packer, but it applies to PAR as well) - create parent of cache directory (i.e. /tmp/par-USER) with mode 0700 - if it already exists, make sure that (and bail out if not) - it's not a symlink - it's mode 0700 - it's owned by USER - Fix a problem packing XML::LibXSLT on Windows (see the thread starting with http://www.nntp.perl.org/group/perl.par/2011/02/msg4919.html) - Die (with a hopefully useful message) if any error is encountered during an Archive::Zip extract operation [Changes for 1.002 - Jul 25, 2010] - Fixes to VERSIONs of PAR::Setup*. - No change in behaviour since 1.001 [Changes for 1.001 - Jul 25, 2010] - RT #57399: extract everything (including DLLs) in File::ShareDir directories. Module::ScanDeps classifies everything in File::ShareDir directories as "data", but PAR uses it's own heuristics what to extract from a .par. - Previous release was missing META.yml. - Upgrade Module::Install to 1.00 [Changes for 1.000 - Apr 10, 2010] - Fix defined(%hash) deprecation warning in PAR::Heavy [Changes for 0.994 - Jul 23, 2009] - Fix for the PAR::Heavy fix to the INC priority handling. [Changes for 0.993 - Jul 19, 2009] - The priority (fallback=>0) repositories should look at @PAR_INC for the loaded PARs instead of @PAR_INC_LAST. - Don't reload from a downloaded .par file after installing it via "upgrade". - Band-aid fix for the loading priority of shared librares from PAR files: Try PAR's first, the local stuff, then fallback-PARs. - Initial support for running external perl scripts from a packaged interpreter. [Changes for 0.992 - Apr 5, 2009] - Support for non-fallback repositories. [Changes for 0.991 - Mar 10, 2009] - Promote previous release to stable release. [Changes for 0.989_01 - Mar 2, 2009] * Bug fixes, etc. - Track the locations of all archives that have been extracted to $ENV{PAR_TEMP}/inc in this run. [Changes for 0.988 - Mar 1, 2009] - Promote previous release to stable release. [Changes for 0.987_01 - Feb 20, 2009] * New features - Better cleanup of the $TMPDIR/par-$USER/temp-$$ directories that are typically used as caches in the "use PAR 'foo.par'" use case. * Bug fixes, etc. - Very slightly more careful handling of PAR-specific environment variables. - Cleanup of PAR::SetupTemp [Changes for 0.986 - Feb 19, 2009] - Promote to stable release. [Changes for 0.985_01 - Feb 2, 2009] * New features - Support for the brand new static dependency resolution of PAR::Repository::Client 0.23. * Bug fixes, etc. - Fix issue with running scripts from repositories: The INC hooks used to be set up too late for this to automatically pick up dependencies. [Changes for 0.984 - Jan 25, 2009] * New features - Implemented the auto-upgrading option for loading and installing from PAR::Repositories. * Bug fixes, etc. - Fix issue with PAR::Repository::Client development versions. [Changes for 0.983 - Sep 12, 2008] * Dependencies - Require AutoLoader 5.67 which contains a PAR-related bug-fix. - Require PAR::Dist 0.32. * Internal changes - The full extraction process _extract_inc (which is triggered when a non--clean pp packaged executable is run) can now be forced to do the extraction (instead of doing if !-d). - That same extraction routine now accepts Archive::Zip handles or file names. - When, during the full extraction, the extracted paths are to be added to @INC, we now make sure they're not in @INC yet. [Changes for 0.982 - Aug 10, 2008] * New features - Moved the routines that setup the PAR_TEMP environment variable to a separate module in the distribution so it's possible to use PAR::Repository::Client without loading all of PAR. - Same for the function that sets up PAR_PROGNAME. * Bug fixes, etc. - Upgrade to Module::Install 0.77 - Fix for running scripts from repositories. [Changes for 0.980 - May 22, 2008] * Bug fixes, etc. - The function PAR::get_filehandle() that was introduced in 0.979 is really broken because Archive::Zip is broken. Turns out calling Archive::Zip::Member->fh() returns a file handle to the zip file, not a virtual/tied/whatever file handle to the member file. Therefore, the get_filehandle() function has been removed again until we work around this issue. - Upgrade to Module::Install 0.73 [Changes for 0.979 - May 13, 2008] * New features - New function PAR::get_filehandle() returns a file handle for a file in any open .par files. Similar to read_file(). [Changes for 0.977 - Oct 19, 2007] * Bug fixes, etc. - HPUX doesn't like shared libraries being unlinked while in use. So don't try to do this even in clean mode. (Workaround will be in par.pl) (Scott Stanton) - Fix DLL extraction file name matching in PAR::Heavy. - Save two system calls per DLL during DLL extraction in PAR::Heavy. [Changes for 0.976 - Jul 29, 2007] * New features - Use Archive::Unzip::Burst for unpacking binary executables if available. (This yields a significant startup speed-up.) * Bug fixes, etc. - Removed the auto_install feature from Makefile.PL. auto_install is conceptually broken. [Changes for 0.973 - Feb 3, 2007] * New features - A new option for the "use PAR { ... };" use case: "no_shlib_unpack" signals that for this particular .par file, shared libraries that were added with the --lib option should not be extracted. This allows users to do their own cache handling for these libraries. - PAR no longer unpacks *all* shared libraries by default but only those in the shlib/ directory (i.e. added with --lib). The shared libraries in auto/ should be picked up by the DynaLoader hack. - If available, the prefork.pm module will be used to declare run-time dependencies for better memory use in forking environments. - PAR now uses a caching mechanism to speed up the extraction process. This should particularly impact users of the "use PAR {file =>...}" form. * Bug fixes, etc. - Applied an optimization of the unpacking process on case insensitive file systems. [Changes for 0.972 - Jan 16, 2007] * Bug fixes, etc. - Removed PAR::AutoLoaderFix again. It wasn't working as expected all the time. - To fix the problem AutoLoaderFix was supposed to fix, we now require AutoLoader 5.62 or newer which was just recently released to CPAN. (Previously only available from blead perl.) [Changes for 0.971 - Jan 12, 2007] * Bug fixes, etc. - Fixed typo in the POD. (Jerrad Pierce) - Included fix for a bug in AutoLoader.pm as shipped with all perl versions up to and including 5.8.8 as PAR::AutoLoaderFix. This cures a problem of endless looping when the %INC entry of a module doesn't point to a file of the same name. This may happen during "use PAR 'foo.par'". [Changes for 0.970 - Dec 3, 2006] * This release introduces some rather radical changes, so read carefully: * All PAR::Packer related logic has been moved to a separate distribution, PAR-Packer. This includes pp, parl and all packaging tools. This way, PAR becomes a pure-Perl distribution that can be most easily installed by users of software which requires PAR. Developers who want to use the PAR packager, pp, need to install the PAR-Packer distribution from CPAN. [Changes for 0.961 - Nov 23, 2006] * Bug fixes, etc. - PAR::StrippedPARL::Base->write_parl() failed to work if the @INC directories contained spaces in 0.960. (Steven Mackenzie) - Much improved documentation of the environment variables (Glenn Linderman) - Fix for a spaces-in-pathname problem on Windows for t/30-current_exec.t. (Malcolm Nooning) [Changes for 0.960 - Nov 21, 2006] * Bug fixes, etc. - myldr/Makefile.PL fix: Clean up myldr/usernamefrompwuid.h. - Silence warning in myldr/internals.c. - Silence warnings seen on Irix from myldr/env.c. - Skip most tests in 10-parl-generation.t if there is no parl. - Skip loading ActiveState Perl's "sitecustomize.pl" in par.pl. - Load modules via require and other files via do. - The parl-regeneration-for-every-pp-call addition of the 0.958 release should now also work for static perls. * New features - Adressing RT ticket #6612: Now using getpwuid() to determine the user name if supported by the OS. [Changes for 0.959 - Nov 12, 2006] * This is just a hotfix release because 0.958 lacked META.yml. One day, I will switch from Module::Install to Module::Build... [Changes for 0.958 - Oct 25, 2006] * Bug fixes, etc. - myldr/Makefile.PL fix: make static.o depend on mktmpdir.c, my_perl.c, my_par.c. (Roderich Schupp) - Modules included with the -M option to pp were previously scanned for dependencies but not mapped through the %Module::ScanDeps::Preload hash for custom dependencies. That's fixed now. - $ENV{PAR_RUN} isn't set by PAR::Packer any more because nothing in the PAR sources uses it. $ENV{PAR_RUN} is no longer used by PAR at all. - Unified the environment variables which are looked at for finding the system's temporary directory. * New features - During the build process, PAR appends stripped down copies of parl (and parldyn if applicable) to the data classes PAR::StrippedPARL::Static and ::Dynamic. These parls-without-embedded-modules are used for packaging so the formerly embedded modules are now packaged from the packaging system. (Instead of stemming from the system where PAR/parl was built.) - The "use PAR { repository => $url };" syntax now also supports the use of user-constructed PAR::Repository::Client objects instead of an URL. - The -F (module code filter) option now supports selective filtering of modules. The syntax is "-F FILTER=REGEX" or - as before - "-F FILTER". The regular expression is applied to the *file name*, of the module inside the PAR (e.g. Foo/Bar.pm). This behaviour was chosen over matching against the module name (e.g. Foo::Bar) because the filters can be applied to module-like and script files as well (.pl, .al, etc.). - Updated PAR/FAQ.pod with the new FAQ's from the PAR wiki. - Added a POD file PAR/Environment.pod which is intended to become an index of all environment variables PAR uses of its own or recognizes from its users. Still mostly a stub. [Changes for 0.957 - Oct 24, 2006] * Bug fixes, etc. - Fix executable PARs top properly detect embedded scripts named the same as the executable. (Jesse Vincent) - Comment out the call to par_current_exec_proc (in the C loader) which breaks the use of symlinks to pp-ed executables when not called with a path. (I.e. using a search in $PATH). [Changes for 0.956 - Oct 3, 2006] * This is another hotfix release. Fixed a mindless bug introduced in 0.955. [Changes for 0.955 - Oct 3, 2006] * Bug fixes, etc. - 0.952 introduced removal of system module search paths if -B is in effect. This resulted in some valid PAR-related paths being removed as well. Fixed. Upgrading from 0.952 and 0.954 is suggested. - Changed the use of hard-coded '/' as path-separator to using File::Spec. [Changes for 0.954 - Sep 26, 2006] * This release is equivalent to 0.953. The 0.953 CPAN upload is broken! [Changes for 0.953 - Sep 18, 2006] * Bug fixes, etc. - Added optional POD tests. - Modified -B so that if -B is in effect, all entries are stripped out of @INC except for the PAR hooks. This happens right before the script contained in the pp-ed binary is executed. [Changes for 0.952 - Aug 22, 2006] * New features - Added the "install" option to the PAR loading syntax. If specified, the contents of the PAR distribution are permanently installed. This requires PAR::Repository::Client 0.04. * Bug fixes, etc. - Fixed broken META.yml in 0.951. [Changes for 0.951 - Aug 12, 2006] (This includes any changes up to 0.950.) * New features - Introduced new PAR loading syntax and semantics: use PAR { file => 'path/to/par/or/URL' }; ==> equivalent to "use PAR 'path/to/par/or/URL';" - Introduced the 'fallback' option: (default = 0) use PAR { file => 'foo.par', fallback => 1 }; ==> Loads modules from the PAR file only if loading them from @INC did not succeed. - Introduced the 'run' option which executes a script in a PAR archive just like perl -MPAR foo.par script.pl - If PAR::Repository::Client is installed, you can add a repository of .par distributions to your library search path as follows: use PAR { repository => 'http://foo' }; - Of course, 'run' also works with repositories: use PAR { repository => 'http://foo', run => 'my_app' }; (This searches the repository for any distributions that have a my_app script.) --> For details on repositories, have a look at the PAR::Repository::Client module. - Bug fixes, etc. - Commented a couple of the routines in PAR.pm. (Yay!) - New test script for the new fallback loading feature. - Fixed a bug in the Spreadsheet::ParseExcel handling in PatchContent.pm. [Changes for 0.942 - Jul 22, 2006] * Bug fixes, etc. - Better support for diagnostics.pm (in conjunction with Module::ScanDeps 0.62.) - Now requiring Module::ScanDeps 0.62. [Changes for 0.941 - Jun 20, 2006] (No, PAR isn't stagnating. It's just that 1.00 would draw close if we continued with 0.01 increases.) * Bug fixes, etc. - Version 0.94 of PAR would use the same cache area for all pp-ed applications due to a faulty hotfix for Digest::SHA. This applies to PAR 0.94 only. Think of 0.941 being PAR 0.94 done right. [Changes for 0.94 - Jun 1, 2006] * New Features - Added support for reading options to pp from a file using a '@filename' argument to pp: pp -o foo --gui @filename foo.pl * Bug fixes, etc. - Workaround for a bug in Digest::SHA 5.38 and 5.39 that would prevent PAR from being built. - Fixed details in the 2-pp.t test file. - Now recognizes text files that aren't picked up by the -T operator but by the "file" tool. - Applied Roderich Schupp's patch to 30-current_exec.t to fix a path issue. - Now requiring Module::ScanDeps 0.60 which fixes a couple of bugs which might be observed as PAR bugs. - Now working well with Spreadsheet::ParseExcel which uses an invalid POD section to comment out a code block. This wasn't recognized by PAR::Filter::PodStrip as POD and hence partly left in... - If the output directory doesn't exist, we create it now and output a meaningful error message if that failed. [Changes for 0.93 - May 19, 2006] * New Features - Added support for PAR_TMPDIR (PAR_GLOBAL_TMPDIR) so that the temp directory can be controlled for just the PAR file bits. (Leolo) - Added par_current_exec_proc() which finds the file of the current executable in /proc, if possible. (Leolo) - Added par_current_exec() which finds he file of the current executable, if possible on this OS. (Leolo) - par_findprog() now uses par_current_exec() if possible. * Bug Fixes, etc. - Upgraded to Module::Install 0.62+ (Audrey Tang, Steffen Mueller) - Document a strange interaction with chdir() and relative paths. (Chris Dolan) - Documented the bits that make up PAR_TEMP. (Leolo) - Fixed the call to par_findprog. path (aka val) was set to tmpdir. (Leolo) - Documented the CACHE name at the end of a self-executing PAR. (Leolo) - myldr/Makefile.PL now generates some dependencies for main.c (Leolo) - Applied patch from RT ticket. (tsee) https://rt.cpan.org/Ticket/Display.html?id=13959 - Applied Ivan Kudryavtsev's patch that fixes a couple of calls to PAR subroutines in PatchContent filtered code. (tsee) [Changes for 0.92 - February 22, 2006] * Bug Fixes - Now requiring Module::ScanDeps 0.56 which handles autouse correctly. - Now shipping with a correct SIGNATURE. (Which was broken for 0.91.) [Changes for 0.91 - February 13, 2006] * Bug Fixes - Applied Alan Stewart's patch which fixes @ARGV pollution in daughter programs. See also http://www.nntp.perl.org/group/perl.par/2152 - Now mentioning the ENV var "PAR_VERBATIM" in the documentation. See also http://www.nntp.perl.org/group/perl.par/2196 - Applied Malcolm Nooning's fix for the test suite. We used to get failed tests on Windows because of spaces in path names. - Applied Roderich Schupp's and Malcolm Nooning's patches to the test suite fixing problems with Cygwin. - Applied Vincent Ladeuil's patch to PAR::Filter::Bleach to return a true value for modules that loaded okay. - Changed 'PAR_BASE' in the Makefile.PL to 'SMUELLER'. [Changes for 0.90 - November 25, 2005] * Bug Fixes - When compiling with static libperl, myldr/ may fail "make" due to sha1.c not generated properly. - Pod stripping could fail on __DATA__ sections for files with CRLF line endings. - The documentation erroneously referred to the PAR_TEMP environment variable, whereas it should be PAR_GLOBAL_TEMP. - Compilation fixes for MinGW/MSYS. [Changes for 0.89 - June 10, 2005] * Bug Fixes - Stop static.c from pulling in Perl header files, otherwise parl.exe ends up depending on the Perl DLL on Win32 when Perl is built without PERL_IMPLICIT_SYS. - With *nix and File::Path 1.06, par.pl's avoidance of loading Cwd.pm caused syntax errors. [Changes for 0.88 - June 7, 2005] * Bug Fixes - Extracted .pl files should be loadable via the coderef-in-@INC too, just like .pm files and autosplit files. This makes PAR work with Perl 5.8.7 on Win32. - Fix the build with GCC 4.0. - If $ENV{PWD} is not defined, fallback to use `pwd` to obtain the working directory for invoking. [Changes for 0.87 - January 31, 2005] * Bug Fixes - On Win32, some versions of File::Spec::Win32 contains explicit "use Cwd;" lines, which renders parl.exe unusable. - Executable made by "pp" may fail when invoked as "./a.out" or "../a.out", due to incorrect PWD handling logic. [Changes for 0.86 - December 11, 2004] * New Features - New "pp -z" (--compress) option to set compression level (0-9). - New "pp -T" (--tempcache) option to override the per-executable directory name; it defaults to a hash of the executable, computed at compile time. This makes startup much faster for large executables. - The hash algorithm described above now prefers Digest::SHA if installed, otherwise Digest::SHA1, then fallbacks to Digest::MD5. - Functionality of "pp -X" is now extended: if the argument after -X is a zip or par file, files in it are excluded from the produced executable, and the executable will "use" the zip/par instead. For multiple -X args, successive args are only "use"d if they contain additional unique files. - "pp -l" now searches for libraries in "." and PATH in Win32. - "pp -l" shared libraries are now added to %skip, so it will not be included in both shlib/ and lib/. - "pp -l" now chases symbolic links. For example, if "libsomelib.so" is a symlink to "libsomelib.so.1", which is another symlink to "libsomelib.so.1.2", pp now follows these symlinks and add the real file the par, rather than "libsomelib.so". - New contributed code in "contrib/stdio/": Useful Tk console for "pp -g" users. - New contributed tutorial documents, currently in "contrib/docs/", which will eventually be turned into POD documents. - Running "perl Makefile.PL" with $ENV{DEBUG} set to true now produces "parl" with debug symbols. - Remove Cwd.pm (and Cwd.so) from the bundled dependencies. * Bug Fixes - More robust probing for case-insensitive file systems. - PodStrip now attempts to match "standard" pod start before =cut, otherwise =cut gets removed by itself. - Win32 slashes are now normalized in privlib and archlib directories. - Don't extract shared libraries to inc/, since they were extracted in $PAR_TEMP already. - Don't re-extract shared libraries in subdirectories, since they are picked up by corresponding "use". - Tk now exits properly with a non-zero exit() value. - Fix libperl probing problem on Debian and Gentoo that manifests as a "libperl5.8.so not found" error during runtime. - gpp: Fixed typo in options with multiple filenames; cleaned up pp parameters. - When PAR_TEMP is set, shlib/ was not correctly added to the dynamic load path environment variables. - PAR now builds with Win32 VC++ without CVTRES.EXE available. - Detection of cl.exe, gcc.exe and cc.exe is now case-insensitive. [Changes for 0.85 - July 2, 2004] * New Features - New version of "gpp"; see contrib/gui_pp/gpp_readme.txt for details. * Bug Fixes - MANIFEST and META.yml were not properly updated by PAR::Packer. - Setting directory aliases with "pp -a"/"pp -A" was broken. Fixed, and tests were added for it. - Statically-built executables was needlessly extracting libperl each time it runs; now it is eliminated and hence much faster. [Changes for 0.83 - May 29, 2004] * New Features - Revamped PAR::FAQ and sychronized with par.perl.org. - In pp-generated programs, $0 is now set to the pathname leading to the invoked executable. Use $ENV{PAR_0} instead to get the filename that contains the main perl program. - Updated "contrib/gui_pp/gpp" to support PAR::Packer options. * Bug Fixes - Core XS modules, such as Data::Dumper, were skipped by "pp". - Fix t/2-pp.t for Cygwin by probing $Config{_exe} rather than uname(). - Scripts made by "pp -P", when invoked as "perl scriptname", should not search for the same-named programs in PATH. - Correctly remove leading slash and drive letters from absolute filenames passed to "pp -a". Also normalized blackslahes to slashes. - The PP_OPTS environment variable was not recognized. - "pp -a dirname;diralias" was broken. - "pp -f" and "pp -F" were broken. [Changes for 0.82 - May 24, 2004] * New Features - New module PAR::Packer provides an OO interface to "pp"'s functionality; "pp" is now merely a thin wrapper for it. - New module App::Packer::PAR is a modified version of App::Packer, designed to work with PAR::Packer, and will hopefully be merged back to App::Packer. - The old, procedural "pp" is moved to contrib/; end-users should notice no changes in "pp"'s behaviour. - New options "pp -a" and "pp -A" (--addfile/--addlist) provides ways to include extra files and directories in the package. - The long option name for "pp -M" is changed from --add to --module. The old name is still recognized but no longer documented. Using "pp -M" to include non-library files is now deprecated; use "pp -a" instead. - par.pl and parl now writes messages to STDOUT, instead of STDERR. As a consequence, t/2-pp.t no longer prints extra warnings during "make test". * Bug Fixes - On Non-Win32 platforms, perl 5.8.0 and earlier versions produced pp-generated executables that immediately segfaults. - Running pp-generated executables with absolute pathname failed on statically-built perls. - Tests were failing due to a missing pipe_a_command.pm in MANIFEST. - Add the missing myldr/win32.coff for building on Cygwin/MinGW. - If the "perl" in path is different from the perl interpreter used for "make test", t/2-pp.t is known to fail and is now skipped. - Cygwin failed t/2-pp.t because "parl" is spelled as "parl.exe" there. [Changes for 0.81 - May 23, 2004] * New Features - Regained support for Win9x, Cygwin and MinGW. - PAR now supports 64-bit platforms, such as Tru64 and AIX. - Cygwin and MinGW can now build EXEs with icons, too; MinGW can update the icons, but Cygwin cannot. - Newly supported modules: Pod::Usage, DBIx::SearchBuilder, DBIx::ReportBuilder, SVK::Command, SVN::Core, and the ':encoding()' IO discipline. * Bug Fixes - On non-Win32 systems, invoking pp-generated executable from PATH did not work. - Standalone executables were clobbered by existing perl environments with an identical "auto/IO" libpath as the author's environment. - Standalone executables did not work on systems with an unset dynamic load path environment variable (eg. LD_LIBRARY_PATH). - "pp -p -o multi.par 1.pl 2.pl; parl multi.par 1.pl" now works. - $ENV{PATH} and $ENV{TEMP} were truncated at first path delimiter. - "pp -f Bleach" did not work for ActivePerl on Win32. - Windows 9x systems were generating invalid cache directory names. - $ENV{path} is also recognized as $ENV{PATH} for Win32. [Changes for 0.80 - March 17, 2004] * New Features - A comprehensive test suite for pp in contrib/automated_pp_test/. It is run as part of the "make test" process from t/2-pp.t. - Much better support for "pp -i" and "pp -N" (--icon/--info) using the Win32::Exe module. You may now use EXE and DLL as icon files. - If PAR_GLOBAL_CLEAN (-C, --clean) is not set, we now preemptively extracts files under the cache directory. That made POSIX.pm and other modules that depends on %INC pointing to real files work correctly. - Now uses SHA-1 to create temporary directories and files, instead of mtime. - Verbosity level is now 1..3, not 0..5; "pp -v" now takes an optional integer, so "pp -v input.pl" is no longer an error. - New flags "-vv" and "-vvv", as shorthands for "-v 2" and "-v 3". - The user-settable PAR_CLEAN and PAR_TEMP environment variables has been renamed to PAR_GLOBAL_CLEAN and PAR_GLOBAL_TEMP; the original variables are still accessible within the program. This is so that a pp-generated program can exec() or system() another one without crippling its environment variables. - File lookups are now case-insensitive on case-insensitive filesystems. - Another Tk-based GUI in contrib/gui_pp/; not installed by default. - OOified "pp" in contrib/object_oriented_pp/; not installed by default. * Bug Fixes - "pp -d" (--dependent) prevented "pp -C" (--clean) from working. - The "pp -m" (--multiarch) option was implemented incorrectly and thus broken. - Many documentation tweaks. - Previously, "pp -M" (--module) did not add the module itself, only its dependencies. - Suppress a bogus warning when $ENV{$Config{ldlibpthname}} is empty. - "parl -v" without Module::Signature installed could delete all files within the current directory. Oops. - On *nix systems, pp-generated executables erroneously linked to libperl even if "pp -d" (--dependent) is not set. - Spurious =cut directives in source files is now handled gracefully by PAR::Filter::PodStrip. - "pp -L" (--log) now logs all output messages to the log file, not just the ones printed by "pp" itself. [Changes for 0.79 - January 8, 2004] * Bug Fixes - Setting PAR_CLEAN had the reversed effect. Oops. - Dynamic libraries in cached directories was not detected properly, resulting in "permission denied" errors during certain race conditions. [Changes for 0.78 - January 7, 2004] * New Features - By default, executables generated by "pp" will now store extracted files in cache directories. You may override this by setting the PAR_CLEAN environment variable to "1", or generate executables using "pp -C". - New "pp -C" (--clean) option to make the generated executable clean up temporary directories after each run. - PAR_CLEARTEMP is renamed to PAR_CLEAN. * Bug Fixes - On Win32, temporary directories containing shared libraries was not being properly cleaned up. - If no suitable temporary directories are found, use the current directory (".") instead of the root directory ("/"). [Changes for 0.77 - January 1, 2004] * New Features - New "pp -c" and "pp -x" (--compile/--execute) options run the script with "perl -c" to check for dependencies. - Also, the new "pp -n" (--noscan) command skips the default static scanning altogether. - Added support for "pp -c/-x/-n" to tkpp. - For dynamically-built perls, pp-generated .exe files will now appear in the process table with the same name as it was launched, instead of "par.exe". - New filter "Obfuscate", which uses B::Deobfuscate to strip away PODs and comments, as well as mangling variable names. - Merged tkpp 1.1 from Doug Gruber. - OS/2 is now supported. - External Zlib is no longer required to run pp-generated binaries. * Bug Fixes - Makefile.PL was failing if $Config{cc} contains spaces. - No longer needs setting "Windows 95 compatible mode" to run on WinXP. - On Win9x with Perl 5.6.1, "nmake" was failing due to extra "@[...]" symbols in Makefile. It should be fixed now. - The "bad signature" problem with newer Archive::Zip versions is fixed. - App::Packer::Backend::PAR was misplaced into App/Packer/PAR. - Signature tests were failing under new ExtUtils::MakeMaker versions. - ActiveState's PPM building machine was having problem with PAR; a ".pdb" entry in MANIFEST.SKIP is added to fix that. - Some self-built PAR instances on Windows were failing due to mismatching short and long pathnames. [Changes for 0.76 - October 28, 2003] * New Features - Input filters. "pp --filter Bleach" now obfuscates the incoming script with PAR::Filter::Bleach; "pp --modfilter Bleach" applies Bleach to all packed modules. - Two previously built-in filters, PodStrip and PatchContent, are refactored out as PAR::Filter subclasses. - Two new filters, Bleach and Bytecode, are added for source-hiding purporses. - New utility, "tkpp", provides a GUI frontend to "pp". - New option, "pp --perlscript", to generate stand-alone scripts. - The old "PAR::Intro" documentation has been replaced by two new ones: "PAR::Tutorial" and "PAR::FAQ". - Tk pixmap (.xpm) files can now be packed with "pp --add". * Bug Fixes - Perl 5.8.1 has an off-by-one bug that prevents "parl" to function properly. We have now provided a workaround; this bug should also be fixed in Perl 5.8.2. - Fixed https support for LWP via the new Module::ScapDeps. [Changes for 0.75 - September 21, 2003] * New Features - "pp -o file.exe file.par" now packs file.par into file.exe; this means you can hand-tweak PAR files generated by "pp -p" before packing it into an executable. * Bug Fixes - Packing multiple programs by "pp script1.pl script2.pl" was producing syntax errors; fixed. - "pp -M datafile" now works. - Exit code from pp-packed executables now properly propagates out. - Fixed "use base" detection, Math::BigInt support and spurious signature warnings, by updated versions of Module::ScapDeps and Module::Signature. - On Win32, the PE info headers no longer show PAR_XXXXXXXXXXX. [Changes for 0.74 - August 20, 2003] * New Features - pp now has a set of "PatchContent" rules, dealing with non-PAR-compatible modules: Tk, Tk::Widget, Win32::API::Type, Win32::SystemInfo, SQL::Parser, diagnostics. These rules may get refactored back to PAR.pm in the future. - New function, PAR::reload_libs(), to reload currently used libraries inside PAR files. - PAR.pm itself is now never packed into pp-generated files, to perserve interface compatibility and reduce bloat. - PAR.pm now handles "use PAR 'othercode.par'" called from program or modules inside PAR files, even recursively. - A new icon for Win32 that is hopefully prettier. * Bug Fixes - All data after __DATA__ are preserved for included libraries. This helps self-reading modules like Net::LDAP::Constants. - PAR::read_file() was broken. It now works. - "use PAR" inside pp-generated executables was failing with 'file too short' errors due the mishandling of seek/tell. - Occasional crashes on Win32 due to rmdir() called too early with DLLs still open is fixed; however, "pp -d" executables may still exhibit this problem. - "pp -X" used to only take full pathnames as arguments. It now also takes "Module::Name" and "Module/Name.pm". - Dynamically built Perl under Cygwin failed to build, because libperl.dll.a was not found. - Eliminated "callback called on exit" warnings, and the related "access violation" error on Win32. [Changes for 0.73 - August 6, 2003] * New Features - The PAR Homepage is now online at http://par.perl.org/. Documentations have been changed to link to it. * Bug Fixes - Tk applications can now properly access xpm/xbm files with Tk->findINC. - On Win32, pp-generated executables could not start from Explorer, if its path contains space characters. Fixed. - On Win32, pp-generated executables used to leave around an empty directory in $ENV{TEMP}. It is now properly rmdir'ed. - Some systems (notably OpenBSD and Debian) does not put their libperl.so in the default location, which breaks the build process; now searches inside $ENV{$Config{ldlibpthname}} and $Config{libpth} to find it. [Changes for 0.72 - August 2, 2003] * New Features - CHECK and INIT blocks in programs inside PAR are now supported. * Bug Fixes - Two debug statements were mistakenly left in the source, resulting in "trying to get rid of /tmp/par_priv.xxxx.tmp" messages. - Building on Linux with GCC 3.2.2 was failing due to massive heap required for my_perl.c. Fixed by splitting it into 3k chunks. - Depends on Module::ScanDeps 0.21; it supports utf8 on Perl 5.6.1 and can significantly reduce executable file size by eliminating unneccessary shared libraries. [Changes for 0.71 - July 30, 2003] * Bug Fixes - A nasty data-loss bug has been uncovered immediately after the previous release; it only affects Windows platforms, and may cause all files to be erased under the current root (\) directory. - Building on Red Hat linux was failing, with error message that says "my_perl not declared". This has since been fixed. [Changes for 0.70 - July 29, 2003] * New Features - On machines with shared libperl, "pp" now makes truly stand-alone executables; the old behaviour is available with "pp --dependent". - Under Windows NT/2000/XP, "pp --icon=name.ico" now changes the icon for the generated executable; otherwise, a default "white camel" icon is used. - "use PAR 'http://example.com/foo.par'" now works, as does "perl -MPAR -Ihttp://example.com/foo.par". - PAR::Dist is now a mandatory prerequisite, which provides functions to turn any CPAN distribution into a PAR distribution, as well as to install, uninstall, sign and verify such files. - Integrated PAR::Dist into "par.pl" and "parl". For example, "parl -i Foo-0.01-i386-freebsd-5.8.0.par" installs a PAR distribution; "parl -v out.exe" verifies a digitally signed executable generated by "pp --sign". - A new option, "pp --multiarch", lets you generate PAR files that can work on several architectures. - "pp --sign" now adds digital signatures to generated executables and PAR files. - PAR files may now (recursively) contain other PAR files inside their par/ directories. - shlib/ and par/ directories inside PAR files can now contain architecture- and perl-version-specific subdirectories. - The "Cross-Platform Packaging and Deployment with PAR" tutorial is now online as http://www.autrijus.org/par-tutorial/. * Bug Fixes - MANIFEST.SKIP was broken on Win32. - C compilers that doesn't handle long line well can now compile PAR. - DLL files inside the same auto/ library as XS modules was not properly extracted and loaded. This specifically affects Win32. - Because parl's @INC is '.', pp-generated executables may miss IO.dll and other shared libraries since they couldn't be correctly found in @INC. [Changes for 0.69 - May 31, 2003] * New Features - Under Perl 5.8, "pp -p" now works with Apache::PAR. See http://aut.dyndns.org/par-tutorial/slide018.html for a simple example. - "pp -M filename" now adds "filename" to /, not /lib/, unless filename ends in (pm|ix|al). This makes it possible to bundle "web.conf" needed by Apache::PAR. - "pp -l" now searchs in system library paths, and appends "lib" / prepends ".$dl_ext" where necessary. * Bug Fixes - PAR segfaults on some Unix platforms due to a NULL pointer used in mktmpdir.c. Fixed. - "pp -o out.par -p -e '...'" now honors -o; previously it used "a.out.par" anyway. - Inhibited spurious uninitialized warnings under -w in the POD-stripping code. - Win32 did not properly cleans up PAR_TEMP directory, resulting in failure for executables that reused the same PID. Fixed. [Changes for 0.68 - May 26, 2003] * New Features - New 'pp -l' option to pack additional shared libraries (DLLs). - POD-stripped libraries inside PAR files now have #line directives inserted, so they report the original line numbers on failure. - PAR files generated by 'pp' now has a MANIFEST file that can be viewed by Gecko-based browsers with Javascript turned on, e.g.: jar:http://aut.dyndns.org/par/test.par!/MANIFEST * Bug Fixes - Each pp-executable instance now creates its own PAR_TEMP directory; this avoids permission errors when multiple users run the same binary. As a consequence, PAR_CLEARTEMP is now set to "1" by default. - Newer versions of shared Zlib library no longer causes "pp" to generate broken executables. - Fixed dynamic loading on Cygwin was failing due to missing +x mode. - Like "use lib", "use PAR 'name.par'" now unshift()s instead of push()es into @INC. Same applies for "par.pl -A" and "parl -A". - Fixed building on ActivePerl 626 and below due to a missing $Config{ld}. [Changes for 0.67 - April 1, 2003] * New Features - PAR now works on Cygwin and MinGW/MSYS. - Globbing support in PAR::import(): use PAR "/path/*.pm"; - New license clarification messages added to POD and 'pp -V'. - All 'pp' options now has a short form (-o) and a long form (--output). - Revamped documentation for 'pp'. - New -g (--gui) flag for 'pp' to build console-less Win32 executables. * Bug Fixes - Building on Darwin Perl 5.6.0 was broken with 'cc -s'. - Building on 5.6.0 was broken due to bad 'base.pm'. - Win32 Tk::Widget autoloading was broken due to a binmode() bug. - IPC::Run was pod-stripped incorrectly. Fixed. - Depends on Module::ScanDeps 0.19, which supports utf8 and .ph files. - Better AutoInstall support, which uses 'sudo' where necessary. [Changes for 0.66 - March 20, 2003] * New Features - Adds PAR::Intro, a PODified version of the online presentation. - Adds App::Packer::Backend::PAR, a bridge between PAR and App::Packer. - Scripts and modules are now searched in "/" last, instead of first. - Experimental patch for packing shared libraries via "pp -l". - HTTP fetching of precompiled packages in addition to FTP. * Bug Fixes - Makefile.PL now downloads precompiled packages only if needed. - AutoInstall has been made to work for an easier installation. - The redundant "parl.exe.bat" is no longer created on Win32. - Pre-0.63 PARs used to leave broken .dll in TEMP; now they're cleaned. - "pp c:\something.pl" no longer treats c: as a relative path. - "pp -I dir" now searches 'dir' first, instead of last. - "pp" was broken on Perl 5.6.0 due to => stringification bugs. - Support for Tk::Widget autoloading has been added. - "parl" was not stripped if "gcc" was invoked as "cc"; fixed. - On a machine with multiple "parl"s, "pp" now uses the correct one. - File::Temp was missing as a dependency. * Known Issues - Cygwin support is still broken. - PAR does not include utf8_heavy.pl nor unicore/* for scripts that has "use utf8;". This has since been fixed by Module::ScanDeps 0.18. [Changes for 0.65 - March 9, 2003] This release comes with several significant improvements: * Automatic binary installation Previously, users without a C compiler cannot build the 'parl' executable, and is therefore unable to create self-contained binaries using 'pp'. Now, if there is a binary package available for that architecture under my CPAN directory, the Makefile.PL script will automatically fetch it, unpack into blib/, and the installation will continue as normal, resulting in a fully-functional 'pp'. This feature is part of the soon-to-be-released Module::Install framework; it will greatly benefit all CPAN authors with non-pure-perl distributions. * POD stripping Packages generated with 'pp' will now strip POD sections from all packed dependencies (your own scripts is unaffected); all binary executables will save at least 276732 bytes, with additional ~20% saving in additional packed dependencies. You can turn off this feature with the PAR_VERBATIM environment variable. * XS Incompatibility solved Because 'pp'-generated executables includes some fixed version of shared libraries (IO, Zlib, etc), they used to break when the target system has different version of shared libraries. Now PAR::Heavy intercepts DynaLoader::dl_expandspec to always prefer the library inside the PAR file, so this issue is resolved. * 5.6.1 Reclaimed Thanks to Sisyphus and various others, building on Perl 5.6.1 (with its old ExtUtils::MakeMaker and lack of PTHREAD_ATFORK) now works again. [Changes for 0.64 - March 2, 2003] * New Features - The t/0-signature.t test is re-enabled for people using my Module::Signature to verify the module's OpenPGP signature. - This release is the first distribution on CPAN to use the Module::Install framework, which is a stand-alone, extensible drop-in replacement for ExtUtils::MakeMaker that needs no extra action/prerequisites for end users. * Bug Fixes - Dynamic loading on Win32 was broken, due to a binmode() bug reported by Bill Atkins, D. Menzel and others. - Building on Win32 in directory names that contain spaces did not work. [Changes for 0.63 - February 6, 2003] * Bug Fixes - The 'parl' binary (which replaces the old 'par' or 'par.exe') didn't work properly when bundling perl modules for self- contained executables, rendering 'pp' useless on machines without core perl. PAR-1.007/lib/0000755000372000037200000000000012041335453013067 5ustar roderichroderichPAR-1.007/lib/PAR.pm0000644000372000037200000011561412041334255014056 0ustar roderichroderichpackage PAR; $PAR::VERSION = '1.007'; use 5.006; use strict; use warnings; use Config '%Config'; use Carp qw/croak/; # If the 'prefork' module is available, we # register various run-time loaded modules with it. # That way, there is more shared memory in a forking # environment. BEGIN { if (eval 'require prefork') { prefork->import($_) for qw/ Archive::Zip File::Glob File::Spec File::Temp LWP::Simple PAR::Heavy /; # not including Archive::Unzip::Burst which only makes sense # in the context of a PAR::Packer'ed executable anyway. } } use PAR::SetupProgname; use PAR::SetupTemp; =head1 NAME PAR - Perl Archive Toolkit =head1 SYNOPSIS (If you want to make an executable that contains all module, scripts and data files, please consult the L utility instead. L used to be part of the PAR distribution but is now shipped as part of the L distribution instead.) Following examples assume a F file in Zip format. To use F from F<./foo.par>: % perl -MPAR=./foo.par -MHello % perl -MPAR=./foo -MHello # the .par part is optional Same thing, but search F in the C<@INC>; % perl -MPAR -Ifoo.par -MHello % perl -MPAR -Ifoo -MHello # ditto Following paths inside the PAR file are searched: /lib/ /arch/ /i386-freebsd/ # i.e. $Config{archname} /5.8.0/ # i.e. $Config{version} /5.8.0/i386-freebsd/ # both of the above / PAR files may also (recursively) contain other PAR files. All files under following paths will be considered as PAR files and searched as well: /par/i386-freebsd/ # i.e. $Config{archname} /par/5.8.0/ # i.e. $Config{version} /par/5.8.0/i386-freebsd/ # both of the above /par/ Run F