AnyData/Format/Passwd.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 31 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 ######################################################################
2 package AnyData::Format::Passwd;
3 ######################################################################
4 #
5 # copyright 2000 by Jeff Zucker <jeff@vpservices.com>
6 # all rights reserved
7 #
8 ######################################################################
9  
10 =head1 NAME
11  
12 Passwd - tied hash and DBI access to passwd files
13  
14 =head1 SYNOPSIS
15  
16 use AnyData;
17 my $users = adTie( 'Passwd', '/etc/passwd' );
18 print $users->{jdoe}->{homedir};
19 # ... other tied hash operations
20  
21 OR
22  
23 use DBI
24 my $dbh = DBI->connect('dbi:AnyData:');
25 $dbh->func('users','Passwd','/etc/passwd','ad_catalog');
26 my $g7 = $dbh->selectall_arrayref( qq{
27 SELECT username, homedir FROM users WHERE GID = '7'
28 });
29 # ... other DBI/SQL operations
30  
31 =head1 DESCRIPTION
32  
33 This module provides a tied hash interface and a DBI/SQL interface to passwd files. Simply specify the format as 'Passwd' and give the name of the file and the modules will build a hash table with the column names
34  
35 username
36 passwd
37 UID
38 GID
39 fullname
40 homedir
41 shell
42  
43 The username field is treated as a key column.
44  
45 This module is a submodule of the AnyData.pm and DBD::AnyData.pm modules. Refer to their documentation for further details.
46  
47 =head1 AUTHOR & COPYRIGHT
48  
49 copyright 2000, Jeff Zucker <jeff@vpservices.com>
50 all rights reserved
51  
52 =cut
53  
54 use strict;
55 use warnings;
56 use AnyData::Format::CSV;
57 use vars qw( @ISA $VERSION);
58 @AnyData::Format::Passwd::ISA = qw( AnyData::Format::CSV );
59  
60 $VERSION = '0.12';
61  
62 sub new {
63 my $class = shift;
64 my $flags = shift || {};
65 $flags->{field_sep} = q(:);
66 $flags->{col_names} = 'username,passwd,UID,GID,fullname,homedir,shell';
67 $flags->{key} = 'username';
68 $flags->{keep_first_line} = 1;
69 my $self = AnyData::Format::CSV::->new(
70 $flags
71 );
72 return bless $self, $class;
73 }
74 1;
75  
76  
77