Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 having an uproarious good time at the Monastery: (10)
As of 2014-07-28 19:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (207 votes), past polls