Loading ...
Sorry, an error occurred while loading the content.

Ignore 'flock' ??

Expand Messages
  • Gordon Stewart
    ... Hi guys - ive got the latest activestate perl, & just wondering.. The above is a (partial) email from the person that maintains the server i use at home
    Message 1 of 2 , Sep 27 6:59 PM
    • 0 Attachment
      >>> Michael Lamont <lamonml@...> 09/28/01 06:54 >>>
      >> Savant doesnt implement / use the "Flock" command for
      >> Perl scripts - While other servers do use that - or it
      >> is required - So files wont be deleted accidentally.

      >Unfortunately, this isn't a Savant implementation issue so there isn't
      >much I can do about it. The Perl interpreter itself handles these flock
      >requests - Savant just calls the interpreter and hands back either the
      >output from the script or an error message.

      Hi guys - ive got the latest 'activestate' perl, & just wondering..

      The above is a (partial) email from the person that maintains the server i use at home (testing)..

      it produces errors when i run a script with "flock" in my lines (I need to comment them out)..

      But when uploading to my main external site, Flock is necessary.

      im on a windows 98 system at home ..

      Is there a command - or something to tell (my system) to 'ignore' any flock commands - & move on to the rest of the script..

      But when i upload to another server - The flock commands are still there - & thus protecting my files.

      G.
    • Jenda Krynicky
      ... There are basicaly two ways: 1) BEGIN { if (some test to know where we are running) { # if we are on the test site eval sub Flock {1} ; # fake flock }
      Message 2 of 2 , Oct 1, 2001
      • 0 Attachment
        > it produces errors when i run a script with "flock" in my lines (I
        > need to comment them out)..
        >
        > But when uploading to my main external site, Flock is necessary.
        >
        > im on a windows 98 system at home ..
        >
        > Is there a command - or something to tell (my system) to 'ignore' any
        > flock commands - & move on to the rest of the script..
        >
        > But when i upload to another server - The flock commands are still
        > there - & thus protecting my files.
        >
        > G.

        There are basicaly two ways:

        1)

        BEGIN {
        if (some test to know where we are running) {
        # if we are on the test site
        eval "sub Flock {1}"; # fake flock
        } else {
        eval "sub Flock {goto &flock}"; # call flock
        }

        and then use Flock() instead of flock() in your code.


        2) Use some preprocessor like
        http://Jenda.Krynicky.cz/perl/mversion.pl.txt

        Then in your code mark the lines woth flock with #1# :

        flock ... #1#

        Then when you run
        mversion.pl 0 myscript.pl test\myscript.pl
        you get a version with
        #1# flock ...
        in .\test\myscript.pl.
        If you then make any changes in that script just run
        mversion.pl 1 myscript.pl ..\myscript.pl
        and you are back with the version with flock()s working.

        Jenda






        =========== Jenda@... == http://Jenda.Krynicky.cz ==========
        There is a reason for living. There must be. I've seen it somewhere.
        It's just that in the mess on my table ... and in my brain.
        I can't find it.
        --- me
      Your message has been successfully submitted and would be delivered to recipients shortly.