![](https://seccdn.libravatar.org/avatar/e2145bc5cf53dda95c308a3c75e8fef3.jpg?s=120&d=mm&r=g)
Hello community,
here is the log from the commit of package perl-Module-Reader for openSUSE:Factory checked in at 2017-06-26 15:56:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Module-Reader (Old)
and /work/SRC/openSUSE:Factory/.perl-Module-Reader.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Module-Reader"
Mon Jun 26 15:56:28 2017 rev:5 rq:506084 version:0.003003
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Module-Reader/perl-Module-Reader.changes 2017-01-10 10:41:56.288409591 +0100
+++ /work/SRC/openSUSE:Factory/.perl-Module-Reader.new/perl-Module-Reader.changes 2017-06-26 15:56:31.055666476 +0200
@@ -1,0 +2,12 @@
+Thu Jun 22 05:53:38 UTC 2017 - coolo@suse.com
+
+- updated to 0.003003
+ see /usr/share/doc/packages/perl-Module-Reader/Changes
+
+ 0.003003 - 2017-06-21
+ - fix EACCES handling to match the current perl
+ - fix raw file handle access for unopened files
+ - call @INC hooks for ./, ../, and / paths if they weren't found directly
+ - add handling for a string reference prefix return from a hook
+
+-------------------------------------------------------------------
Old:
----
Module-Reader-0.003002.tar.gz
New:
----
Module-Reader-0.003003.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Module-Reader.spec ++++++
--- /var/tmp/diff_new_pack.ly2fQ6/_old 2017-06-26 15:56:31.747568907 +0200
+++ /var/tmp/diff_new_pack.ly2fQ6/_new 2017-06-26 15:56:31.751568343 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Module-Reader
#
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,14 +17,14 @@
Name: perl-Module-Reader
-Version: 0.003002
+Version: 0.003003
Release: 0
%define cpan_name Module-Reader
Summary: Find and read perl modules like perl does
License: Artistic-1.0 or GPL-1.0+
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Module-Reader/
-Source0: http://www.cpan.org/authors/id/H/HA/HAARG/%{cpan_name}-%{version}.tar.gz
+Source0: https://cpan.metacpan.org/authors/id/H/HA/HAARG/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ Module-Reader-0.003002.tar.gz -> Module-Reader-0.003003.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Reader-0.003002/Changes new/Module-Reader-0.003003/Changes
--- old/Module-Reader-0.003002/Changes 2016-12-14 09:13:32.000000000 +0100
+++ new/Module-Reader-0.003003/Changes 2017-06-21 18:21:27.000000000 +0200
@@ -1,5 +1,11 @@
Revision history for Module-Reader
+0.003003 - 2017-06-21
+ - fix EACCES handling to match the current perl
+ - fix raw file handle access for unopened files
+ - call @INC hooks for ./, ../, and / paths if they weren't found directly
+ - add handling for a string reference prefix return from a hook
+
0.003002 - 2016-12-14
- releasing as stable
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Reader-0.003002/MANIFEST new/Module-Reader-0.003003/MANIFEST
--- old/Module-Reader-0.003002/MANIFEST 2016-12-14 09:13:41.000000000 +0100
+++ new/Module-Reader-0.003003/MANIFEST 2017-06-21 18:21:35.000000000 +0200
@@ -4,9 +4,10 @@
Makefile.PL
MANIFEST This list of files
t/file-types.t
-t/lib/TestLib.pm
+t/lib/InlineModule.pm
t/main.t
t/memory.t
+t/test-data/lib/MyTestModule.pm
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
README README file (added by Distar)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Reader-0.003002/META.json new/Module-Reader-0.003003/META.json
--- old/Module-Reader-0.003002/META.json 2016-12-14 09:13:41.000000000 +0100
+++ new/Module-Reader-0.003003/META.json 2017-06-21 18:21:35.000000000 +0200
@@ -10,7 +10,7 @@
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "Module-Reader",
"no_index" : {
@@ -53,6 +53,6 @@
"web" : "https://github.com/haarg/Module-Reader"
}
},
- "version" : "0.003002",
- "x_serialization_backend" : "JSON::PP version 2.27300"
+ "version" : "0.003003",
+ "x_serialization_backend" : "JSON::PP version 2.94"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Reader-0.003002/META.yml new/Module-Reader-0.003003/META.yml
--- old/Module-Reader-0.003002/META.yml 2016-12-14 09:13:41.000000000 +0100
+++ new/Module-Reader-0.003003/META.yml 2017-06-21 18:21:35.000000000 +0200
@@ -24,5 +24,5 @@
bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Module-Reader
license: http://dev.perl.org/licenses/
repository: git://github.com/haarg/Module-Reader
-version: '0.003002'
+version: '0.003003'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Reader-0.003002/README new/Module-Reader-0.003003/README
--- old/Module-Reader-0.003002/README 2016-12-14 09:13:41.000000000 +0100
+++ new/Module-Reader-0.003003/README 2017-06-21 18:21:35.000000000 +0200
@@ -33,7 +33,7 @@
module_content ( $module_name, @search_directories )
Returns the content of a given module.
-CLASS ATTRIBUTES
+ATTRIBUTES
inc An array reference containing a list of directories or hooks to
search for modules or files. This will be used in the same manner
that require uses @INC. If not provided, @INC itself will be used.
@@ -52,6 +52,18 @@
A boolean controlling if the files found will be opened immediately
when found. Defaults to true.
+ abort_on_eacces
+ A boolean controlling if an error should be thrown or if the path
+ should be skipped when encountering "EACCES" (access denied) errors.
+ Defaults to true on perl 5.18 and above, matching the behavior of
+ require.
+
+ check_hooks_for_nonsearchable
+ For non-searchable paths (absolute paths and those starting with
+ "./" or "../") attempt to check the hook items (and not the
+ directories) in @INC if the file cannot be found directly. This
+ matches the behavior of perl. Defaults to true.
+
METHODS
module
Returns a file object for the given module name. If the module can't be
@@ -79,7 +91,7 @@
FILE METHODS
filename
- The filename that was seached for.
+ The filename that was searched for.
module
If a module was searched for, or a file of the matching form
@@ -172,7 +184,7 @@
information for the files that it finds.
Module::Locate
- Innacurately searches @INC for matching files. Attempts to handle
+ Inaccurately searches @INC for matching files. Attempts to handle
hooks, but handles most cases wrong.
Module::Mapper
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Module-Reader-0.003002/lib/Module/Reader.pm new/Module-Reader-0.003003/lib/Module/Reader.pm
--- old/Module-Reader-0.003002/lib/Module/Reader.pm 2016-12-14 09:12:53.000000000 +0100
+++ new/Module-Reader-0.003003/lib/Module/Reader.pm 2017-06-21 18:21:25.000000000 +0200
@@ -3,30 +3,34 @@
use strict;
use warnings;
-our $VERSION = '0.003002';
+our $VERSION = '0.003003';
$VERSION = eval $VERSION;
use Exporter (); BEGIN { *import = \&Exporter::import }
our @EXPORT_OK = qw(module_content module_handle);
our %EXPORT_TAGS = (all => [@EXPORT_OK]);
-use File::Spec;
+use File::Spec ();
use Scalar::Util qw(reftype refaddr openhandle);
-use Carp;
+use Carp qw(croak);
use Config ();
use Errno qw(EACCES);
-use constant _PMC_ENABLED => !(
- exists &Config::non_bincompat_options ? grep { $_ eq 'PERL_DISABLE_PMC' } Config::non_bincompat_options()
- : $Config::Config{ccflags} =~ /(?:^|\s)-DPERL_DISABLE_PMC\b/
+use constant _OPEN_LAYERS => "$]" >= 5.008_000 ? ':' : '';
+use constant _ABORT_ON_EACCES => "$]" >= 5.017_001;
+use constant _ALLOW_PREFIX => "$]" >= 5.008009;
+use constant _VMS => $^O eq 'VMS' && !!require VMS::Filespec;
+use constant _WIN32 => $^O eq 'MSWin32';
+use constant _PMC_ENABLED => !(
+ exists &Config::non_bincompat_options
+ ? grep { $_ eq 'PERL_DISABLE_PMC' } Config::non_bincompat_options()
+ : $Config::Config{ccflags} =~ /(?:^|\s)-DPERL_DISABLE_PMC\b/
);
-use constant _VMS => $^O eq 'VMS' && !!require VMS::Filespec;
-use constant _WIN32 => $^O eq 'MSWin32';
use constant _FAKE_FILE_FORMAT => do {
- (my $uvx = $Config::Config{uvxformat}||'') =~ tr/"\0//d;
+ my $uvx = $Config::Config{uvxformat} || '';
+ $uvx =~ tr/"\0//d;
$uvx ||= 'lx';
"/loader/0x%$uvx/%s"
};
-use constant _OPEN_LAYERS => "$]" >= 5.008 ? ':' : '';
sub _mod_to_file {
my $module = shift;
@@ -70,6 +74,10 @@
if !exists $options{pmc};
$options{open} = 1
if !exists $options{open};
+ $options{abort_on_eacces} = _ABORT_ON_EACCES
+ if !exists $options{abort_on_eacces};
+ $options{check_hooks_for_nonsearchable} = 1
+ if !exists $options{check_hooks_for_nonsearchable};
bless \%options, $class;
}
@@ -104,13 +112,6 @@
sub _find {
my ($self, $file, $all) = @_;
- if (!_searchable($file)) {
- my $open = $self->_open_file($file);
- return $open
- if $open;
- croak "Can't locate $file";
- }
-
my @found;
eval {
if (my $found = $self->{found}) {
@@ -128,9 +129,30 @@
die $@
if $@;
}
+
+ my $searchable = _searchable($file);
+ if (!$searchable) {
+ my $open = $self->_open_file($file);
+ if ($all) {
+ push @found, $open;
+ }
+ elsif ($open) {
+ return $open;
+ }
+ else {
+ croak "Can't locate $file";
+ }
+ }
+
my $search = $self->{inc};
for my $inc (@$search) {
my $open;
+ if (!$searchable) {
+ last
+ if !$self->{check_hooks_for_nonsearchable};
+ next
+ if !length ref $inc;
+ }
eval {
if (!length ref $inc) {
my $full = _VMS ? VMS::Filespec::unixpath($inc) : $inc;
@@ -165,21 +187,23 @@
$full,
) {
my $pmc = $full ne $try;
- next
- if -e $try ? (-d _ || -b _) : $! != EACCES;
-
- if (!$self->{open} ? -e _ : open my $fh, '<'._OPEN_LAYERS, $try) {
- return Module::Reader::File->new(
- filename => $file,
- ($fh ? (raw_filehandle => $fh) : ()),
- found_file => $full,
- disk_file => $try,
- is_pmc => $pmc,
- (defined $inc ? (inc_entry => $inc) : ()),
- );
+ if (-e $try) {
+ next
+ if -d _ || -b _;
+ if (open my $fh, '<'._OPEN_LAYERS, $try) {
+ return Module::Reader::File->new(
+ filename => $file,
+ ($self->{open} ? (raw_filehandle => $fh) : ()),
+ found_file => $full,
+ disk_file => $try,
+ is_pmc => $pmc,
+ (defined $inc ? (inc_entry => $inc) : ()),
+ );
+ }
}
+
croak "Can't locate $file: $full: $!"
- unless $pmc;
+ if $self->{abort_on_eacces} && $! == EACCES && !$pmc;
}
return;
}
@@ -205,10 +229,15 @@
my $fake_file = sprintf _FAKE_FILE_FORMAT, refaddr($inc), $file;
my $fh;
+ my $prefix;
my $cb;
my $cb_options;
- if (reftype $cb[0] eq 'GLOB' && openhandle $cb[0]) {
+ if (_ALLOW_PREFIX && reftype $cb[0] eq 'SCALAR') {
+ $prefix = shift @cb;
+ }
+
+ if ((reftype $cb[0]||'') eq 'GLOB' && openhandle $cb[0]) {
$fh = shift @cb;
}
@@ -217,13 +246,14 @@
# only one or zero callback options will be passed
$cb_options = @cb > 1 ? [ $cb[1] ] : undef;
}
- elsif (!$fh) {
+ elsif (!defined $fh && !defined $prefix) {
return;
}
return Module::Reader::File->new(
filename => $file,
found_file => $fake_file,
inc_entry => $inc,
+ (defined $prefix ? (prefix => $prefix) : ()),
(defined $fh ? (raw_filehandle => $fh) : ()),
(defined $cb ? (read_callback => $cb) : ()),
(defined $cb_options ? (read_callback_options => $cb_options) : ()),
@@ -232,12 +262,12 @@
sub inc { $_[0]->{inc} }
sub found { $_[0]->{found} }
-sub pmc { $_[0]->{pmc} }
+sub pmc { $_[0]->{pmc} }
sub open { $_[0]->{open} }
{
package Module::Reader::File;
- use constant _OPEN_STRING => "$]" >= 5.008 || (require IO::String, 0);
+ use constant _OPEN_STRING => "$]" >= 5.008 || !require IO::String;
use Carp 'croak';
sub new {
@@ -264,6 +294,7 @@
$_[0]->{raw_filehandle} ||= !$_[0]->{disk_file} ? undef : do {
open my $fh, '<'.Module::Reader::_OPEN_LAYERS, $_[0]->{disk_file}
or croak "Can't locate $_[0]->{disk_file}";
+ $fh;
};
}
@@ -273,20 +304,22 @@
if exists $self->{content};
my $fh = $self->raw_filehandle;
my $cb = $self->read_callback;
+ my $content = defined $self->{prefix} ? ${$self->{prefix}} : '';
if ($fh && !$cb) {
local $/;
- return scalar <$fh>;
+ $content .= <$fh>;
}
- my @params = @{$self->read_callback_options||[]};
- my $content = '';
- while (1) {
- local $_ = $fh ? <$fh> : '';
- $_ = ''
- if !defined;
- # perlfunc/require says that the first parameter will be a reference the
- # sub itself. this is wrong. 0 will be passed.
- last if !$cb->(0, @params);
- $content .= $_;
+ if ($cb) {
+ my @params = @{$self->read_callback_options||[]};
+ while (1) {
+ local $_ = $fh ? <$fh> : '';
+ $_ = ''
+ if !defined;
+ # perlfunc/require says that the first parameter will be a reference the
+ # sub itself. this is wrong. 0 will be passed.
+ last if !$cb->(0, @params);
+ $content .= $_;
+ }
}
return $self->{content} = $content;
}
@@ -356,7 +389,7 @@
Returns the content of a given module.
-=head1 CLASS ATTRIBUTES
+=head1 ATTRIBUTES
=over 4
@@ -384,6 +417,19 @@
A boolean controlling if the files found will be opened immediately when found.
Defaults to true.
+=item abort_on_eacces
+
+A boolean controlling if an error should be thrown or if the path should be
+skipped when encountering C<EACCES> (access denied) errors. Defaults to true
+on perl 5.18 and above, matching the behavior of L