Adam Turoff on Sat, 24 Jun 2000 22:58:42 -0400 (EDT)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: require instead of use


On Fri, Jun 23, 2000 at 04:26:12PM -0400, darxus@chaosreigns.com wrote:
> On Fri, 23 Jun 2000 darxus@chaosreigns.com wrote:
> 
> > But when I load it with require(), I don't get the new() subroutine, which
> > I need.  I tried doing "import Net::FTP 'new'", but that.. didn't help.
> 
> Please forgive me... 
> 
> require Net::FTP;
> import Net::FTP;

This is what 'use Net::FTP;' does.  :-)

Sounds like what you want is an eval block to execute iff you want to
load Net::FTP:
	if ($load_ftp) {
		eval {use Net::FTP;}
		## blah blah blah 
	}

I'm pretty sure that putting the use clause inside the if scope isn't
sufficient to prevent the module to be loaded at compile time; using
eval "" or eval {} should do that.

Z.

**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**