Great, thanks for the detailed response. I have read the docs several times, but each time it becomes a little less clear...
I like the extra braces because they look pretty in syntax-highlighting editors. I am always using strict. Not sure what the second call was or what looked weird about it, but it works. By fully qualified I meant writing Net::SMTP::method() (which I generally do to make it easier to read (for me at least), copy and paste code), as opposed to just method(). As far as the compiler warnings, if I have module a which uses b and module b that uses a and I perl -c one of the modules I get warnings about variable redefinition. Thanks again, -John On Thu, 1 Jul 2004 09:42:59 -0600, Wiggins d Anconia wrote > > 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>