in reply to Re: Do file.pl (replacing subs?)
in thread Do file.pl (replacing subs?)

You have a point for your first two .. points. However, on your last point, the reason i stuck with do vs use was that it seemed visually clearer, so the reader would know that i'm attempting to execute code in a seperate file, as opposed to the common interpretation of use, which is that i'm attempting to import a module. However, use 'file.pl' would have the exact same effect with the benefit of error checking and so forth. Of course, a problem there is if you want to call a 'file' multiple times, i dont think multiple uses would execute the code multiple times.

You have a point about just wrapping the file in a sub, but that seems to kind of defeat the purpose =/. You're right about the maintence of a whole folder full of subs, but that mostly holds true for local. If you were trying to remotely maintain something, and you improved one sub, you could just send out a new sub-file, and say 'replace file blah in your sub folder with this new file', as opposed to 'look in blah.pl, find line 952-1060 and replace them with this block of code..'

Replies are listed 'Best First'.
Re: Re: Re: Do file.pl (replacing subs?)
by chromatic (Archbishop) on Sep 23, 2002 at 17:39 UTC

    I wouldn't trust anyone who doesn't know that use loads and imports a module to maintain code.

    I don't see a big distinction between executing code in a separate file and using a module.

    I have no problem sending the whole of an updated module, if necessary.

    Your situation doesn't seem appreciably different from what modules are intended to accomplish.

      >>I have no problem sending the whole of an updated module, if necessary

      Heh, the only real case for this i can think of is say you offer some kind of script, someone downloads it and makes a bunch of modifications. If you upgrade the script (a function in this case) you would wipe out all those mods if you sent the entire script. Of course this is a rather limited idea i suppose and it makes certain assumptions which by no means are always true. But that was basically my reasoning behind it.
Re^3: Do file.pl (replacing subs?)
by Aristotle (Chancellor) on Sep 23, 2002 at 17:21 UTC
    you could just send out a new sub-file, and say 'replace file blah in your sub folder with this new file', as opposed to 'look in blah.pl, find line 952-1060 and replace them with this block of code..'
    diff / patch or rsync anyone? :-)

    Makeshifts last the longest.