Can I append @INC before use module

2002-09-30 Thread Ramprasad A Padmanabhan

Hello All,

I have a perl script which has

(assuming BAR.pm is in /tmp/foo/)


BEGIN {
 push @::INC , /tmp/foo;
 # use  BAR;  # Does not work
 require BAR;  # Works fine
}

Can I get to use 'use' instead of require any how

Thanx
Ram


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




RE: Can I append @INC before use module

2002-09-30 Thread NYIMI Jose (BMB)

set PERL5LIB environment varible to 
/tmp/foo then you will be able to use 'use BAR;'

Or give a look at

'perldoc lib'

José.


 -Original Message-
 From: Ramprasad A Padmanabhan [mailto:[EMAIL PROTECTED]] 
 Sent: Monday, September 30, 2002 2:53 PM
 To: [EMAIL PROTECTED]
 Subject: Can I append @INC before use module
 
 
 Hello All,
 
 I have a perl script which has
 
 (assuming BAR.pm is in /tmp/foo/)
 
 
 BEGIN {
  push @::INC , /tmp/foo;
  # use  BAR;  # Does not work
  require BAR;  # Works fine
 }
 
 Can I get to use 'use' instead of require any how
 
 Thanx
 Ram
 
 
 -- 
 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]




Re: Can I append @INC before use module

2002-09-30 Thread david

Ramprasad A Padmanabhan wrote:

 Hello All,
 
 I have a perl script which has
 
 (assuming BAR.pm is in /tmp/foo/)
 
 
 BEGIN {
  push @::INC , /tmp/foo;
  # use  BAR;  # Does not work
  require BAR;  # Works fine
 }
 
 Can I get to use 'use' instead of require any how
 
 Thanx
 Ram

what sort of error message do you get? assume i have: /home/david/perl/A.pm, 
the following works for me:

BEGIN{
push @INC, '/home/david/perl';
use A;  
}

david

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




Re: Can I append @INC before use module

2002-09-30 Thread Paul Johnson

On Mon, Sep 30, 2002 at 11:25:32AM -0700, david wrote:

 what sort of error message do you get? assume i have: /home/david/perl/A.pm, 
 the following works for me:
 
 BEGIN{
 push @INC, '/home/david/perl';
 use A;  
 }

Are you sure?

Remember that . is in @INC by default.

In this case you want the use statement after the BEGIN block.

But really you want use lib.  It goes back to before anything that
anyone should reasonably be using now.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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




Re: Can I append @INC before use module

2002-09-30 Thread david

Paul Johnson wrote:

 
 Remember that . is in @INC by default.

sorry, i use this only as an example

 
 In this case you want the use statement after the BEGIN block.
 
 But really you want use lib.  It goes back to before anything that
 anyone should reasonably be using now.
 

agree. there shouldn't be any real reason just to wrap the push @INC line 
inside a BEGIN{} when 'use lib' require less typing and accomplish pretty 
much the same thing(better)

david

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