File Coverage

blib/lib/DBD/Sys/Plugin/Any/FileSys.pm
Criterion Covered Total %
statement 13 28 46.4
branch 0 4 0.0
condition n/a
subroutine 5 7 71.4
pod 3 3 100.0
total 21 42 50.0


line stmt bran cond sub pod time code
1             package DBD::Sys::Plugin::Any::FileSys;
2              
3 3     3   2509 use strict;
  3         7  
  3         84  
4 3     3   16 use warnings;
  3         6  
  3         79  
5              
6 3     3   14 use vars qw($VERSION @colNames);
  3         5  
  3         128  
7              
8 3     3   21 use base qw(DBD::Sys::Table);
  3         6  
  3         975  
9              
10             =pod
11              
12             =head1 NAME
13              
14             DBD::Sys::Plugin::Any::FileSys - provides a table containing file systems
15              
16             =head1 SYNOPSIS
17              
18             $filesystems = $dbh->selectall_hashref("select * from filesystems", "mountpoint");
19              
20             =head1 ISA
21              
22             DBD::Sys::Plugin::Any::FileSys
23             ISA DBD::Sys::Table
24              
25             =cut
26              
27             my $haveSysFs;
28              
29             $VERSION = "0.102";
30             @colNames = qw(mountpoint mounted label volume device special type options);
31              
32             =head1 DESCRIPTION
33              
34             This module provides the table C for any operating system.
35              
36             =head2 COLUMNS
37              
38             =head3 mountpoint
39              
40             The friendly name of the filesystem. This will usually be the same
41             name as appears in the list returned by the filesystems() method.
42              
43             =head3 mounted
44              
45             Boolean, true if the filesystem is mounted.
46              
47             =head3 label
48              
49             The fileystem label
50              
51             =head3 volume
52              
53             Volume that the filesystem belongs to or is mounted on.
54              
55             =head3 device
56              
57             The physical device that the filesystem is connected to.
58              
59             =head3 special
60              
61             Boolean true if the filesystem type is considered "special".
62              
63             =head3 type
64              
65             The type of filesystem format, e.g. fat32, ntfs, ufs, hpfs, ext3, xfs etc.
66              
67             =head3 options
68              
69             The options that the filesystem was mounted with.
70             This may commonly contain information such as read-write,
71             user and group settings and permissions.
72              
73             =head1 METHODS
74              
75             =head2 get_col_names
76              
77             Returns the column names of the table as named in L
78              
79             =cut
80              
81 0     0 1 0 sub get_col_names() { @colNames }
82              
83             =head2 get_table_name
84              
85             Returns 'filesystems'
86              
87             =cut
88              
89 4     4 1 15 sub get_table_name() { return 'filesystems'; }
90              
91             =head2 collect_data
92              
93             Retrieves the data from L and put it into fetchable rows.
94              
95             =cut
96              
97             sub collect_data()
98             {
99 0     0 1   my @data;
100              
101 0 0         unless ( defined($haveSysFs) )
102             {
103 0           $haveSysFs = 0;
104 0           eval {
105 0           require Sys::Filesystem;
106 0           $haveSysFs = 1;
107             };
108             }
109              
110 0 0         if ($haveSysFs)
111             {
112 0           my $fs = Sys::Filesystem->new();
113 0           my @filesystems = $fs->filesystems();
114              
115 0           foreach my $filesys (@filesystems)
116             {
117 0           my @row;
118 0           @row = (
119             $fs->mount_point($filesys), $fs->mounted($filesys),
120             $fs->label($filesys), $fs->volume($filesys),
121             $fs->device($filesys), $fs->special($filesys),
122             $fs->type($filesys), $fs->options($filesys)
123             );
124 0           push( @data, \@row );
125             }
126             }
127              
128 0           return \@data;
129             }
130              
131             =head1 PREREQUISITES
132              
133             L is required to use this table.
134              
135             =head1 AUTHOR
136              
137             Jens Rehsack Alexander Breibach
138             CPAN ID: REHSACK
139             rehsack@cpan.org alexander.breibach@googlemail.com
140             http://www.rehsack.de/
141              
142             =head1 COPYRIGHT
143              
144             This program is free software; you can redistribute
145             it and/or modify it under the same terms as Perl itself.
146              
147             The full text of the license can be found in the
148             LICENSE file included with this module.
149              
150             =head1 SUPPORT
151              
152             Free support can be requested via regular CPAN bug-tracking system. There is
153             no guaranteed reaction time or solution time, but it's always tried to give
154             accept or reject a reported ticket within a week. It depends on business load.
155             That doesn't mean that ticket via rt aren't handles as soon as possible,
156             that means that soon depends on how much I have to do.
157              
158             Business and commercial support should be acquired from the authors via
159             preferred freelancer agencies.
160              
161             =cut
162              
163             1;