Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Keep It Simple, Stupid
 
PerlMonks  

Re: win32-files in use by other processes ?

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 06: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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.