summaryrefslogtreecommitdiff
path: root/lib/SelfLoader.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/SelfLoader.pm')
-rw-r--r--lib/SelfLoader.pm10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/SelfLoader.pm b/lib/SelfLoader.pm
index c4e9175a79..4672ac49da 100644
--- a/lib/SelfLoader.pm
+++ b/lib/SelfLoader.pm
@@ -3,12 +3,18 @@ package SelfLoader;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(AUTOLOAD);
-$VERSION = "1.08";
+$VERSION = "1.09";
sub Version {$VERSION}
$DEBUG = 0;
my %Cache; # private cache for all SelfLoader's client packages
+# allow checking for valid ': attrlist' attachments
+my $nested;
+$nested = qr{ \( (?: (?> [^()]+ ) | (?p{ $nested }) )* \) }x;
+my $one_attr = qr{ (?> (?! \d) \w+ (?:$nested)? ) [\s,]* }x;
+my $attr_list = qr{ \s* : \s* (?: $one_attr )* }x;
+
sub croak { require Carp; goto &Carp::croak }
AUTOLOAD {
@@ -50,7 +56,7 @@ sub _load_stubs {
local($/) = "\n";
while(defined($line = <$fh>) and $line !~ m/^__END__/) {
- if ($line =~ m/^sub\s+([\w:]+)\s*(\([\\\$\@\%\&\*\;]*\))?/) {
+ if ($line =~ m/^sub\s+([\w:]+)\s*((?:\([\\\$\@\%\&\*\;]*\))?(?:$attr_list)?)/) {
push(@stubs, $self->_add_to_cache($name, $currpack, \@lines, $protoype));
$protoype = $2;
@lines = ($line);