in reply to modules using things from other modules

Have no fear: perl keeps a hash of modules already loaded in %INC and skips use-ing a module that is already loaded.

Try:

perl -MData::Dumper -e "print Dumper(\%INC);"

which gives:

$VAR1 = { 'warnings/register.pm' => 'C:/data/Perl/lib/warnings/registe +r.pm', 'bytes.pm' => 'C:/data/Perl/lib/bytes.pm', 'XSLoader.pm' => 'C:/data/Perl/lib/XSLoader.pm', 'Carp.pm' => 'C:/data/Perl/lib/Carp.pm', 'Exporter.pm' => 'C:/data/Perl/lib/Exporter.pm', 'warnings.pm' => 'C:/data/Perl/lib/warnings.pm', 'C:/data/Perl/site/lib/sitecustomize.pl' => 'C:/data/Perl/si +te/lib/sitecustomize.pl', 'overload.pm' => 'C:/data/Perl/lib/overload.pm', 'Data/Dumper.pm' => 'C:/data/Perl/lib/Data/Dumper.pm' };

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^2: modules using things from other modules
by Anonymous Monk on Sep 01, 2008 at 19:38 UTC
    wait a sec, can you show me how I could craft a module that would would be able to use an existing CGi.pm (or make new if not exist) to access the raw_cookie() method mentioned in teh docs?

      Sure. Here you go-

      package MyPackage; use CGI (); sub get_raw_cookie { return CGI::raw_cookie(); }

      You do not need to create a CGI object to use its functions. raw_cookie() is not likely to be what you want either unless you're passing it to another cookie parser. The cookie handling that comes with CGI is probably better.

        that method and module is just one example of what I need use. So what you guys saying is that even if i use a module in my module, if it is alredy loaded it done not get loaded again? thats great news