I read perldoc -f -e before sending this mail.
I was confused because the doc was talking about files and not directories.
Can I trust the behaviour of if(-W $filename){}  on use of an directory instead of a 
file ?
I tried with directory, it seems to work,  but ... why the doc talks about files only 
???
 
Thx,
 
José.
  "John W. Krahn" <[EMAIL PROTECTED]> a écrit : José nyimi wrote:
> 
> Hello,

Hello,

> I would like to check if a given directory is writable for the user who run the 
>script.
> 
> My first idea is to open a dummy file in ">" mode on that directory and
> check if everythink went ok or not.
> 
> Which will look like:
> 
> #!/usr/bin/perl
> use strict;
> use warnings;
> my $mydir=$ENV{MY_DIR};
> 
> unless(&check_w($mydir)){
> #Continue the job whithout stress ...
> print "I do";
> }
> 
> But I'm not satisfied with this solution.
> I think there is an other one better designed.
> Could I get input from you please ?


#!/usr/bin/perl
use strict;
use warnings;

unless ( -w $ENV{MY_DIR} ) {
#Continue the job whithout stress ...
print "I do";
}

perldoc -f -w
perldoc -f -W


John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------
Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en français !

Reply via email to