Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: win32-files in use by other processes ?

by BrowserUk (Patriarch)
on Sep 02, 2003 at 07:55 UTC ( [id://288261]=note: print w/replies, xml ) Need Help??


in reply to win32-files in use by other processes ?

If the file has been opened by a non-perl process using the native OpenFile or CreateFile APIs, then the easiest (only?) way is to attempt to open the file using the native API OpenFile() with a uStyle parameter of OF_SHARE_EXCLUSIVE. If the file is already open, you will get an error.

If the file has been opened using Perl, then you will always be able to open it as perl use OF_SHARED_DENY_NONE which is fits with the unix standard. See flock for how Perl and unix prevent multiple accesses to files.

You can gain access to the native APIs via Win32::API (and Win32::API::Prototype) or via tyes Win32API::File


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.

Replies are listed 'Best First'.
Re: Re: win32-files in use by other processes ?
by tos (Deacon) on Sep 02, 2003 at 10:26 UTC
    thanks a lot for your comprehensive answer. Beyond that i'am glad to see that you aren't resentful regarding my person. Thanks for that too.

    greetings, tos

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://288261]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-20 05:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found