Commit dcaee15c authored by Jonathan Yu's avatar Jonathan Yu

New upstream release

parent 14726ebd
0.43 2009-11-18
* Test warning fixes (Theory)
* Dist fixes suggested by rafl (Sartak)
0.42 2009-11-01 0.42 2009-11-01
* Added the "strict" attribute to make exceptional situations fatal. (Theory) * Added the "strict" attribute to make exceptional situations fatal. (Theory)
* Removed unused "implementor" attribute in Template::Declare::TagSet. (Theory) * Removed unused "implementor" attribute in Template::Declare::TagSet. (Theory)
......
...@@ -3,10 +3,13 @@ abstract: 'Perlish declarative templates' ...@@ -3,10 +3,13 @@ abstract: 'Perlish declarative templates'
author: author:
- 'Jesse Vincent <jesse@bestpractical.com>' - 'Jesse Vincent <jesse@bestpractical.com>'
build_requires: build_requires:
ExtUtils::MakeMaker: 6.42
Test::More: 0 Test::More: 0
Test::Warn: 0.11 Test::Warn: 0.11
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module distribution_type: module
generated_by: 'Module::Install version 0.79' generated_by: 'Module::Install version 0.91'
license: perl license: perl
meta-spec: meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html url: http://module-build.sourceforge.net/META-spec-v1.4.html
...@@ -24,4 +27,4 @@ requires: ...@@ -24,4 +27,4 @@ requires:
perl: 5.8.2 perl: 5.8.2
resources: resources:
license: http://dev.perl.org/licenses/ license: http://dev.perl.org/licenses/
version: 0.39 version: 0.43
...@@ -14,31 +14,31 @@ not run its Makefile.PL or Build.PL. ...@@ -14,31 +14,31 @@ not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE----- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Hash: SHA1
SHA1 7cff9cc5fac2ce5a6a95ef53b1a7eec956e38cef Changes SHA1 1f0796eb8283c5a5fbdd61bbff4871a4b52a95b3 Changes
SHA1 a5d3db06dc839282824ffa638a6cfe2ffdee78a9 MANIFEST SHA1 a5d3db06dc839282824ffa638a6cfe2ffdee78a9 MANIFEST
SHA1 6c79a8c5140fc8b0146fbc8f77acc613797eeb6f MANIFEST.SKIP SHA1 6c79a8c5140fc8b0146fbc8f77acc613797eeb6f MANIFEST.SKIP
SHA1 ab968279525d26d23e4bf76e3d15e4951f87996f META.yml SHA1 b14321a19c6631b4d3a528314efe655534ad4bd7 META.yml
SHA1 ee899bc436e17646223925d431d3e9727c1254d1 Makefile.PL SHA1 ee899bc436e17646223925d431d3e9727c1254d1 Makefile.PL
SHA1 1af5061c03daaf9d18c76108b6fb7cea29b315ed README SHA1 1af5061c03daaf9d18c76108b6fb7cea29b315ed README
SHA1 603bb9de29fb8cba7f13409c546750972eff645d inc/Module/AutoInstall.pm SHA1 e5fb92ac217988bfc7a6af739b0459627020a27e inc/Module/AutoInstall.pm
SHA1 ae018c4565c1277089ca8f1b28f888d95430cb7f inc/Module/Install.pm SHA1 fd5f3c4f0418efee3b9b16cf8c3902e8374909df inc/Module/Install.pm
SHA1 0a6f29536bedea3bb94744a7d43ffe39da7e4819 inc/Module/Install/AutoInstall.pm SHA1 5c529e96420d964b192f011b121283a4916f7331 inc/Module/Install/AutoInstall.pm
SHA1 4552acdfca8b78f8015d8449e1325616259095f5 inc/Module/Install/Base.pm SHA1 7cd7c349afdf3f012e475507b1017bdfa796bfbd inc/Module/Install/Base.pm
SHA1 7fb663fff161fb45882b52edd62857bf15359658 inc/Module/Install/Can.pm SHA1 ba186541bbf6439111f01fc70769cf24d22869bf inc/Module/Install/Can.pm
SHA1 8b1d3db746faa6faf2d967a48d3812ec1f44b4c6 inc/Module/Install/Fetch.pm SHA1 aaa50eca0d7751db7a4d953fac9bc72c6294e238 inc/Module/Install/Fetch.pm
SHA1 d7ce736cdd05d5156d379ef39cca93beeeeba828 inc/Module/Install/Include.pm SHA1 219da5a95c290312a81477b226f005997d97dcfd inc/Module/Install/Include.pm
SHA1 9f6beaa2f4749ceb5dd0c9b0c647d0f3289c7b46 inc/Module/Install/Makefile.pm SHA1 3e83972921d54198d1246f7278f08664006cd65d inc/Module/Install/Makefile.pm
SHA1 bd988ba3fb7eee0ad889eadc2f5338a8d98fc2a3 inc/Module/Install/Metadata.pm SHA1 12bf1867955480d47d5171a9e9c6a96fabe0b58f inc/Module/Install/Metadata.pm
SHA1 e9aa83f3e8b16ccfce544a90a57b63b70a497759 inc/Module/Install/Win32.pm SHA1 f7ee667e878bd2faf22ee9358a7b5a2cc8e91ba4 inc/Module/Install/Win32.pm
SHA1 ade2ac0b0246d4d8e28fa46942e53f6925abda46 inc/Module/Install/WriteAll.pm SHA1 8ed29d6cf217e0977469575d788599cbfb53a5ca inc/Module/Install/WriteAll.pm
SHA1 bd3aacdeeec829929f7f9ab7c669510b6e315266 lib/Template/Declare.pm SHA1 ae08fdca2d014fdcf9a1ae6541d6167a429449ef lib/Template/Declare.pm
SHA1 4202a05659532bea1d800bc7296d9c1312624f9b lib/Template/Declare/Buffer.pm SHA1 4202a05659532bea1d800bc7296d9c1312624f9b lib/Template/Declare/Buffer.pm
SHA1 c86b1e4749f76137c854358f496e8a8030d39fe7 lib/Template/Declare/TagSet.pm SHA1 c86b1e4749f76137c854358f496e8a8030d39fe7 lib/Template/Declare/TagSet.pm
SHA1 bd39d582e69e0725124a0ffcee10c5d12a2377b3 lib/Template/Declare/TagSet/HTML.pm SHA1 bd39d582e69e0725124a0ffcee10c5d12a2377b3 lib/Template/Declare/TagSet/HTML.pm
SHA1 c1703c1f999d27878117e0aaf59dcae1d9d98645 lib/Template/Declare/TagSet/RDF.pm SHA1 c1703c1f999d27878117e0aaf59dcae1d9d98645 lib/Template/Declare/TagSet/RDF.pm
SHA1 8ba58a5c640010febb799bb03b7857eda34c86bc lib/Template/Declare/TagSet/RDF/EM.pm SHA1 8ba58a5c640010febb799bb03b7857eda34c86bc lib/Template/Declare/TagSet/RDF/EM.pm
SHA1 2941a453d2627e0c0c02b8f50e7600c648867831 lib/Template/Declare/TagSet/XUL.pm SHA1 2941a453d2627e0c0c02b8f50e7600c648867831 lib/Template/Declare/TagSet/XUL.pm
SHA1 f12037ad41f686043f0bfbb8e7a8ad643424b072 lib/Template/Declare/Tags.pm SHA1 87a35c3fa0902118bc32540c8c4462db5408f89a lib/Template/Declare/Tags.pm
SHA1 238e8999db8b1a8221dcac8afbf0c60448670974 t/99-pod-coverage.t SHA1 238e8999db8b1a8221dcac8afbf0c60448670974 t/99-pod-coverage.t
SHA1 bb0da54f2b3f2d7955baa41ee458cb3d1887f475 t/99-pod.t SHA1 bb0da54f2b3f2d7955baa41ee458cb3d1887f475 t/99-pod.t
SHA1 8de6d59c7ed7c771f9cdc5e2dbaef0c31c7ab439 t/MyTagSet.pm SHA1 8de6d59c7ed7c771f9cdc5e2dbaef0c31c7ab439 t/MyTagSet.pm
...@@ -76,7 +76,7 @@ SHA1 dad25f5c714947cf7fb5954fb876b18114c43ed5 t/self.t ...@@ -76,7 +76,7 @@ SHA1 dad25f5c714947cf7fb5954fb876b18114c43ed5 t/self.t
SHA1 771c903ee077531f0829b9d4efda1ca4fbd2fdfd t/siblings.t SHA1 771c903ee077531f0829b9d4efda1ca4fbd2fdfd t/siblings.t
SHA1 31a78875cd464b5b2c21cee53c5498c97c395ebb t/similar-aliases.t SHA1 31a78875cd464b5b2c21cee53c5498c97c395ebb t/similar-aliases.t
SHA1 fe981469874ceb8b32100e82559d5eea14db3259 t/smart_tag_wrapper.t SHA1 fe981469874ceb8b32100e82559d5eea14db3259 t/smart_tag_wrapper.t
SHA1 3827af507d9d6f29c64be94d1444d6c146ece611 t/strict.t SHA1 b4e187860320bbcdffa8036a76b47752521fb1ff t/strict.t
SHA1 5a4d6002efea9daf71d3d291bf2a35751a51cba8 t/subclassing.t SHA1 5a4d6002efea9daf71d3d291bf2a35751a51cba8 t/subclassing.t
SHA1 679b39abb4812ca1c61ad9e9dd3f5aab97f8829c t/subtemplates.t SHA1 679b39abb4812ca1c61ad9e9dd3f5aab97f8829c t/subtemplates.t
SHA1 44f81200ec38ebf8bc9c836e34942f70990e7207 t/tag_sub_list.t SHA1 44f81200ec38ebf8bc9c836e34942f70990e7207 t/tag_sub_list.t
...@@ -93,7 +93,7 @@ SHA1 7bdcccbdd5253f4eae12d3c279183e10577a0184 t/xss.t ...@@ -93,7 +93,7 @@ SHA1 7bdcccbdd5253f4eae12d3c279183e10577a0184 t/xss.t
-----BEGIN PGP SIGNATURE----- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin) Version: GnuPG v1.4.7 (Darwin)
iD8DBQFK7fTjsxfQtHhyRPoRAoS6AJ4tPTryahUgXsB7i655g8PN6YVF3QCeKeVK iD8DBQFLBJOEsxfQtHhyRPoRAvGYAJ4uu5W2pD0CF0d7TGh+4UL0I3a51QCfasjc
04wL4T14yJ+WzU5iR0ILz+o= slIwJcJ+UPqB60eHY04q2GQ=
=oL96 =ehsE
-----END PGP SIGNATURE----- -----END PGP SIGNATURE-----
libtemplate-declare-perl (0.43-1) UNRELEASED; urgency=low
* New upstream release
-- Jonathan Yu <jawnsy@cpan.org> Thu, 19 Nov 2009 08:38:22 -0500
libtemplate-declare-perl (0.42-1) unstable; urgency=low libtemplate-declare-perl (0.42-1) unstable; urgency=low
[ Jonathan Yu ] [ Jonathan Yu ]
......
...@@ -18,7 +18,9 @@ my %FeatureMap = ( ...@@ -18,7 +18,9 @@ my %FeatureMap = (
# various lexical flags # various lexical flags
my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS ); my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS );
my ( $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly ); my (
$Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly, $AllDeps
);
my ( $PostambleActions, $PostambleUsed ); my ( $PostambleActions, $PostambleUsed );
# See if it's a testing or non-interactive session # See if it's a testing or non-interactive session
...@@ -73,6 +75,9 @@ sub _init { ...@@ -73,6 +75,9 @@ sub _init {
elsif ( $arg =~ /^--test(?:only)?$/ ) { elsif ( $arg =~ /^--test(?:only)?$/ ) {
$TestOnly = 1; $TestOnly = 1;
} }
elsif ( $arg =~ /^--all(?:deps)?$/ ) {
$AllDeps = 1;
}
} }
} }
...@@ -115,6 +120,13 @@ sub import { ...@@ -115,6 +120,13 @@ sub import {
)[0] )[0]
); );
# We want to know if we're under CPAN early to avoid prompting, but
# if we aren't going to try and install anything anyway then skip the
# check entirely since we don't want to have to load (and configure)
# an old CPAN just for a cosmetic message
$UnderCPAN = _check_lock(1) unless $SkipInstall;
while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) { while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
my ( @required, @tests, @skiptests ); my ( @required, @tests, @skiptests );
my $default = 1; my $default = 1;
...@@ -163,15 +175,24 @@ sub import { ...@@ -163,15 +175,24 @@ sub import {
} }
# XXX: check for conflicts and uninstalls(!) them. # XXX: check for conflicts and uninstalls(!) them.
if ( my $cur = _load($mod);
defined( my $cur = _version_check( _load($mod), $arg ||= 0 ) ) ) if (_version_cmp ($cur, $arg) >= 0)
{ {
print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n"; print "loaded. ($cur" . ( $arg ? " >= $arg" : '' ) . ")\n";
push @Existing, $mod => $arg; push @Existing, $mod => $arg;
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests; $DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
} }
else { else {
print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n"; if (not defined $cur) # indeed missing
{
print "missing." . ( $arg ? " (would need $arg)" : '' ) . "\n";
}
else
{
# no need to check $arg as _version_cmp ($cur, undef) would satisfy >= above
print "too old. ($cur < $arg)\n";
}
push @required, $mod => $arg; push @required, $mod => $arg;
} }
} }
...@@ -184,6 +205,8 @@ sub import { ...@@ -184,6 +205,8 @@ sub import {
!$SkipInstall !$SkipInstall
and ( and (
$CheckOnly $CheckOnly
or ($mandatory and $UnderCPAN)
or $AllDeps
or _prompt( or _prompt(
qq{==> Auto-install the } qq{==> Auto-install the }
. ( @required / 2 ) . ( @required / 2 )
...@@ -214,8 +237,6 @@ sub import { ...@@ -214,8 +237,6 @@ sub import {
} }
} }
$UnderCPAN = _check_lock(); # check for $UnderCPAN
if ( @Missing and not( $CheckOnly or $UnderCPAN ) ) { if ( @Missing and not( $CheckOnly or $UnderCPAN ) ) {
require Config; require Config;
print print
...@@ -234,21 +255,38 @@ sub import { ...@@ -234,21 +255,38 @@ sub import {
*{'main::WriteMakefile'} = \&Write if caller(0) eq 'main'; *{'main::WriteMakefile'} = \&Write if caller(0) eq 'main';
} }
sub _running_under {
my $thing = shift;
print <<"END_MESSAGE";
*** Since we're running under ${thing}, I'll just let it take care
of the dependency's installation later.
END_MESSAGE
return 1;
}
# Check to see if we are currently running under CPAN.pm and/or CPANPLUS; # Check to see if we are currently running under CPAN.pm and/or CPANPLUS;
# if we are, then we simply let it taking care of our dependencies # if we are, then we simply let it taking care of our dependencies
sub _check_lock { sub _check_lock {
return unless @Missing; return unless @Missing or @_;
my $cpan_env = $ENV{PERL5_CPAN_IS_RUNNING};
if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) { if ($ENV{PERL5_CPANPLUS_IS_RUNNING}) {
print <<'END_MESSAGE'; return _running_under($cpan_env ? 'CPAN' : 'CPANPLUS');
}
*** Since we're running under CPANPLUS, I'll just let it take care require CPAN;
of the dependency's installation later.
END_MESSAGE if ($CPAN::VERSION > '1.89') {
return 1; if ($cpan_env) {
return _running_under('CPAN');
}
return; # CPAN.pm new enough, don't need to check further
} }
_load_cpan(); # last ditch attempt, this -will- configure CPAN, very sorry
_load_cpan(1); # force initialize even though it's already loaded
# Find the CPAN lock-file # Find the CPAN lock-file
my $lock = MM->catfile( $CPAN::Config->{cpan_home}, ".lock" ); my $lock = MM->catfile( $CPAN::Config->{cpan_home}, ".lock" );
...@@ -284,7 +322,7 @@ sub install { ...@@ -284,7 +322,7 @@ sub install {
while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) { while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
# grep out those already installed # grep out those already installed
if ( defined( _version_check( _load($pkg), $ver ) ) ) { if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
push @installed, $pkg; push @installed, $pkg;
} }
else { else {
...@@ -313,7 +351,7 @@ sub install { ...@@ -313,7 +351,7 @@ sub install {
@modules = @newmod; @modules = @newmod;
} }
if ( _has_cpanplus() ) { if ( _has_cpanplus() and not $ENV{PERL_AUTOINSTALL_PREFER_CPAN} ) {
_install_cpanplus( \@modules, \@config ); _install_cpanplus( \@modules, \@config );
} else { } else {
_install_cpan( \@modules, \@config ); _install_cpan( \@modules, \@config );
...@@ -323,7 +361,7 @@ sub install { ...@@ -323,7 +361,7 @@ sub install {
# see if we have successfully installed them # see if we have successfully installed them
while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) { while ( my ( $pkg, $ver ) = splice( @modules, 0, 2 ) ) {
if ( defined( _version_check( _load($pkg), $ver ) ) ) { if ( _version_cmp( _load($pkg), $ver ) >= 0 ) {
push @installed, $pkg; push @installed, $pkg;
} }
elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) { elsif ( $args{do_once} and open( FAILED, '>> .#autoinstall.failed' ) ) {
...@@ -378,7 +416,7 @@ sub _install_cpanplus { ...@@ -378,7 +416,7 @@ sub _install_cpanplus {
my $success; my $success;
my $obj = $modtree->{$pkg}; my $obj = $modtree->{$pkg};
if ( $obj and defined( _version_check( $obj->{version}, $ver ) ) ) { if ( $obj and _version_cmp( $obj->{version}, $ver ) >= 0 ) {
my $pathname = $pkg; my $pathname = $pkg;
$pathname =~ s/::/\\W/; $pathname =~ s/::/\\W/;
...@@ -471,7 +509,7 @@ sub _install_cpan { ...@@ -471,7 +509,7 @@ sub _install_cpan {
my $obj = CPAN::Shell->expand( Module => $pkg ); my $obj = CPAN::Shell->expand( Module => $pkg );
my $success = 0; my $success = 0;
if ( $obj and defined( _version_check( $obj->cpan_version, $ver ) ) ) { if ( $obj and _version_cmp( $obj->cpan_version, $ver ) >= 0 ) {
my $pathname = $pkg; my $pathname = $pkg;
$pathname =~ s/::/\\W/; $pathname =~ s/::/\\W/;
...@@ -535,7 +573,7 @@ sub _update_to { ...@@ -535,7 +573,7 @@ sub _update_to {
my $ver = shift; my $ver = shift;
return return
if defined( _version_check( _load($class), $ver ) ); # no need to upgrade if _version_cmp( _load($class), $ver ) >= 0; # no need to upgrade
if ( if (
_prompt( "==> A newer version of $class ($ver) is required. Install?", _prompt( "==> A newer version of $class ($ver) is required. Install?",
...@@ -632,7 +670,7 @@ sub _load { ...@@ -632,7 +670,7 @@ sub _load {
# Load CPAN.pm and it's configuration # Load CPAN.pm and it's configuration
sub _load_cpan { sub _load_cpan {
return if $CPAN::VERSION; return if $CPAN::VERSION and $CPAN::Config and not @_;
require CPAN; require CPAN;
if ( $CPAN::HandleConfig::VERSION ) { if ( $CPAN::HandleConfig::VERSION ) {
# Newer versions of CPAN have a HandleConfig module # Newer versions of CPAN have a HandleConfig module
...@@ -644,9 +682,11 @@ sub _load_cpan { ...@@ -644,9 +682,11 @@ sub _load_cpan {
} }
# compare two versions, either use Sort::Versions or plain comparison # compare two versions, either use Sort::Versions or plain comparison
sub _version_check { # return values same as <=>
sub _version_cmp {
my ( $cur, $min ) = @_; my ( $cur, $min ) = @_;
return unless defined $cur; return -1 unless defined $cur; # if 0 keep comparing
return 1 unless $min;
$cur =~ s/\s+$//; $cur =~ s/\s+$//;
...@@ -657,16 +697,13 @@ sub _version_check { ...@@ -657,16 +697,13 @@ sub _version_check {
) { ) {
# use version.pm if it is installed. # use version.pm if it is installed.
return ( return version->new($cur) <=> version->new($min);
( version->new($cur) >= version->new($min) ) ? $cur : undef );
} }
elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) ) elsif ( $Sort::Versions::VERSION or defined( _load('Sort::Versions') ) )
{ {
# use Sort::Versions as the sorting algorithm for a.b.c versions # use Sort::Versions as the sorting algorithm for a.b.c versions
return ( ( Sort::Versions::versioncmp( $cur, $min ) != -1 ) return Sort::Versions::versioncmp( $cur, $min );
? $cur
: undef );
} }
warn "Cannot reliably compare non-decimal formatted versions.\n" warn "Cannot reliably compare non-decimal formatted versions.\n"
...@@ -675,7 +712,7 @@ sub _version_check { ...@@ -675,7 +712,7 @@ sub _version_check {
# plain comparison # plain comparison
local $^W = 0; # shuts off 'not numeric' bugs local $^W = 0; # shuts off 'not numeric' bugs
return ( $cur >= $min ? $cur : undef ); return $cur <=> $min;
} }
# nothing; this usage is deprecated. # nothing; this usage is deprecated.
...@@ -706,7 +743,7 @@ sub _make_args { ...@@ -706,7 +743,7 @@ sub _make_args {
if $Config; if $Config;
$PostambleActions = ( $PostambleActions = (
$missing ($missing and not $UnderCPAN)
? "\$(PERL) $0 --config=$config --installdeps=$missing" ? "\$(PERL) $0 --config=$config --installdeps=$missing"
: "\$(NOECHO) \$(NOOP)" : "\$(NOECHO) \$(NOOP)"
); );
...@@ -746,7 +783,7 @@ sub Write { ...@@ -746,7 +783,7 @@ sub Write {
sub postamble { sub postamble {
$PostambleUsed = 1; $PostambleUsed = 1;
return << "."; return <<"END_MAKE";
config :: installdeps config :: installdeps
\t\$(NOECHO) \$(NOOP) \t\$(NOECHO) \$(NOOP)
...@@ -757,7 +794,7 @@ checkdeps :: ...@@ -757,7 +794,7 @@ checkdeps ::
installdeps :: installdeps ::
\t$PostambleActions \t$PostambleActions
. END_MAKE
} }
...@@ -765,4 +802,4 @@ installdeps :: ...@@ -765,4 +802,4 @@ installdeps ::
__END__ __END__
#line 1003 #line 1056
...@@ -17,12 +17,10 @@ package Module::Install; ...@@ -17,12 +17,10 @@ package Module::Install;
# 3. The ./inc/ version of Module::Install loads # 3. The ./inc/ version of Module::Install loads
# } # }
BEGIN { use 5.005;
require 5.004;
}
use strict 'vars'; use strict 'vars';
use vars qw{$VERSION}; use vars qw{$VERSION $MAIN};
BEGIN { BEGIN {
# All Module::Install core packages now require synchronised versions. # All Module::Install core packages now require synchronised versions.
# This will be used to ensure we don't accidentally load old or # This will be used to ensure we don't accidentally load old or
...@@ -30,7 +28,10 @@ BEGIN { ...@@ -30,7 +28,10 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few # 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 # releases once we can make sure it won't clash with custom
# Module::Install extensions. # Module::Install extensions.
$VERSION = '0.79'; $VERSION = '0.91';
# Storage for the pseudo-singleton
$MAIN = undef;
*inc::Module::Install::VERSION = *VERSION; *inc::Module::Install::VERSION = *VERSION;
@inc::Module::Install::ISA = __PACKAGE__; @inc::Module::Install::ISA = __PACKAGE__;
...@@ -69,15 +70,26 @@ END_DIE ...@@ -69,15 +70,26 @@ END_DIE
# again. This is bad. Rather than taking action to touch it (which # again. This is bad. Rather than taking action to touch it (which
# is unreliable on some platforms and requires write permissions) # is unreliable on some platforms and requires write permissions)
# for now we should catch this and refuse to run. # for now we should catch this and refuse to run.
if ( -f $0 and (stat($0))[9] > time ) { die <<"END_DIE" } if ( -f $0 ) {
my $s = (stat($0))[9];
# If the modification time is only slightly in the future,
# sleep briefly to remove the problem.
my $a = $s - time;
if ( $a > 0 and $a < 5 ) { sleep 5 }
# Too far in the future, throw an error.
my $t = time;
if ( $s > $t ) { die <<"END_DIE" }
Your installer $0 has a modification time in the future. Your installer $0 has a modification time in the future ($s > $t).
This is known to create infinite loops in make. This is known to create infinite loops in make.
Please correct this, then run $0 again. Please correct this, then run $0 again.
END_DIE END_DIE
}
...@@ -121,14 +133,22 @@ sub autoload { ...@@ -121,14 +133,22 @@ sub autoload {
$sym->{$cwd} = sub { $sym->{$cwd} = sub {
my $pwd = Cwd::cwd(); my $pwd = Cwd::cwd();
if ( my $code = $sym->{$pwd} ) { if ( my $code = $sym->{$pwd} ) {
# delegate back to parent dirs # Delegate back to parent dirs
goto &$code unless $cwd eq $pwd; goto &$code unless $cwd eq $pwd;
} }
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym"; $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
unless ( uc($1) eq $1 ) { my $method = $1;
unshift @_, ( $self, $1 ); if ( uc($method) eq $method ) {
goto &{$self->can('call')}; # 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')};
}; };
} }
...@@ -153,6 +173,9 @@ sub import { ...@@ -153,6 +173,9 @@ sub import {
delete $INC{"$self->{file}"}; delete $INC{"$self->{file}"};
delete $INC{"$self->{path}.pm"}; delete $INC{"$self->{path}.pm"};
# Save to the singleton
$MAIN = $self;
return 1; return 1;
} }
...@@ -166,8 +189,7 @@ sub preload { ...@@ -166,8 +189,7 @@ sub preload {
my @exts = @{$self->{extensions}}; my @exts = @{$self->{extensions}};
unless ( @exts ) { unless ( @exts ) {
my $admin = $self->{admin}; @exts = $self->{admin}->load_all_extensions;
@exts = $admin->load_all_extensions;
} }
my %seen; my %seen;
...@@ -250,7 +272,7 @@ END_DIE ...@@ -250,7 +272,7 @@ END_DIE
sub load_extensions { sub load_extensions {
my ($self, $path, $top) = @_; my ($self, $path, $top) = @_;
unless ( grep { !ref $_ and lc $_ eq lc $self->{prefix} } @INC ) { unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) {
unshift @INC, $self->{prefix}; unshift @INC, $self->{prefix};
} }
...@@ -314,7 +336,7 @@ sub find_extensions { ...@@ -314,7 +336,7 @@ sub find_extensions {
##################################################################### #####################################################################
# Utility Functions # Common Utility Functions
sub _caller { sub _caller {
my $depth = 0; my $depth = 0;
...@@ -328,31 +350,70 @@ sub _caller { ...@@ -328,31 +350,70 @@ sub _caller {
sub _read { sub _read {
local *FH; local *FH;
open FH, "< $_[0]" or die "open($_[0]): $!"; if ( $] >= 5.006 ) {
my $str = do { local $/; <FH> }; open( FH, '<', $_[0] ) or die "open($_[0]): $!";
} else {
open( FH, "< $_[0]" ) or die "open($_[0]): $!";
}
my $string = do { local $/; <FH> };
close FH or die "close($_[0]): $!"; close FH or die "close($_[0]): $!";
return $str; return $string;
}
sub _readperl {
my $string = Module::Install::_read($_[0]);
$string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
$string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s;
$string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg;
return $string;
}
sub _readpod {
my $string = Module::Install::_read($_[0]);
$string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
return $string if $_[0] =~ /\.pod\z/;
$string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg;
$string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg;
$string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg;
$string =~ s/^\n+//s;
return $string;
} }
sub _write { sub _write {
local *FH; local *FH;
open FH, "> $_[0]" or die "open($_[0]): $!"; if ( $] >= 5.006 ) {
foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!" } open( FH, '>', $_[0] ) or die "open($_[0]): $!";
} else {
open( FH, "> $_[0]" ) or die "open($_[0]): $!";
}
foreach ( 1 .. $#_ ) {
print FH $_[$_] or die "print($_[0]): $!";
}
close FH or die "close($_[0]): $!"; close FH or die "close($_[0]): $!";
} }
# _version is for processing module versions (eg, 1.03_05) not # _version is for processing module versions (eg, 1.03_05) not
# Perl versions (eg, 5.8.1). # Perl versions (eg, 5.8.1).
sub _version ($) { sub _version ($) {
my $s = shift || 0; my $s = shift || 0;
$s =~ s/^(\d+)\.?//; my $d =()= $s =~ /(\.)/g;
if ( $d >= 2 ) {
# Normalise multipart versions
$s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
}
$s =~ s/^(\d+)\.?//;
my $l = $1 || 0; my $l = $1 || 0;
my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g; my @v = map {
$l = $l . '.' . join '', @v if @v; $_ . '0' x (3 - length $_)
} $s =~ /(\d{1,3})\D?/g;
$l = $l . '.' . join '', @v if @v;