Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: checking file permissions

by tachyon (Chancellor)
on Nov 14, 2004 at 00:47 UTC ( #407640=note: print w/replies, xml ) Need Help??


in reply to checking file permissions

die "$file does not exist!\n" unless -e $file; my @perms; push @perms, 'read' if -r $file; push @perms, 'write' if -w $file; push @perms, 'execute' if -x $file; print @perms ? "You have @perms perms\n" : "You got zip\n";

cheers

tachyon

Replies are listed 'Best First'.
Re^2: checking file permissions
by freddo411 (Chaplain) on Nov 14, 2004 at 01:10 UTC
    Looks like you just did this tyke's homework. Bad Tachyon.

    -------------------------------------
    Nothing is too wonderful to be true
    -- Michael Faraday

      Actually he has since added a clarification that places him on Win32, so he probably really wants Dave Roth's Win32::Perms

      cheers

      tachyon

Re^2: checking file permissions
by Your Mother (Bishop) on Nov 14, 2004 at 18:16 UTC

    Also a good place to introduce _ even if it's not saving much here (discussed in JediWizard's perldoc.com link; _ is a hard thing to search for).

    die "$file does not exist!\n" unless -e $file; my @perms; push @perms, 'read' if -r _; push @perms, 'write' if -w _; push @perms, 'execute' if -x _; if ( @perms ) { printf "You have %s perms\n", join(", ", @perms); } else { print "You got zip\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://407640]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2018-07-22 13:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (454 votes). Check out past polls.

    Notices?