From 59ae7586f8d0d8a309351a99bcd29ac78b37e452 Mon Sep 17 00:00:00 2001 From: Ed J Date: Thu, 28 Feb 2019 16:20:51 +0000 Subject: [PATCH 1/2] make sure PDL::Lite actually works --- Basic/Lite.pm | 7 ++----- t/lite_loads_twice.t | 5 ++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Basic/Lite.pm b/Basic/Lite.pm index f2c1d1e4c..b5ea5ad73 100644 --- a/Basic/Lite.pm +++ b/Basic/Lite.pm @@ -31,11 +31,9 @@ Access to other functions is by method syntax, viz: =cut -# Load the fundamental PDL packages, no imports -# Because there are no imports, we do not need -# the usual 'eval in the user's namespace' routine. +package PDL::Lite; -use PDL::Core ''; +use PDL::Core qw(pdl piddle barf null); use PDL::Ops ''; use PDL::Primitive ''; use PDL::Ufunc ''; @@ -45,7 +43,6 @@ use PDL::Bad ''; use PDL::Version ; # Doesn't export anything - no need for '' use PDL::Lvalue; -package PDL::Lite; $VERSION = $PDL::Version::VERSION; @ISA = qw( PDL::Exporter ); diff --git a/t/lite_loads_twice.t b/t/lite_loads_twice.t index 49085ada8..b3d3ec59b 100644 --- a/t/lite_loads_twice.t +++ b/t/lite_loads_twice.t @@ -1,7 +1,7 @@ # Can PDL::Lite be loaded twice? # The first import was interfering with the second. -use Test::More tests => 10; +use Test::More tests => 11; { package mk1; @@ -26,3 +26,6 @@ foreach my $name (qw /x barf pdl piddle null/) { ok (mk2->can($name), "Sub loaded: mk2::" . $name); } +# now try calling one of those functions +eval { my $x = mk1::pdl(0, 1) }; +is $@, '', 'the imported pdl function ACTUALLY WORKS'; From 184ebe0ca2dea0aceaf9521e7d3dc5f6bddf684c Mon Sep 17 00:00:00 2001 From: Ed J Date: Thu, 28 Feb 2019 16:25:15 +0000 Subject: [PATCH 2/2] PDL::Lite strict & warnings --- Basic/Lite.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Basic/Lite.pm b/Basic/Lite.pm index b5ea5ad73..2856b653a 100644 --- a/Basic/Lite.pm +++ b/Basic/Lite.pm @@ -33,6 +33,9 @@ Access to other functions is by method syntax, viz: package PDL::Lite; +use strict; +use warnings; + use PDL::Core qw(pdl piddle barf null); use PDL::Ops ''; use PDL::Primitive ''; @@ -43,11 +46,11 @@ use PDL::Bad ''; use PDL::Version ; # Doesn't export anything - no need for '' use PDL::Lvalue; -$VERSION = $PDL::Version::VERSION; +our $VERSION = $PDL::Version::VERSION; -@ISA = qw( PDL::Exporter ); +our @ISA = qw( PDL::Exporter ); -@EXPORT = qw( piddle pdl null barf ); # Only stuff always exported! +our @EXPORT = qw( piddle pdl null barf ); # Only stuff always exported! our %EXPORT_TAGS = ( Func => [@EXPORT], );