Closed Thread Icon

Preserved Topic: ActivePerl problems (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=20896" title="Pages that link to Preserved Topic: ActivePerl problems (Page 1 of 1)" rel="nofollow" >Preserved Topic: ActivePerl problems <span class="small">(Page 1 of 1)</span>\

 
Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 05-07-2001 23:09

ActivePerl is a Perl interpreter/compiler/whateverer for Windows, made by ActiveState (should be at www.activestate.com or something like that, i forget).

I just recently installed it, and whenever I use the flock() function to lock a file, it says "flock() unimplemented on this platform at [filename] line [#]."

Anyone have any advice, or insight into what exactly this means? I assume ActivePerl supports the function, since they have it in their own documentaion of the language. They also say it should work on any Windows OS NT and later. I can't find any other way to lock files, either. Help?

- Slime

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-07-2001 23:15

AFAIK you don't need to use flock() on Windows platform...

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 05-08-2001 00:58

Oh, that would be good. Can someone confirm that? And what's AFAIK mean?

btw... i also just noticed in the documention provided that "some functions are not supported by windows 95, including flock()." I'm on windows 98, which probably just has the same problem. So, unless mr. max is correct, could someone help me find an alternate way to do it? Or, if he is correct, it won't be necessary.

- Slime

linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 05-08-2001 03:42

As Far As I Know, Mr. Max is correct (he usually is).

flock() doesn't have a meaning in the Windoze 9x filesystem. It's a UNIX system call. Windoze doesn't multitask worth beans, so it's not usually needed. In a multi-user OS, you'd flock() something like a file descriptor or FIFO you were writing to, in order to stop other users from stomping your I/O. In Windoze 9x, there aren't other users (at least owning concurrent processes).

That help??

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-08-2001 07:01

Slime, you doubt in me?

BTW If you need to determinate if the OS under which your script is running is Windows (so that you can disable flock() calls), you can use "$^O" variable, which equals to "MSWin32" in that case.

kevincar
Paranoid (IV) Inmate

From: north hills, ca usa
Insane since: Apr 2001

posted posted 05-08-2001 19:41

1. AFAIK, it means "As far as i know"

2. hmmnm... flock() and ActiveState - seems to work fine
for me - is your #! correct? did you move your perl.exe
from the original installation directory? did you remove
or install some packages? Does perldoc say anything?

I use flock (incorrectly, apparently) for my messages frame-bar
on my site - I tested it on W2k and I got no err-msgs from the
perl script - does this err occurr only when you use -w?
does it run OK without the -w ?

Good luck - sorry if these questions seem pedantic...



Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 05-08-2001 20:59

Well, the same script runs fine when I comment out the flock() function, so I don't think most of those are the problems. I don't know what the -w switch does, but I tried it and it didn't work any differently.

I guess, if windows doesn't care about file locking, then I don't have to worry about this. Just one last question... In Windows, even though you've already said it won't access a file from two threads at one time, i'm asking anyway: would it be possible for my perl script to modify an HTML file at the same time someone's downloading it? If not, then I guess there really are no problems after all. And that'd be nice.

- Slime

kevincar
Paranoid (IV) Inmate

From: north hills, ca usa
Insane since: Apr 2001

posted posted 05-08-2001 22:24

The "-w" prints compilation and run time warnings -
check your server log -- Trust me, -w can save your
soul...

BTW-
on some Unix/Linux/BSD machines it's a "-W" switch



linear
Paranoid (IV) Inmate

From: other places
Insane since: Mar 2001

posted posted 05-08-2001 22:24

the -w is a very good habit. It makes Perl warn you when you're doing things that range from lazy to dumb. It enhances error reporting quite a lot. Use it. Live by it.

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-09-2001 14:33

Another good thing is to always have "use strict;" defined at the top yof your perl scripts...

« BackwardsOnwards »

Show Forum Drop Down Menu