Wiggins D'Anconia <[EMAIL PROTECTED]> wrote:
> MMKHAJAH wrote:
>> I wonder wether 'use module' compiles only once. I mean that 
>> all sebsequent calls don't involve compiling. 
>> 
> My *guess* is no because that would be silly.
> 
> My *semi-proof* is if you have use warnings on and your program compiled 
> a module over again that has already been included then it would 
> complain about redefining each of the sub routines in that module.
> 
> My *guess* is that perl internally either keeps track of the list of 
> packages already compiled in, or uses a check on the namespace in some 
> manner, though I am slow to think about whether this last bit is 
> possible right now. Back to football I guess :-)....................
> 

Actually it keeps track of filenames.  

(They're in %INC if you want to check.)

And perlfunc confirms that the file won't be 
loaded twice:

$ 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; }

          except that Module must be a bareword.
          ...

          The "BEGIN" forces the "require" and "import" to
          happen at compile time.  The "require" makes sure
          the module is loaded into memory if it hasn't been
          yet.
          ...

$ perldoc -f require
  ...
          Otherwise, demands that a library file be included
          if it hasn't already been included.
          ...

          Note that the file will not be included twice
          under the same specified name. 

-- 
Steve

perldoc -qa.j | perl -lpe '($_)=m("(.*)")'

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to