The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Sys::Config::Manage::Ownership - Handles file user/group ownership for files in the configuration directory.

VERSION

Version 0.0.0

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.

defaultUID

This is the default user ID for a file.

If not specified, the default is '0'.

defaultGID

This is the default group ID for a file.

If not specified, the default is '0'.

    $foo=Sys::Config::Manage::Ownership->new(\%args);
    if($foo->error){
        warn('error:'.$foo->error.': '.$foo->errorString);
    }

downSync

This syncs the group/user ownership 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);
    }

getGID

This retrieves the GID 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 $gid=$foo->getGID( $configDir, $file );
    if($foo->error){
        warn('error:'.$foo->error.': '.$foo->errorString);
    }

getUID

This retrieves the UID 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 $UID=$foo->getUID( $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);
    }

setGID

This sets the GID 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 GID.

    $foo->setGID($configDir, $file, $gid);
    if($foo->error){
        warn('error:'.$foo->error.': '.$foo->errorString);
    }

setUID

This sets the UID 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 UID.

    $foo->setUID($configDir, $file, $uid);
    if($foo->error){
        warn('error:'.$foo->error.': '.$foo->errorString);
    }

setGIDfromFile

This sets the GID 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->setUIDfromFile($configDir, $file);
    if($foo->error){
        warn('error:'.$foo->error.': '.$foo->errorString);
    }

setUIDfromFile

This sets the UID 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->setUIDfromFile($configDir, $file);
    if($foo->error){
        warn('error:'.$foo->error.': '.$foo->errorString);
    }

upSync

This syncs the file user/group 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 specified, 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 [UG]ID does not appear to be valid.

Validity is checked via the regexp below.

    /^[0123456789]*$/

13

The ".SysConfigManage" directory does not exist and could not be created.

14

The ".SysConfigManage/UID" directory does not exist and could not be created.

15

Unable to opens the [GU]ID 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-Ownership. 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::Ownership

You can also look for information at:

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.