use Module LIST; is equivalent to

BEGIN { require Module; import Module LIST; }

which means that it happens at compile time.

perldoc -f use

Luke

> -----Original Message-----
> From: Jeff Westman [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, March 12, 2003 12:31 PM
> To: beginners
> Subject: RE: Where to use 'use'
> 
> 
> I see your point, and agree with you.
> 
> My feeling was the same, to put it at the top.  When I ran 
> your script, it
> didn't make any difference when calling the other routine (I 
> didn't expect
> that to work).
> 
> Thanks,
> 
> Jeff
> 
> 
> --- "NYIMI Jose (BMB)" <[EMAIL PROTECTED]> wrote:
> > There is no added value trying to make a module
> > only available for one subroutine,
> > I'd 'use' them (modules) all at the top of the script.
> > (for readability and maintainance reasons).
> > 
> > Try this and note how Data::Dumper module is available from suby,
> > Even though it was 'used' inside subx.
> > 
> > #!/usr/bin/perl -w
> > use strict;
> > 
> > &suby();
> > 
> > sub subx{
> >     use Data::Dumper;
> > }
> > 
> > sub suby{
> >     print Data::Dumper->Dump([EMAIL PROTECTED]);    
> > }
> > _END__
> > 
> > José.
> > 
> > > -----Original Message-----
> > > From: Jeff Westman [mailto:[EMAIL PROTECTED] 
> > > Sent: Wednesday, March 12, 2003 6:12 PM
> > > To: beginners
> > > Subject: Where to use 'use'
> > > 
> > > 
> > > Hello All,
> > > 
> > > I have a trivial question.  I have a perl script, with 
> > > several sub-routines. 
> > > In one of those routines, I currently have listed 'use 
> > > Date::Calc'.  So that package is therefore only available 
> > > (and needed) in that one sub-routine.
> > > 
> > > My question is, should all 'use' statements be placed at the 
> > > top of the script, or only in routines that need them?
> > > 
> > > 
> > > -Jeff
> > > 
> > > 
> > > 
> > > 
> > > __________________________________________________
> > > Do you Yahoo!?
> > > Yahoo! Web Hosting - establish your business online 
> > http://webhosting.yahoo.com
> > 
> > -- 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> > 
> > **** DISCLAIMER ****
> > 
> > "This e-mail and any attachment thereto may contain 
> information which is
> > confidential and/or protected by intellectual property 
> rights and are
> > intended for the sole use of the recipient(s) named above. 
> > Any use of the information contained herein (including, but 
> not limited to,
> > total or partial reproduction, communication or 
> distribution in any form)
> > by other persons than the designated recipient(s) is prohibited. 
> > If you have received this e-mail in error, please notify 
> the sender either
> > by telephone or by e-mail and delete the material from any 
> computer".
> > 
> > Thank you for your cooperation.
> > 
> > For further information about Proximus mobile phone 
> services please see our
> > website at http://www.proximus.be or refer to any Proximus agent.
> > 
> > 
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - establish your business online
> http://webhosting.yahoo.com
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

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

Reply via email to