summaryrefslogtreecommitdiff
path: root/cpan/Module-Load-Conditional
diff options
context:
space:
mode:
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>2019-11-10 17:50:09 +0000
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>2019-11-10 17:50:09 +0000
commit6baaa04b4166f6d0fa7d677f8979794e322947a7 (patch)
treef0220f172ae3964e2d74e3fcb1842432cebb12b8 /cpan/Module-Load-Conditional
parent042474943023d2327f5109d711e3cd6003dae210 (diff)
downloadperl-6baaa04b4166f6d0fa7d677f8979794e322947a7.tar.gz
Update Module-Load-Conditional to CPAN version 0.70
[DELTA] 0.70 Sun Nov 10 14:28:41 GMT 2019 * Protect ourselves from Module::Metadata parsing problems [ RT#130939 ]
Diffstat (limited to 'cpan/Module-Load-Conditional')
-rw-r--r--cpan/Module-Load-Conditional/lib/Module/Load/Conditional.pm18
-rw-r--r--cpan/Module-Load-Conditional/t/01_Module_Load_Conditional.t7
-rw-r--r--cpan/Module-Load-Conditional/t/to_load/HereDoc.pm14
3 files changed, 33 insertions, 6 deletions
diff --git a/cpan/Module-Load-Conditional/lib/Module/Load/Conditional.pm b/cpan/Module-Load-Conditional/lib/Module/Load/Conditional.pm
index 89e22b5720..b0685d2ec1 100644
--- a/cpan/Module-Load-Conditional/lib/Module/Load/Conditional.pm
+++ b/cpan/Module-Load-Conditional/lib/Module/Load/Conditional.pm
@@ -22,7 +22,7 @@ BEGIN {
$FIND_VERSION $ERROR $CHECK_INC_HASH $FORCE_SAFE_INC ];
use Exporter;
@ISA = qw[Exporter];
- $VERSION = '0.68';
+ $VERSION = '0.70';
$VERBOSE = 0;
$DEPRECATED = 0;
$FIND_VERSION = 1;
@@ -259,13 +259,19 @@ sub check_install {
last DIR unless $FIND_VERSION;
### otherwise, the user wants us to find the version from files
- my $mod_info = Module::Metadata->new_from_handle( $fh, $filename );
- my $ver = $mod_info->version( $args->{module} );
- if( defined $ver ) {
- $href->{version} = $ver;
+ {
+ local $SIG{__WARN__} = sub {};
+ my $ver = eval {
+ my $mod_info = Module::Metadata->new_from_handle( $fh, $filename );
+ $mod_info->version( $args->{module} );
+ };
- last DIR;
+ if( defined $ver ) {
+ $href->{version} = $ver;
+
+ last DIR;
+ }
}
}
}
diff --git a/cpan/Module-Load-Conditional/t/01_Module_Load_Conditional.t b/cpan/Module-Load-Conditional/t/01_Module_Load_Conditional.t
index 1bfa1a10d8..2f463d5571 100644
--- a/cpan/Module-Load-Conditional/t/01_Module_Load_Conditional.t
+++ b/cpan/Module-Load-Conditional/t/01_Module_Load_Conditional.t
@@ -132,6 +132,13 @@ use_ok( 'Module::Load::Conditional' );
is( $rv->{version}, 2, " Version is correct" );
}
+### test finding a version of a module that has a VERSION error in a HereDoc
+{ my $rv = check_install( module => 'HereDoc' );
+ ok( $rv, 'Testing $VERSION in HEREDOC' );
+ ok( !$rv->{version}, " No Version found" );
+ is( $rv->{version}, undef, " Version is correct" );
+}
+
### test that no package statement means $VERSION is $main::VERSION
{
my $rv = check_install( module => 'NotMain' );
diff --git a/cpan/Module-Load-Conditional/t/to_load/HereDoc.pm b/cpan/Module-Load-Conditional/t/to_load/HereDoc.pm
new file mode 100644
index 0000000000..06332ac5bc
--- /dev/null
+++ b/cpan/Module-Load-Conditional/t/to_load/HereDoc.pm
@@ -0,0 +1,14 @@
+package HereDoc;
+$HereDoc::VERSION = 1;
+
+sub magic {
+ print <<'END';
+package Errno;
+-use vars qw($VERSION);
+-
+-$VERSION = "1.111";
++our $VERSION = "1.111";
+END
+}
+
+1;