File Coverage

blib/lib/Net/OpenVAS/OMP/Request.pm
Criterion Covered Total %
statement 28 32 87.5
branch n/a
condition n/a
subroutine 8 10 80.0
pod 4 4 100.0
total 40 46 86.9


line stmt bran cond sub pod time code
1             package Net::OpenVAS::OMP::Request;
2              
3 2     2   673 use strict;
  2         5  
  2         58  
4 2     2   12 use warnings;
  2         4  
  2         46  
5 2     2   683 use utf8;
  2         20  
  2         11  
6 2     2   74 use feature ':5.10';
  2         4  
  2         204  
7              
8 2     2   875 use XML::Simple qw( :strict );
  2         9716  
  2         14  
9              
10 2     2   207 use overload q|""| => 'raw', fallback => 1;
  2         14  
  2         14  
11              
12             our $VERSION = '0.101';
13              
14             sub new {
15              
16 1     1 1 335 my ( $class, %args ) = @_;
17              
18 1         2 my $command = $args{'command'};
19 1         3 my $arguments = $args{'arguments'};
20              
21 1         3 my $request = { $command => $arguments };
22 1         3 my $raw = XMLout(
23             $request,
24             NoEscape => 0,
25             SuppressEmpty => 1,
26             KeepRoot => 1,
27             KeyAttr => $command
28             );
29              
30 1         289 chomp($raw);
31              
32 1         4 my $self = {
33             command => $command,
34             arguments => $arguments,
35             raw => $raw,
36             };
37              
38 1         5 return bless $self, $class;
39              
40             }
41              
42             sub raw {
43 0     0 1 0 my ($self) = @_;
44 0         0 return $self->{raw};
45             }
46              
47             sub command {
48 3     3 1 11 my ($self) = @_;
49 3         36 return $self->{command};
50             }
51              
52             sub arguments {
53 0     0 1   my ($self) = @_;
54 0           return $self->{arguments};
55             }
56              
57             1;
58             __END__