summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2019-08-21 17:57:08 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2019-08-21 17:57:08 (GMT)
commitdc4e27c823eca27c5fcf206778c6174b58a3b248 (patch) (side-by-side diff)
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.
Diffstat (more/less context) (ignore whitespace changes)
-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
@@ -1,4 +1,7 @@
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
- initial release
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
@@ -7,7 +7,7 @@ use Cwd qw(abs_path);
use Text::ParseWords;
use Class::Inspector;
-our $VERSION = "1.00";
+our $VERSION = "1.01";
sub new {
my $class = shift;
@@ -34,7 +34,7 @@ sub new {
my $dict;
if ($subs) {
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);
if ($d) {
$dict = { %{$dict // {}}, %$d }
@@ -70,15 +70,22 @@ sub findsynt {
my $file = $class;
$file =~ s{::}{/}g;
$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 ();
}
sub loadsynt {

Return to:

Send suggestions and report system problems to the System administrator.