> I have read the docs but I'm still not quite clear on the difference between > use and require and if either is even needed. >
The two key differences are that 'use' happens at compile time, rather than runtime, and that 'use' automatically calls the 'import' function of the module just loaded, if it exists. More often than not you can do 'use' instead of 'require', but realize that I meant that as a generalization and as a generalization it is inherently flawed. If you choose to use a require, please check out, perldoc -f eval I am assuming the docs you mentioned having read were, perldoc -f use perldoc -f require If not you should have a read through them. > I just moved some code from one module to another. The orignal module has use > Net::SMTP in it, but the module I moved the code to does not (it does use the > first module though). I forgot to put the use line in the second module, but > the code still works (I fully qualify it like my ${smtp} = new Net::SMTP( > ${params{'server'}} );. The extra sets of braces are not needed in the above, aka ${smtp} can be written $smtp. Are you using 'use strict'?? That second call is very weird... Does that mean I don't need the use statements > anywhere if I fully qualify? or does it work only because the second module > uses the first module that uses Net::SMTP? > It works because the second module is loading Net::SMTP. You aren't actually fully qualifying anything that I see, aka fully qualified would be, $::variable = $Net::SMTP::<variable> Or some such. > I would like to avoid use statements if possible since they can result in > compiler warnings about circular references and it seems to parse the library > even when it doesn't need to, which seems like a performance concern. > > Any light anyone could shed on all this would be greatly appreciated. > > Show us some code, you shouldn't be getting circular references from a simple 'use' statement loading a library. And the library should only be loaded once no matter how many times you 'use' it. I smell something fishy.... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>