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

handle ERROR 32 using perl script

by madtoperl (Hermit)
on Aug 05, 2010 at 15:17 UTC ( #853159=perlquestion: print w/replies, xml ) Need Help??

madtoperl has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,
I would like to know if there is any module available/is it possible to resolve the system error 32 in windows machine using perl script.
Please let me know.

Replies are listed 'Best First'.
Re: handle ERROR 32 using perl script
by roboticus (Chancellor) on Aug 05, 2010 at 15:23 UTC


    Short answer: no.

    Long answer: Generally, a perl script isn't going to be able to handle a system error for you. A system error typically occurs when you ask the operating system something to do something, and the operating system can't or won't do it.

    According to, system error 32 is a sharing violation. So Windows is telling you that the file is already in use, and the current user doesn't want to share the resource. The way to handle that would be to: (a) close the other application, (b) alter the application to allow sharing, and/or (c) update the current application to report the problem and offer to let you try something else, rather than fail.


Re: handle ERROR 32 using perl script
by kejohm (Hermit) on Aug 06, 2010 at 08:57 UTC

    If what you're looking for is to resolve an error code to its description, then you can use the FormatMessage() function from the Win32 module. Example:

    C:\>perl -MWin32 my $errorcode = 32; print Win32::FormatMessage($errorcode); ^Z The process cannot access the file because it is being used by another + process.

    Update: Link fixed.

      Or assign to $^E
      $ perl -le"warn $^E=32" The process cannot access the file because it is being used by another + process at -e line 1.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://853159]
Approved by kennethk
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2023-12-02 06:10 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (13 votes). Check out past polls.