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

NAME

Apache::Htgroup - Manage Apache authentication group files

SYNOPSIS

  use Apache::Htgroup;
  $group = new Apache::Htgroup ($path_to_groupfile);
  $foo = $group->isMember($username);
  $group->addUser($username);
  $group->deleteUser($username);

DESCRIPTION

Manage Apache htgroup files

new
        $group = new Apache::Htgroup ($path_to_groupfile);

Creates a new object of the Apache::Htgroup class

isMember
        $foo = $group->isMember($username);

Returns true if the username is in the group, false otherwise

addUser
        $group->addUser($username);

Adds the user to the group.

deleteUser
        $group->deleteUser($username);

Removes the specified user from the group.

groups
        $groups = $group->groups;

Returns a reference to a hash of the groups. The key is the name of the group, and the value is a string containing all the users separated by spaces - exactly as it appears in the group file.

writeFile
        $group->writeFile($groups);

Writes out the group file. $groups is a hashref that looks like the hash returned by the groups method.

Bugs/To do/Disclaimer

I wrote this in a real hurry. I knew that it would save time in the long run if I wrote this as a module, but I did not have the time to put in all the doodads that really belong in here.

I really need to have some file locking here, but this is a rush job. I'll add this some time soon.

Need to have reasonable return values on failure. I'll add this when I'm in less of a hurry.

Need to add some reasonable tests in test.pl. Same excuse.

Patches and suggestions welcome.

AUTHOR

Rich Bowen, rbowen@rcbowen.com