|
Introduction to Library Functions | project(3EXT) |
| project - access project files
from Perl |
SYNOPSIS
|
use Sun::Solaris::Project qw(:ALL);
my ($name, $projid, $comment, $users, $groups, $attr) = getprojent();
($name, $projid, $comment, $users, $groups, $attr) = getprojbyname("proj");
my $proj = getdefaultproj("root");
|
|
This module provides perl access to the project file library as documented in getprojent(3PROJECT). The interface is similar to the standard perl get(xxx) functions such as getpwent() and gethostent(). For detailed descriptions of the individual functions, refer to the getprojent(3PROJECT) and project(4) manual pages.
CONSTANTS
|
-
PROJNAME_MAX
- maximum length of a project name
|
FUNCTIONS
|
- getprojent()
- Returns the next entry from the projects file. When called in a scalar context, getprojent() returns just the name of the project, or undef when the end
of the file is reached. When called in a list context, getprojent() returns a 6-element list consisting of ($name, $projid, $comment, \@users, \@groups, $attr) . \@users and \@groups are returned as references to arrays containing the appropriate user or project lists. On end of file, undef is returned.
- setprojent()
- Rewinds the project database to the beginning of the file.
- endprojent()
- Closes the project file.
- getprojid()
- Returns the current numeric project ID.
-
getprojbyname($name)
- Searches the project database for an entry with the specified name, returning undef if it cannot be found or a 6-element list as returned by getprojent() if it can be found.
-
getprojbyid($id)
- Searches the project database for an entry with the specified ID, returning undef if it cannot be found or a 6-element list as returned by getprojent() if it can be found.
-
getdefaultproj($user)
- Returns the default project entry for the specified user in the same format as getprojent(), or undef if the user cannot be found. For full details of the lookup process, see the manual
page for getdefaultproj(3PROJECT).
-
fgetprojent($filehandle)
- Returns the next project entry from $filehandle, which is a perl file handle, and must refer to a previously opened file in project(4) format. Return values are the same as for getprojent().
-
inproj($user, $project)
- Checks to see if the specified user is able to use the project. Returns TRUE if the user can use the project and FALSE otherwise.
-
getprojidbyname($project)
- Searches the project database for the specified project and returns the project ID if it is found. If not found, undef is returned.
|
EXPORTS
|
By default nothing is exported from this namespace. The following tags can be used to selectively import constants and functions defined in this namespace:
-
:LIBCALLS
-
PROJNAME_MAX, getprojent(), setprojent(), endprojent(), getprojbyname(), getprojbyid(), getdefaultproj(), fgetprojent(), inproj(), getprojidbyname(), getprojid()
-
:ALL
-
:LIBCALLS
|
|
| Example 1. Get the record for the default project and print its list of attributes.
|
|
use Sun::Solaris::Project qw(:ALL);
my ($name, $projid, $comment, $users, $groups, $attr) =
getprojbyname("default");
die("Can't find default project\n") if (! defined($name));
print("Project $name:\n");
print(" Project id: $projid\n");
print(" Comment: $comment\n");
print(" Users: @$users\n");
print(" Groups: @$groups\n");
print(" Attributes: $attr\n");
|
|
|
| |