Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Permission denied when opening files in Windows

by atcroft (Abbot)
on Mar 27, 2015 at 18:36 UTC ( [id://1121551]=note: print w/replies, xml ) Need Help??


in reply to Permission denied when opening files in Windows

Considering that you are on a Microsoft platform, have you tried testing the directory you to write to and the file you are writing to (overwriting?) to ensure you have permission to write to it as your user?

$output = $lineValue[0].".cfg"; # begin untested code use File::Basename; # May be moved to top of script my $output_dir = File::Basename::dirname $output; if ( not ( -w $output_dir ) ) { die "No permission to write to directory $output_dir\n"; } elsif ( not ( -w $output ) ) { die "No permission to write to file $output\n"; } # end untested code open(my $fh2, ">", $output) or die $!;

Hope that helps.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-03-29 15:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found