http://qs321.pair.com?node_id=123051


in reply to Good programming practice

While the our declartion is only supported in recent perls, you can use use vars to perform a similar task. (Note that use vars and our is not indentical. Use vars is package-scoped (you do it and it works for any use of that package); our is lexically scoped like my.)

Replies are listed 'Best First'.
Re: Re: Good programming practice
by Purdy (Hermit) on Nov 03, 2001 at 21:01 UTC
    Sweet - that answers one part of my question. Didn't know about use vars.

    I'm still interested in knowing if this is the best design for such a system.

    Jason

    wog - I ran out of votes, but there's tomorrow!

      i do have a problem with require - it's a bit old, and more importantly, it's not portable. If you design a CPAN style module, you can install it on any system and access it from any program. Then you can 'use' the much better:use jdb; instead of require.

      A great reference for building CPAN style modules can be found here: perlnewmod (and no, you don't have to submit your module to CPAN for it to be a CPAN style module).

      But first, read perlmod. :)

      jeffa

        If you install the module in the @INC path you can require jbd; the same as use, but without the side effect of being done at compile time. If the module depends on runtime data (like $database from the example) swiching to use may cause trouble.