NAME

Parse::Passwd - parse Unix passwd files

SYNOPSIS

use Parse::Passwd;

## example 1
print join ',', Parse::Passwd->fields;

## example 2
my $p = Parse::Passwd->file;

open P, ">passwd.jdb" or die $!;

for (@$p) {
  print join ' -- ', @{$_}{Parse::Passwd->fields} ;
  print "\n";
}


## example 3
my $p = Parse::Passwd->file;
use Data::Dumper; print Dumper($p);

# OUTPUT

$VAR1 = [
        {
          'login_shell' => undef,
          'uid' => '0',
          'fullname' => '/',
          'gid' => '0',
          'home_dir' => '/sbin/sh',
          'username,' => 'root',
          'password,' => 'x',
          'gcos_field' => 'Super-User'
        },
        {
          'login_shell' => undef,
          'uid' => 2026,
          'fullname' => '/export/home/collinss',
          'gid' => 141,
          'home_dir' => '/usr/bin/bash ',
          'username,' => 'collinss',
          'password,' => 'x',
          'gcos_field' => 'Sam Collins - Standard User'
        },
        {
          'login_shell' => undef,
          'uid' => 2027,
          'fullname' => '/export/home/wintili',
          'gid' => 141,
          'home_dir' => '/usr/bin/bash ',
          'username,' => 'wintili',
          'password,' => 'x',
          'gcos_field' => 'Will Intel - Basic user'
        },
   ];

DESCRIPTION

This is a lightweight alternative to Unix::PasswdFile.

METHODS

->file ( [ $file ] )

The class method file optionally takes one file argument to change the location of the passwd file. It returns a *reference* to an array of hash references.

->fields

Returns an array giving the field names of a passwd file in order.

AUTHOR

T. M. Brannon, <tbone@cpan.org>

SEE ALSO

Unix::PasswdFile.