in reply to Has the "require" functionality changed in Perl 5.8.1?

I'm not sure what the specific problem is in this case, but I would bet that this code isn't doing what you intended.

The lock() function is for use in threaded applications. It does not lock files.

The discussion that was linked to describes a bunch of CGI scripts, which typically aren't multi-threaded, so I would assume that what's intended is a file lock, to prevent inter-process conflicts, rather than a variable lock, to prevent inter-thread conflicts within a single process.

See the flock function instead.

Update: I've downloaded and looked around the code from the webapp site linked to above, and found that it does define a lock() function that in turns calls the built-in flock().

Perhaps the problem is that for some reason the cgi-lib/forum.pl file is being loaded before cgi-lib/subs.pl?

As a longer-term solution, you might find that renaming the lock function in subs.pl to lock_file, and similarly changing all of the calls to match, might be sufficient to fix it.

Replies are listed 'Best First'.
Re: Re: Has the "require" functionality changed in Perl 5.8.1?
by Alatar (Beadle) on Dec 01, 2003 at 16:14 UTC
    Thanks, this looks like a possible solution. I'll test it out and let you know if it works!

    Thanks again,
    Alatar

      Well Done SimonM, you were right on the money. We're working on a patch now. Thanks for all the help!

      Alatar