B
bob
I am upgrading a server from a very old version of redhat to a new
version of debian. One of the things that needs to come along to the
new server is a web based perl program consisting of about 50 files. I
seem to have the majority of it working, but I have hit a snag.
there are a number of lines that contain syntax like this:
$filelock = do lock ("user/$userid.lck");
and a few lines later;
do unlock ($filelock)
Not being familiar with perl, from logs, documentation,and googling, I
arrived at this;
if I change the lines like so, it works;
flock("user/$userid.lck",2);
and a few lines later;
flock("user/$userid.lck",8);
So I set about writing a sed script to make all the changes, but then I
started to realized the scope of doing this over so many files, where
each file's $filelock variable often refers to a different file, and a
number of other variables like $userlock and $messagelock, most file's
variable having different values as well. its to the point where its
faster to manually decipher and change each file in the perl program
than try to write a script to do it with any relaiability.
The perl version on the old box is 5.6, so perhaps syntax for that
version simply won't work with the current 5.8.7 I have now. but there
must be an easier way to go about this other than changing each file or
writing a massive script - maybe there is a module I am not familiar
with, or some other configuration option I can use to just make the
original syntax work. At this point I am now striking out on google, I
was wondering if one of you experts would point me to some
documentation on this matter, or perhaps offer some ideas about a
direction I could take on this
version of debian. One of the things that needs to come along to the
new server is a web based perl program consisting of about 50 files. I
seem to have the majority of it working, but I have hit a snag.
there are a number of lines that contain syntax like this:
$filelock = do lock ("user/$userid.lck");
and a few lines later;
do unlock ($filelock)
Not being familiar with perl, from logs, documentation,and googling, I
arrived at this;
if I change the lines like so, it works;
flock("user/$userid.lck",2);
and a few lines later;
flock("user/$userid.lck",8);
So I set about writing a sed script to make all the changes, but then I
started to realized the scope of doing this over so many files, where
each file's $filelock variable often refers to a different file, and a
number of other variables like $userlock and $messagelock, most file's
variable having different values as well. its to the point where its
faster to manually decipher and change each file in the perl program
than try to write a script to do it with any relaiability.
The perl version on the old box is 5.6, so perhaps syntax for that
version simply won't work with the current 5.8.7 I have now. but there
must be an easier way to go about this other than changing each file or
writing a massive script - maybe there is a module I am not familiar
with, or some other configuration option I can use to just make the
original syntax work. At this point I am now striking out on google, I
was wondering if one of you experts would point me to some
documentation on this matter, or perhaps offer some ideas about a
direction I could take on this