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

Re: [PBML] Ignore 'flock' ??

Expand Messages
  • 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 1 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.