File Coverage

blib/lib/P9Y/ProcessTable/Table.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             package P9Y::ProcessTable::Table;
2              
3             our $AUTHORITY = 'cpan:BBYRD'; # AUTHORITY
4             our $VERSION = '1.06_01'; # VERSION
5              
6             #############################################################################
7             # Modules
8              
9 3     3   12 use strict;
  3         5  
  3         75  
10 3     3   9 use warnings;
  3         4  
  3         64  
11              
12 3     3   1488 use Module::Runtime ();
  3         4610  
  3         71  
13 3     3   1244 use Path::Class ();
  3         105475  
  3         74  
14              
15 3     3   1691 use Moo;
  3         23178  
  3         15  
16              
17             # Figure out which OS role we should consume
18             my %OS_TRANSLATE = (
19             cygwin => 'MSWin32',
20             );
21              
22             my $role_base = 'P9Y::ProcessTable::Role::Table::';
23             my $role = 'OS::'.($OS_TRANSLATE{$^O} || $^O);
24              
25             $@ = '';
26             my $has_os_role = eval { Module::Runtime::require_module($role_base.$role) };
27             die $@ if $@ and $@ !~ /^Can't locate /;
28              
29             unless ($has_os_role) {
30             # let's hope they have /proc
31             if ( -d '/proc' and @{[ glob('/proc/*') ]} ) { $role = 'ProcFS'; }
32             # ...or that Proc::ProcessTable can handle it
33             else { $role = 'PPT'; }
34             }
35              
36             # This here first, so that it gets overloaded
37             extends 'P9Y::ProcessTable::Table::Base';
38              
39             with $role_base.$role;
40              
41 3     3   5167 use P9Y::ProcessTable::Process;
  3         7  
  3         135  
42              
43             42;