Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

WinXP not creating files

by Dragoncoding (Initiate)
on Aug 06, 2009 at 13:34 UTC ( [id://786424]=perlquestion: print w/replies, xml ) Need Help??

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

(I am posting this question because I was unable to find the answer by googling and by searching this site)

I have a perl script which works correctly on my machine, WinXP pro, and on the machines of my co-workers in the office. However, when I send out the script to the field teams it fails.

In some cases it fails to create a directory, and in others it fails to create a file when the directory exists.

I am truly at a loss as to why, since it works correctly on my machine.

Here is the relevant code:

mkdir "c:/configs/".$RackID; open ERROR,"> c:/configs/".$RackID."/AP Compare results.txt"; print ERROR @error; close(ERROR);

Any assistance is very greatly appreciated.

Replies are listed 'Best First'.
Re: WinXP not creating files
by Fletch (Bishop) on Aug 06, 2009 at 13:44 UTC

    Perhaps if you actually checked for error returns and printed the error message from $! you might have an idea what went wrong.

    open ERROR, '>', "c:/...." or die "error opening: $!\n";

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: WinXP not creating files
by dreadpiratepeter (Priest) on Aug 06, 2009 at 13:44 UTC
    You are not checking the return cordes on any of your IO operations. I find it hard to belive that you are "at a loss" before doing even one round of debugging. any robust Perl code should ALWAYS check the return codes.
    It should look like:
    mkdir "c:/configs/".$RackID or die "mkdir failed: $!"; open ERROR,">c:configs/$RackID/AP Compare results.txt" or die "open fa +iled: $!"; ...
    pedantics would check returns on the print and the close, but I'd bet dollars to donuts that your problem is in the mkdir or the open. My first guess would be that the program lack permission to write into the configs directory.


    -pete
    "Worry is like a rocking chair. It gives you something to do, but it doesn't get you anywhere."
Re: WinXP not creating files
by Anonymous Monk on Aug 06, 2009 at 14:02 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-26 06:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found