in reply to packages and Exporter

2) why are we fully-qualifying the @ISA and @EXPORT arrays here

For one thing, it makes it easy to insert a "use strict;" line immediately after the package statement, which is often a good idea.

Also for 1), as noted elsewhere, each file serves as a separate lexical scope so the package declaration from Exporter doesn't "spill over" into the calling package. And for 3), there's no reason to avoid "use" -- either "use" or "require" would be fine in this context.

Replies are listed 'Best First'.
Re: Re: packages and Exporter
by xenchu (Friar) on Dec 05, 2003 at 13:37 UTC
    Why would you insert the use strict; after the package instead of before it? What are the advantages of this?

    Thanks,

    xenchu

    Perl has one Great Advantage and one Great Disadvantage:

    It is very easy to write a complex and powerful program in three lines of code.

    ********************************************

    The Needs of the World and my Talents run parallel to infinity.
      Why would you insert the use strict; after the package instead of before it? What are the advantages of this?

      Why not? :-)

      The issue isn't whether the strict declaration is before/after the package declaration. The issue is ensuring that the declaration of the package globals doesn't cause a error when strict is being used.

      Using an explicit package name is one method. Using use vars or our are two others.