Skip to Main Content
Perl Pocket Reference, 5th Edition
book

Perl Pocket Reference, 5th Edition

by Johan Vromans
July 2011
Intermediate to advanced content levelIntermediate to advanced
104 pages
2h 14m
English
O'Reilly Media, Inc.
Content preview from Perl Pocket Reference, 5th Edition

Information from System Databases

Information About Users

In list context, each of these routines returns a list of values. Use the standard module User::pwent for by-name access to the elements of the list:

Index

Name

Description

0

name

Username

1

passwd

Password info

2

uid

ID of this user

3

gid

Group ID of this user

4

quota

Quota information

5

comment

Comments

6

gecos

Full name

7

dir

Home directory

8

shell

Login shell

9

expire

Password expiration info

endpwent

Ends lookup processing.

getpwent

Gets next user information.

In scalar context, returns the username.

getpwnam name

Gets information by name.

In scalar context, returns the user ID.

getpwuid uid

Gets information by user ID.

In scalar context, returns the username.

setpwent

Resets lookup processing.

Information About Groups

In list context, each of these routines returns a list of values. Use the standard module User::grent for by-name access to the elements of the list:

Index

Name

Description

0

name

Group name

1

passwd

Password info

2

gid

ID of this group

3

members

Space-separated list of the login names of the group members

endgrent

Ends lookup processing.

getgrent

Gets next group information.

In scalar context, returns the group name.

getgrgid gid

Gets information by group ID.

In scalar context, returns the group name.

getgrnam name

Gets information by name.

In scalar context, returns the group ID.

setgrent

Resets lookup processing.

Information About Networks

In list context, each of these routines returns a list of values. Use the standard module Net::netent for by-name access:

Index

Name

Description ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl Testing: A Developer's Notebook

Perl Testing: A Developer's Notebook

Ian Langworth, Chromatic
Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe

Publisher Resources

ISBN: 9781449311186Errata Page