I can't seem to create an issue on the SF issue tracker, and I'm not sure
if the github issue tracker is canonical at the moment.

Using PDL::Lite in more than one package imports pdl and the other standard
functions only into the first package it is called from.

Code to reproduce is below.
The attached patch should fix it, and also adds more documentation.

The patch is a squashed (and simplified) version of a pull request sent to
the pdla-core github repo in 2015.
https://github.com/PDLPorters/pdla-core/pull/12


Shawn.

====
The code works if use PDL::Lite is replaced with with use PDL or use
PDL::LiteF, or if pdl() is set using a glob.

If a use PDL::Lite is put before the first package declaration then neither
sub call works.


package mk1 {
    use PDL::Lite;

    sub x {
        return pdl (1..10);
    }
}
package mk2 {
    use PDL::Lite;
    #*pdl = \&PDL::Core::pdl;  #  uncomment and the code works
    sub x {
        return pdl (11..20);
    }
}
print mk1::x, "\n";  #  [1 2 3 4 5 6 7 8 9 10]print mk2::x, "\n";  #
Undefined subroutine &mk2::pdl called at xx.t line 21.

Attachment: lite_loads_twice.patch
Description: Binary data

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to