File Coverage

blib/lib/Parse/Apache/ServerStatus/Extended.pm
Criterion Covered Total %
statement 15 28 53.5
branch 0 6 0.0
condition n/a
subroutine 5 7 71.4
pod 1 1 100.0
total 21 42 50.0


line stmt bran cond sub pod time code
1             package Parse::Apache::ServerStatus::Extended;
2              
3 1     1   23958 use warnings;
  1         2  
  1         33  
4 1     1   6 use strict;
  1         2  
  1         34  
5 1     1   858 use Web::Scraper;
  1         110028  
  1         7  
6 1     1   65 use base qw( Parse::Apache::ServerStatus );
  1         3  
  1         1109  
7              
8             our $VERSION = '0.02';
9 1     1   104353 use 5.8.1;
  1         4  
  1         289  
10              
11             sub parse {
12 0     0 1   my $self = shift;
13 0 0         my $content = $_[0] ? shift : $self->{content};
14 0 0         return $self->_raise_error('no content received') unless $content;
15              
16             my $table = scraper {
17             process 'table[border="0"] tr',
18             'rows[]' => scraper {
19 0           process 'td',
20             'values[]' => 'TEXT';
21             }
22 0     0     };
  0            
23              
24 0           my @scraped;
25 0           for ( @{ $table->scrape($content)->{rows} } ) {
  0            
26 0 0         next unless $_->{values};
27 0           my $stat = $_->{values};
28 0           push @scraped, {
29             srv => $stat->[0],
30             pid => $stat->[1],
31             acc => $stat->[2],
32             m => $stat->[3],
33             cpu => $stat->[4],
34             ss => $stat->[5],
35             req => $stat->[6],
36             conn => $stat->[7],
37             child => $stat->[8],
38             slot => $stat->[9],
39             client => $stat->[10],
40             vhost => $stat->[11],
41             request => $stat->[12],
42             };
43             }
44              
45 0           return \@scraped;
46             }
47              
48             1;
49             __END__