Chapter 35. 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

User name

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

0

name

Network name

1

aliases

Alias names

2

addrtype

Address type

3

net

Network address

endnetent

Ends lookup processing.

getnetbyaddr addr, type

Gets information by address and type. In scalar context, returns the network name.

getnetbyname name

Gets information by network name. In scalar context, returns the network number.

getnetent

Gets next network information. In scalar context, returns the network name.

setnetent stayopen

Resets lookup processing.

Information About Network Hosts

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

Index

Name

Description

0

name

Host name

1

aliases

Alias names

2

addrtype

Address type

3

length

Length of address

4

addr

Address, or addresses

endhostent

Ends lookup processing.

gethostbyaddr addr, addrtype

Gets information by IP address. In scalar context, returns the hostname.

gethostbyname name

Gets information by hostname. In scalar context, returns the host address.

gethostent

Gets next host information. In scalar context, returns the hostname.

sethostent stayopen

Resets lookup processing.

Information About Network Services

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

Index

Name

Description

0

name

Service name

1

aliases

Alias names

2

port

Port number

3

proto

Protocol number

endservent

Ends lookup processing.

getservbyname name, protocol

Gets information by service name for the given protocol. In scalar context, returns the service (port) number.

getservbyport port, protocol

Gets information by service port for the given protocol. In scalar context, returns the service name.

getservent

Gets next service information. In scalar context, returns the service name.

setservent stayopen

Resets lookup processing.

Information About Network Protocols

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

Index

Name

Description

0

name

Protocol name

1

aliases

Alias names

2

proto

Protocol number

endprotoent

Ends lookup processing.

getprotobyname name

Gets information by protocol name. In scalar context, returns the protocol number.

getprotobynumber number

Gets information by protocol number. In scalar context, returns the name of the protocol.

getprotoent

Gets next protocol information. In scalar context, returns the name of the protocol.

setprotoent stayopen

Resets lookup processing.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset