On Mon, Apr 23, 2012 at 10:00 AM, Doug Hunt <[email protected]> wrote:

> Hi Daniel:  I've always thought it normal to need to 'use PDL' and then
> 'use PDL::NetCDF' in any script that needs PDL::NetCDF support.
>

Yeah, this is how I think, but if you require it of your users you should
mention it in the synopsis with something like this:

use PDL;  # required before use PDL::NetCDF!
use PDL::NetCDF;
...

Or, just put "use PDL::Lite" at the top of your module to avoid such
hassles.


> PDL group:  Is it normal to do all required 'uses' in the module, or
> should the script calling the module be expected to do it?
>

Defensive programming is always best. Your users may simply use your module
to obtain a piddle, then pass the object to other libraries that expect
piddles, so they don't need to say "use PDL" in their own namespace.


> I don't see that it would hurt to 'use PDL' in PDL/NetCDF.pm.
>

To keep things light, I would add "use PDL::Lite". Otherwise you're going
to have Perl unnecessarily pull many symbols into PDL::NetCDF's package
space, which makes the load time longer than it ought to be.


> --Doug
>
> [email protected]
> Software Engineer
> UCAR - COSMIC, Tel. (303) 497-2611
>
> On Fri, 20 Apr 2012, Daniel B?hmer wrote:
>
>  Hello,
>>
>> I am working in a team of two developing a web platform [1] for exchange
>> of
>> scientific data files. One format we are going to support is NetCDF and
>> we use
>> your CPAN module PDL::NetCDF for accessing the data in incoming files.
>>
>> When writing our code around your module we had some problems with calls
>> to
>> undefined subs. After some debugging we found out that it's strictly
>> necessary
>> to include "use PDL" additionally to "use PDL::NetCDF".
>>
>> In our understanding of Perl's module system your package could be
>> including
>> "PDL" at its own because we're not really depending on PDL itself (but
>> PDL::NetCDF does), just using an arbitrary package which happens to have
>> the
>> beginning of the module path in common with "PDL".
>>
>> We solved our problem by just including "use PDL". But to save other
>> people
>> from being trapped by the same issue we kindly ask you to add a simple
>> "use
>> PDL" to your module as it actually depends on PDL.
>>
>> After all we want to thank you for your efforts in developing PDL::NetCDF
>> (and
>> other code) and providing them to the public. That saved us a lot of work.
>>
>>
>> With kind regards
>> Daniel B?hmer
>>
>> [1] http://halo-db.tropos.de/
>>
>> --
>> Diese E-Mail ist mit GnuPG digital signiert. Bitte ignorieren Sie die
>> Datei "signature.asc".
>> This e-mail was digitally signed by GnuPG. Please ignore the file
>> "signature.asc".
>>
>> Dipl.-Inf. (BA) Daniel B?hmer    Leibniz Institute for
>> Mail:   [email protected]        Tropospheric Research
>> Phone:  +49 341 235-2942         Permoserstr. 15
>>                                04318 Leipzig
>> Web:    http://www.tropos.de/    GERMANY
>>
>>
>>
> ______________________________**_________________
> Perldl mailing list
> [email protected]
> http://mailman.jach.hawaii.**edu/mailman/listinfo/perldl<http://mailman.jach.hawaii.edu/mailman/listinfo/perldl>
>



-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to