aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2019-08-21 20:57:08 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2019-08-21 20:57:08 +0300
commitdc4e27c823eca27c5fcf206778c6174b58a3b248 (patch)
treefd55778acf425d5e73f5ce606645139477b7ba01
parentfc1a31d9d6a356fe566e7e52a02d5da1d749fefc (diff)
downloadconfig-parser-dc4e27c823eca27c5fcf206778c6174b58a3b248.tar.gz
config-parser-dc4e27c823eca27c5fcf206778c6174b58a3b248.tar.bz2
Fixes for perl 5.16.1. Version 1.01v1.01
* Changes: Update. * lib/Config/Parser.pm (new): Pass class as an argument to findsynt, instead of using class method syntax. (findsynt): Exclude *::SUPER class, returned on perl 5.16.3 and below.
-rw-r--r--Changes3
-rw-r--r--lib/Config/Parser.pm29
2 files changed, 21 insertions, 11 deletions
diff --git a/Changes b/Changes
index d868749..8447966 100644
--- a/Changes
+++ b/Changes
@@ -2,2 +2,5 @@ Revision history for Perl extension Config::Parser
+1.01 Wed Aug 21 20:41:47 2019
+ - runs on perl 5.16.1
+
1.00 Tue Aug 20 16:35:44 2019
diff --git a/lib/Config/Parser.pm b/lib/Config/Parser.pm
index 17a3cd0..6ca5bf7 100644
--- a/lib/Config/Parser.pm
+++ b/lib/Config/Parser.pm
@@ -9,3 +9,3 @@ use Class::Inspector;
-our $VERSION = "1.00";
+our $VERSION = "1.01";
@@ -36,3 +36,3 @@ sub new {
foreach my $c (@$subs) {
- if (my ($file, $line, $data) = $c->findsynt) {
+ if (my ($file, $line, $data) = findsynt($c)) {
my $d = $self->loadsynt($file, $line, $data);
@@ -72,11 +72,18 @@ sub findsynt {
$file .= '.pm';
- $file = abs_path($INC{$file})
- or croak "can't find module file for $class";
- local ($/, *FILE);
- open FILE, $file or croak "Can't open $file";
- my ($text, $data) = split /(?m)^__DATA__$/, <FILE>, 2;
- close FILE;
-
- return () unless $data;
- return ($file, 1+($text =~ tr/\n//), $data);
+ # Normally each loaded file has a corresponding entry in %INC. However,
+ # in perl 5.16.3 and below, a call to Class::Inspector->subclasses
+ # for Config::Parser::Package returns, among real classes the "class"
+ # Config::Parser::SUPER, which is apparently an alias to Config::Parser,
+ # except that it satisfies the isa('Config::Parser::Package') check and
+ # is not listed in %INC. The exists check below helps eliminate it.
+ if (exists($INC{$file})) {
+ $file = abs_path($INC{$file})
+ or croak "can't find module file for $class";
+ local ($/, *FILE);
+ open FILE, $file or croak "Can't open $file";
+ my ($text, $data) = split /(?m)^__DATA__$/, <FILE>, 2;
+ close FILE;
+ return ($file, 1+($text =~ tr/\n//), $data) if $data;
+ }
+ return ();
}

Return to:

Send suggestions and report system problems to the System administrator.