microperl plus missing config vars
[p5sagit/p5-mst-13.2.git] / lib / AutoSplit.pm
index bf0f925..bf92806 100644 (file)
@@ -1,6 +1,6 @@
 package AutoSplit;
 
-use 5.006_001;
+use 5.009005; # due to "my $_" and new regexp features
 use Exporter ();
 use Config qw(%Config);
 use File::Basename ();
@@ -10,7 +10,7 @@ use strict;
 our($VERSION, @ISA, @EXPORT, @EXPORT_OK, $Verbose, $Keep, $Maxlen,
     $CheckForAutoloader, $CheckModTime);
 
-$VERSION = "1.04_01";
+$VERSION = "1.05";
 @ISA = qw(Exporter);
 @EXPORT = qw(&autosplit &autosplit_lib_modules);
 @EXPORT_OK = qw($Verbose $Keep $Maxlen $CheckForAutoloader $CheckModTime);
@@ -147,14 +147,18 @@ if (defined (&Dos::UseLFN)) {
 my $Is_VMS = ($^O eq 'VMS');
 
 # allow checking for valid ': attrlist' attachments
-# (we use 'our' rather than 'my' here, due to the rather complex and buggy
-# behaviour of lexicals with qr// and (??{$lex}) )
-our $nested;
-$nested = qr{ \( (?: (?> [^()]+ ) | (??{ $nested }) )* \) }x;
-our $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) (?:\s*\:\s*|\s+(?!\:)) }x;
-our $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) = @_;
@@ -175,11 +179,11 @@ sub 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