Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

How to call specific method of a module in our program?

by Sachin (Acolyte)
on Nov 20, 2009 at 06:32 UTC ( #808347=perlquestion: print w/ replies, xml ) Need Help??
Sachin has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I would like to use only Dumper function of Data::Dumper module in my program. So when i use Data::Dumper module then only Dumper function load in memory not all other method of that module. Can anybody tell me is it Possible? if yes then How?

Comment on How to call specific method of a module in our program?
Re: How to call specific method of a module in our program?
by Corion (Pope) on Nov 20, 2009 at 08:29 UTC

    If by "load in memory" you mean "avoid compiling all code in the module", there is no way to make that possible unless the module itself supports it.

    If by "load in memory", you mean "import functions exported by the module", Data::Dumper follows the traditional way of using Exporter to export its subroutines, so you can specify what you want:

    use Data::Dumper qw(Dumper);
      Thanks a Lot Corion!! It's working.
        Are you sure you are not imagining things? Data::Dumper's only export is the sub Dumper, so there shouldn't be any difference between specifying Dumper and not doing it. See the source of Data::Dumper:

        BEGIN { @ISA = qw(Exporter); @EXPORT = qw(Dumper); @EXPORT_OK = qw(DumperX);

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://808347]
Approved by AnomalousMonk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-09-22 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (184 votes), past polls