package AutoSplit;
-use 5.006_001;
+use 5.009005; # due to "my $_" and new regexp features
use Exporter ();
use Config qw(%Config);
-use Carp qw(carp);
use File::Basename ();
use File::Path qw(mkpath);
use File::Spec::Functions qw(curdir catfile catdir);
our($VERSION, @ISA, @EXPORT, @EXPORT_OK, $Verbose, $Keep, $Maxlen,
$CheckForAutoloader, $CheckModTime);
-$VERSION = "1.0307";
+$VERSION = "1.05";
@ISA = qw(Exporter);
@EXPORT = qw(&autosplit &autosplit_lib_modules);
@EXPORT_OK = qw($Verbose $Keep $Maxlen $CheckForAutoloader $CheckModTime);
my $Is_VMS = ($^O eq 'VMS');
# allow checking for valid ': attrlist' attachments
-my $nested;
-$nested = qr{ \( (?: (?> [^()]+ ) | (??{ $nested }) )* \) }x;
-my $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) (?:\s*\:\s*|\s+(?!\:)) }x;
-my $attr_list = qr{ \s* : \s* (?: $one_attr )* }x;
-
+my $attr_list = qr{
+ \s* : \s*
+ (?:
+ # one attribute
+ (?> # no backtrack
+ (?! \d) \w+
+ (?<nested> \( (?: [^()]++ | (?&nested)++ )*+ \) ) ?
+ )
+ (?: \s* : \s* | \s+ (?! :) )
+ )*
+}x;
sub autosplit{
my($file, $autodir, $keep, $ckal, $ckmt) = @_;
autosplit_file($file, $autodir, $keep, $ckal, $ckmt);
}
+sub carp{
+ require Carp;
+ goto &Carp::carp;
+}
# This function is used during perl building/installation
# ./miniperl -e 'use AutoSplit; autosplit_lib_modules(@ARGV)' ...
-sub autosplit_lib_modules{
+sub autosplit_lib_modules {
my(@modules) = @_; # list of Module names
- while(defined($_ = shift @modules)){
- while (m#(.*?[^:])::([^:].*)#) { # in case specified as ABC::XYZ
+ while (defined(my $_ = shift @modules)) {
+ while (m#([^:]+)::([^:].*)#) { # in case specified as ABC::XYZ
$_ = catfile($1, $2);
}
s|\\|/|g; # bug in ksh OS/2
print " deleting $file\n" if ($Verbose>=2);
my($deleted,$thistime); # catch all versions on VMS
do { $deleted += ($thistime = unlink $file) } while ($thistime);
- carp "Unable to delete $file: $!" unless $deleted;
+ carp ("Unable to delete $file: $!") unless $deleted;
}
closedir($outdir);
}
}
open(my $ts,">$al_idx_file") or
- carp "AutoSplit: unable to create timestamp file ($al_idx_file): $!";
+ carp ("AutoSplit: unable to create timestamp file ($al_idx_file): $!");
print $ts "# Index created by AutoSplit for $filename\n";
print $ts "# (file acts as timestamp)\n";
$last_package = '';