------------------------------------- # NAME File::chmod::Recursive - Run chmod recursively against directories # DESCRIPTION Like File::chmod, but recursive with selective permissions # SYNOPSIS use File::chmod::Recursive; # Exports 'chmod_recursive' by default # Apply identical permissions to everything # Similar to chmod -R chmod_recursive( 0755, '/path/to/directory' ); # Apply permissions selectively chmod_recursive( { dirs => 0755, # Mode for directories files => 0644, # Mode for files # Match both directories and files match => { qr/.sh|.pl/ => 0755, qr/.gnupg/ => 0600, }, # You can also match files or directories selectively match_dirs => { qr//logs// => 0775, }, match_files => { qr//bin/+$/ => 0755, }, }, '/path/to/directory' ); # FUNCTIONS - chmod_recursive(MODE, $path) - chmod_recursive(%options, $path) This function accepts two parameters. The first is either a MODE or an options hashref. The second is the directory to work on. It returns the number of files successfully changed, similar to chmod. When using a hashref for selective permissions, the following options are valid - { dirs => MODE, # Default Mode for directories files => MODE, # Default Mode for files # Match both directories and files match => { qr// => MODE, }, # Match files only match_files => { qr// => MODE, }, # Match directories only match_dirs => { qr// => MODE, }, # Follow symlinks. OFF by default follow_symlinks => 0, # Depth first tree walking. ON by default (default find behavior) depth_first => 1, } In all cases the MODE is whatever File::chmod accepts. # BUGS AND LIMITATIONS No bugs have been reported. Please report any bugs or feature requests to bug-file-chmod-recursive@rt.cpan.org, or through the web interface at http://rt.cpan.org. # SEE ALSO - File::chmod - chmod - L # AUTHOR Mithun Ayachit # LICENCE AND COPYRIGHT Copyright (c) 2011, Mithun Ayachit . All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. -------------------------------------