in reply to Re: pmpath
in thread pmpath

require loads a module at runtime, but it does not call the module's import function. From `perldoc -f require':
...demands that a library file be included if it hasn't already been included. The file is included via the do-FILE mechanism, which is essentially just a variety of `eval'.
And from `perldoc -f use':
Imports some semantics into the current package from the named module, generally by aliasing certain subroutine or variable names into your package. It is exactly equivalent to BEGIN { require Module; import Module LIST; }

--sacked

Replies are listed 'Best First'.
Re: (sacked) Re: Re: pmpath
by particle (Vicar) on Jan 24, 2002 at 08:52 UTC
    right you are!

    my mistake. now where on earth did i read otherwise...?

    sorry for the disinformation, jbisbee!

    ~Particle

      No problem. I posted it to get feelback and its been very informative (regardless of right or wrong). I just find 'pmpath' helpful to quickly compare module versions on different servers and environment. For example our personal dev boxes here at work are all linux, while I main group dev box is Solaris. It's cool do run a quick check to compare their locations and version on multiple servers running differnent operating systems.

      -biz

Re: (sacked) Re: Re: pmpath
by rjray (Chaplain) on Feb 09, 2002 at 02:15 UTC

    True, it doesn't call the import() method as use would, but it does run any code in the module up to the "1;" (or similar) return-code. In other words, if the module has any initialization code (including BEGIN blocks, and in 5.6 onward CHECK and INIT blocks), that code will be executed by the script you are demonstrating.

    You really are better-served by combining File::Find with the pre-defined @INC array as the list of directories to search over.

    --rjray