File Coverage

blib/lib/DBD/Sys/Plugin/Win32/Groups.pm
Criterion Covered Total %
statement 13 21 61.9
branch 0 2 0.0
condition n/a
subroutine 5 7 71.4
pod 3 3 100.0
total 21 33 63.6


line stmt bran cond sub pod time code
1             package DBD::Sys::Plugin::Win32::Groups;
2              
3 3     3   2885 use strict;
  3         7  
  3         114  
4 3     3   16 use warnings;
  3         7  
  3         95  
5 3     3   16 use vars qw($VERSION @colNames);
  3         7  
  3         175  
6              
7 3     3   18 use base qw(DBD::Sys::Table);
  3         12  
  3         1054  
8             my $haveWin32pwent = 0;
9             eval {
10             require Win32::pwent;
11             $haveWin32pwent = 1;
12             };
13              
14             $VERSION = "0.102";
15             @colNames = qw(groupname grpass gid members);
16              
17             =pod
18              
19             =head1 NAME
20              
21             DBD::Sys::Plugin::Win32::Groups - provides a table containing the operating system user groups
22              
23             =head1 SYNOPSIS
24              
25             $groups = $dbh->selectall_hashref("select * from grent", "groupname");
26              
27             =head1 ISA
28              
29             DBD::Sys::Plugin::Win32::Groups;
30             ISA DBD::Sys::Table
31              
32             =head1 DESCRIPTION
33              
34             =head2 COLUMNS
35              
36             =head3 groupname
37              
38             Name of the group
39              
40             =head3 grpass
41              
42             Encrypted password of the group - usually empty for current LANMAN functions
43              
44             =head3 gid
45              
46             Numerical group id of the users primary group
47              
48             =head3 members
49              
50             Numerical count of the members in this group
51              
52             =head1 METHODS
53              
54             =head2 get_table_name
55              
56             Returns 'grent'.
57              
58             =cut
59              
60 4     4 1 16 sub get_table_name() { return 'grent'; }
61              
62             =head2 get_col_names
63              
64             Returns the column names of the table as named in L
65              
66             =cut
67              
68 0     0 1   sub get_col_names() { @colNames }
69              
70             =head2 collect_data
71              
72             Retrieves the data from the group database and put it into fetchable rows.
73              
74             =cut
75              
76             sub collect_data()
77             {
78 0     0 1   my @data;
79              
80 0 0         if ($haveWin32pwent)
81             {
82 0           Win32::pwent::endgrent(); # ensure we're starting fresh ...
83 0           while ( my ( $name, $grpass, $gid, $members ) = Win32::pwent::getgrent() )
84             {
85 0           push( @data, [ $name, $grpass, $gid, $members ] );
86             }
87 0           Win32::pwent::endgrent();
88             }
89              
90 0           return \@data;
91             }
92              
93             =head1 PREREQUISITES
94              
95             The module C is required to provide data for the
96             table.
97              
98             =head1 AUTHOR
99              
100             Jens Rehsack Alexander Breibach
101             CPAN ID: REHSACK
102             rehsack@cpan.org alexander.breibach@googlemail.com
103             http://www.rehsack.de/
104              
105             =head1 COPYRIGHT
106              
107             This program is free software; you can redistribute
108             it and/or modify it under the same terms as Perl itself.
109              
110             The full text of the license can be found in the
111             LICENSE file included with this module.
112              
113             =head1 SUPPORT
114              
115             Free support can be requested via regular CPAN bug-tracking system. There is
116             no guaranteed reaction time or solution time, but it's always tried to give
117             accept or reject a reported ticket within a week. It depends on business load.
118             That doesn't mean that ticket via rt aren't handles as soon as possible,
119             that means that soon depends on how much I have to do.
120              
121             Business and commercial support should be acquired from the authors via
122             preferred freelancer agencies.
123              
124             =cut
125              
126             1;
127