NAME
Sys::Config::Manage::Perms - Handles file permissions for files in a configuration directory.
VERSION
Version 0.0.0
SYNOPSIS
use Sys::Config::Manage::Perms;
my $foo = Sys::Config::Manage::Perms->new();
...
METHODS
new
This initiates the object.
One argument is required and it is a hash reference.
args hash ref
scm
This is a initiated Sys::Config::Manage object.
default
Default value to use for the mode.
If not specified, it defaults to '0644'.
$foo=Sys::Config::Manage::Perms->new(\%args);
if($foo->error){
warn('error:'.$foo->error.': '.$foo->errorString);
}
downSync
This syncs the file permissions down from the configuration directory to the system.
Two arguments can be used.
The first is the configuration directory. If not specified, it will be automaticallly choosen.
The second is the files to sync. If not specifiedm, all files will be synced.
#sync the specified files
$foo->downSync( $configDir, \@files);
if($foo->error){
warn('error:'.$foo->error.': '.$foo->errorString);
}
#syncs all the files
$foo->downSync( $configDir );
if($foo->error){
warn('error:'.$foo->error.': '.$foo->errorString);
}
getPerms
This retrieves the mode for a file.
Two arguments are taken.The first is the configuration directory, which if not defined is automatically chosen. The second is the file in question.
my $mode=$foo->getPerms( $configDir, $file );
if($foo->error){
warn('error:'.$foo->error.': '.$foo->errorString);
}
listConfigFiles
This lists the various config files that are being tracked that actually have a value specified.
Not all files returned by Sys::Config::Manage->listConfigFiles will have a value specified.
my @files=$foo->listConfigFiles;
if($foo->error){
warn('error:'.$foo->error.': '.$foo->errorString);
}
setPerms
This sets the permissions for a file. This does require the numeric value.
Three arguments are taken.
The first one is the configuration directory to use. If none is specified, it will automatically be choosen.
The second is the config file to add the perms for.
The third numeric value for the permissions.
$foo->setPerms($configDir, $file, '0640');
if($foo->error){
warn('error:'.$foo->error.': '.$foo->errorString);
}
setPermsFromFile
This sets the permissions for a file, from a already existing file.
Three arguments are taken.
The first one is the configuration directory to use. If none is specified, it will automatically be choosen.
The second is the config file to add the perms for.
$foo->setPermsFromFile($configDir, $file);
if($foo->error){
warn('error:'.$foo->error.': '.$foo->errorString);
}
upSync
This syncs the file permissions up from the file system to configuration directory.
Two arguments can be used.
The first is the configuration directory. If not specified, it will be automaticallly choosen.
The second is the files to sync. If not specifiedm, all files will be synced.
#sync the specified files
$foo->upSync( $configDir, \@files);
if($foo->error){
warn('error:'.$foo->error.': '.$foo->errorString);
}
#syncs all the files
$foo->upSync( $configDir );
if($foo->error){
warn('error:'.$foo->error.': '.$foo->errorString);
}
ERROR CODES
1
Nothing passed for the Sys::Config::Manage object.
2
$args{scm} is not a Sys::Config::Manage object.
3
Invalid configuration directory name.
4
The configuration directory does not exist.
5
Sys::Config::Manage->selectConfigDir errored.
6
Sys::Config::Manage->validConfigDirName errored.
7
No filename specified.
8
The specified file does not exist under the configuration directory.
9
The specified file does not exist on the file system.
10
The file specified file is under the base directory.
11
No value for the permissions specified.
12
The value specified for the permissions does not appear to be valid.
Validity is checked via the regexp below.
/^[01246][01234567][01234567][01234567]$/
13
The ".SysConfigManage" directory does not exist and could not be created.
14
The ".SysConfigManage/Perms" directory does not exist and could not be created.
15
Unable to opens the permissions file.
16
The add command failed.
AUTHOR
Zane C. Bowers-Hadley, <vvelox at vvelox.net>
BUGS
Please report any bugs or feature requests to bug-sys-config-manage-perms at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sys-Config-Manage-Perms. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Sys::Config::Manage::Perms
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2011 Zane C. Bowers-Hadley.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.