File Coverage

blib/lib/QualysGuard/Response/AssetHostList.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package QualysGuard::Response::AssetHostList;
2              
3 2     2   84289 use warnings;
  2         4  
  2         87  
4 2     2   11 use strict;
  2         6  
  2         78  
5              
6 2     2   13 use base qw( QualysGuard::Response );
  2         4  
  2         1697  
7              
8             our $VERSION = '0.03';
9              
10              
11             # =============================================================
12             # - new
13             # =============================================================
14             sub new {
15             my ( $class, $xml ) = @_;
16              
17             my $self = __PACKAGE__->SUPER::new( $xml );
18              
19             bless $self, $class;
20              
21             # -- check for QualysGuard function error
22              
23             if ( $self->exists('/HOST_LIST/ERROR') ) {
24             $self->{error_code} = $self->findvalue('/HOST_LIST/ERROR/@number');
25             $self->{error_text} = $self->getNodeText('/HOST_LIST/ERROR');
26             $self->{error_text} =~ s/^\s+(.*)\s+$/$1/m;
27             }
28              
29             return $self;
30             }
31              
32              
33             # -------------------------------------------------------------------
34             # - get_ip_address_list
35             # -------------------------------------------------------------------
36             sub get_ip_address_list {
37             my $self = shift;
38             my @nodes = $self->findnodes('/HOST_LIST/RESULTS/HOST/IP');
39             my @rv = ();
40              
41             foreach my $node ( @nodes ) {
42             push( @rv, $node->string_value() );
43             }
44              
45             return \@rv;
46             }
47              
48              
49              
50             1;
51              
52             __END__