in reply to Re: function encapsulation
in thread function encapsulation

more points: So, if you make any changes to @INC, it won't effect any of the 'use' statements, but it will the 'require's.
Also, if you 'perl -c' the script, the '.pm's that were 'use'd in will be checked for sytax, the ones that were 'require'd in won't be.

/\/\averick

Replies are listed 'Best First'.
RE: RE: Re: function encapsulation
by davorg (Chancellor) on Jul 13, 2000 at 19:43 UTC

    That's not to say that you can't make changes to @INC which will affect 'use' statements. Two ways that spring to mind are:

    1. Put the code that changes @INC in a BEGIN block.
    2. Use use lib;
    --
    <http://www.dave.org.uk>

    European Perl Conference - Sept 22/24 2000, ICA, London
    <http://www.yapc.org/Europe/>
      True. You can also put the 'require's inside a BEGIN block and get their syntax checked by perl -c. I'm sure there's more examples we can think of...

      /\/\averick

RE: RE: Re: function encapsulation
by Buckaroo Buddha (Scribe) on Jul 20, 2000 at 17:41 UTC

    then this raises an interesting question (for me at least)

    i should probably test this myself (and probably will but love
    discussion ... and have a deadline breathing down my neck ;)

    if i make a function, and encapsulate it in a file, then
    make calls to that function from a script which had been
    compiled using perl2exe...
    would the whole program still work?
    could i change the required and encapsulated function as needed?
    is this the basic concept behind a DLL file in windows?
        or are there more to them?

    i've not got a lot comp-sci so i'm trying to pick up advanced topics
    in programming on the fly, while simultaniously learning the basics
    i'd love some help me in gaining a deeper understanding of the whole system
    we're working in