Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Difference between use Module::Name and use Module::Name qw /method1 method2/

by LanX (Bishop)
on Jan 29, 2013 at 10:10 UTC ( #1015841=note: print w/replies, xml ) Need Help??


in reply to Difference between use Module::Name and use Module::Name qw /method1 method2/

From what I can see from the source of Algorithm::LUHN nothing is exported by default:
@EXPORT = qw//; @EXPORT_OK = qw/check_digit is_valid valid_chars/;

so if you wanna import is_valid you need to tell explicitly.

see also How to Export

EDIT

> Is it somehow better to use the second statement if I use only "is_valid" method in my code? Maybe, memory issues or something?

No! No significant memory problems, importing is a kind of aliasing between namespaces.

But you have to care about potential namespace polution, see Selecting What To Export.

Please note that you don't necessarily need to import is_valid, otherwise can also address Algorithm::LUHN::is_valid directly.

Cheers Rolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015841]
help
Chatterbox?
[1nickt]: ... choice, the threaded-perl user *probably* wants to use threads, therefore only require threads and leave MCE out, allowing the user to manually install if desired?
[choroba]: just require any of MCE and threads. Not sure if that's possible in the cpanfile, but should be possible early in the Makefile
[1nickt]: The app expects threads as default anyway, right?
[choroba]: that's true
[1nickt]: expects threads *to be* the default
[1nickt]: I think cpanfile can handle the logic. testing now.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (16)
As of 2017-10-18 13:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (244 votes). Check out past polls.

    Notices?