On 9/28/07, Chas. Owens <[EMAIL PROTECTED]> wrote: > The strict pragma is lexically scoped, so you need to use it again > after the package statement. It is probably a good idea to turn on > warnings as well.
To be sure, I don't think that's an accurate description of the effects of lexical scoping. Both 'strict' and 'warnings' are lexically scoped directives. That generally means that the declaration takes effect at the end of the declaring statement, and it continues until the end of the smallest enclosing block or file. A package directive has no effect upon lexical scope of other directives. On the other hand, most ordinary modules are package scoped. You have to "use Carp" separately in each package in which its imported names are needed, for example; so it may need to appear more than once in a single file. But 'strict' and 'warnings', when not enclosed in the curly braces that make a smaller scope, take effect for the rest of the file. Using lexically scoped directives within a file (as opposed to at the top of the file) is generally needed only when requesting something extra. For example, requesting more warnings than the default ones. So, as a general style guideline, each file needs to start with a block of boilerplate, including both "use strict" and "use warnings" directives. Cheers! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/