Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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?

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://808347]
Approved by AnomalousMonk
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2018-06-18 13:47 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (109 votes). Check out past polls.