30
28
# This is not enforced yet, but will be some time in the next few
31
29
# releases once we can make sure it won't clash with custom
32
30
# Module::Install extensions.
33
# Storage for the pseudo-singleton
35
36
*inc::Module::Install::VERSION = *VERSION;
36
37
@inc::Module::Install::ISA = __PACKAGE__;
69
70
# again. This is bad. Rather than taking action to touch it (which
70
71
# is unreliable on some platforms and requires write permissions)
71
72
# for now we should catch this and refuse to run.
72
if ( -f $0 and (stat($0))[9] > time ) { die <<"END_DIE" }
74
Your installer $0 has a modification time in the future.
74
my $s = (stat($0))[9];
76
# If the modification time is only slightly in the future,
77
# sleep briefly to remove the problem.
79
if ( $a > 0 and $a < 5 ) { sleep 5 }
81
# Too far in the future, throw an error.
83
if ( $s > $t ) { die <<"END_DIE" }
85
Your installer $0 has a modification time in the future ($s > $t).
76
87
This is known to create infinite loops in make.
78
89
Please correct this, then run $0 again.
121
133
$sym->{$cwd} = sub {
122
134
my $pwd = Cwd::cwd();
123
135
if ( my $code = $sym->{$pwd} ) {
124
# delegate back to parent dirs
136
# Delegate back to parent dirs
125
137
goto &$code unless $cwd eq $pwd;
127
139
$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
141
if ( uc($method) eq $method ) {
144
} elsif ( $method =~ /^_/ and $self->can($method) ) {
145
# Dispatch to the root M:I class
146
return $self->$method(@_);
149
# Dispatch to the appropriate plugin
128
150
unshift @_, ( $self, $1 );
129
goto &{$self->can('call')} unless uc($1) eq $1;
151
goto &{$self->can('call')};
329
open FH, "< $_[0]" or die "open($_[0]): $!";
330
my $str = do { local $/; <FH> };
354
open( FH, '<', $_[0] ) or die "open($_[0]): $!";
356
open( FH, "< $_[0]" ) or die "open($_[0]): $!";
358
my $string = do { local $/; <FH> };
331
359
close FH or die "close($_[0]): $!";
364
my $string = Module::Install::_read($_[0]);
365
$string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
366
$string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s;
367
$string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg;
372
my $string = Module::Install::_read($_[0]);
373
$string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
374
return $string if $_[0] =~ /\.pod\z/;
375
$string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg;
376
$string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg;
377
$string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg;
378
$string =~ s/^\n+//s;
337
open FH, "> $_[0]" or die "open($_[0]): $!";
338
foreach ( 1 .. $#_ ) { print FH $_[$_] or die "print($_[0]): $!" }
385
open( FH, '>', $_[0] ) or die "open($_[0]): $!";
387
open( FH, "> $_[0]" ) or die "open($_[0]): $!";
389
foreach ( 1 .. $#_ ) {
390
print FH $_[$_] or die "print($_[0]): $!";
339
392
close FH or die "close($_[0]): $!";
395
# _version is for processing module versions (eg, 1.03_05) not
396
# Perl versions (eg, 5.8.1).
343
398
my $s = shift || 0;
399
my $d =()= $s =~ /(\.)/g;
401
# Normalise multipart versions
402
$s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
346
my @v = map { $_ . '0' x (3 - length $_) } $s =~ /(\d{1,3})\D?/g;
347
$l = $l . '.' . join '', @v if @v;
407
$_ . '0' x (3 - length $_)
408
} $s =~ /(\d{1,3})\D?/g;
409
$l = $l . '.' . join '', @v if @v;
414
_version($_[0]) <=> _version($_[1]);
417
# Cloned from Params::Util::_CLASS
424
$_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s
353
# Copyright 2008 Adam Kennedy.
430
# Copyright 2008 - 2009 Adam Kennedy.