Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Check whether the file is in use by an other user

by fish (Novice)
on Jul 30, 2009 at 12:42 UTC ( #784588=note: print w/replies, xml ) Need Help??


in reply to Re: Check whether the file is in use by an other user
in thread Using Win32::OLE and Excel - Tips and Tricks

Thanks for your response. I tried your code and it's not bad but not exactly what I expected. Instead of showing an error-message if the file is opened the program waits until the file is getting closed. That is not bad, but kind of useless for my problem.

I am sure we are pretty near to a solution, so can somebody tell me how it works - please ;)

Best regards,
- fish
  • Comment on Re^2: Check whether the file is in use by an other user

Replies are listed 'Best First'.
Re^3: Check whether the file is in use by an other user
by wazoox (Prior) on Jul 30, 2009 at 21:09 UTC
    See the flock documentation to check the various (and numerous) available flags, there is probably one of them that'll do what you want :) BTW you really should have posted this in its own thread, because it's a problem completely unrelated to the scope of this tutorial.
Re^3: Check whether the file is in use by an other user
by fish (Novice) on Jul 31, 2009 at 05:51 UTC
    For those of you who are interessted in the topic. I solved the problem by myself.

    sysopen(FH, $file, O_WRONLY|O_EXCL) or die $!; works fine for me and it even works if the file is opened via a shared folder.

    Finally I want to apologize for my offtopic-postings. I thougt the "fileInUse"-check would be possible with a Win32::OLE-function and because of that I posted here and did not create a new thread. I hope I will do better in future.

    Best regards from sunny Germany.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://784588]
help
Chatterbox?
[erix]: aka: create extension if not exists file_fdw;
[erix]: the annoying thing is that during setup of the 'foreign table' you have to specify all the columns. But that is reasonably automatable (just reading header line, and contruct the needed CREATE FOREIGN TABLE' statement)
[erix]: it may be easier to just slurp your fils into regular tables. Has other infrastructure advantages also (indexes, constraints etc)

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2018-02-23 15:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (302 votes). Check out past polls.

    Notices?