File Coverage

blib/lib/Net/Cisco/ObjectGroup/ICMP.pm
Criterion Covered Total %
statement 27 27 100.0
branch 10 10 100.0
condition 13 15 86.6
subroutine 6 6 100.0
pod 0 1 0.0
total 56 59 94.9


line stmt bran cond sub pod time code
1             package Net::Cisco::ObjectGroup::ICMP;
2 3     3   17 use base qw(Net::Cisco::ObjectGroup::Base);
  3         7  
  3         1898  
3              
4 3     3   21 use strict;
  3         5  
  3         111  
5 3     3   526 use warnings FATAL => qw(all);
  3         4  
  3         104  
6              
7 3     3   49 use Carp;
  3         5  
  3         882  
8              
9             sub _init {
10 4     4   8 my $self = shift;
11 4         6 my $arg_ref = shift;
12              
13 4         20 $self->set_type( 'icmp-type' );
14 4         75 $self->SUPER::_init( $arg_ref );
15              
16 4         8 return $self;
17             }
18              
19             sub push {
20 6     6 0 2983 my $self = shift;
21 6         11 my $arg_ref = shift;
22              
23 6 100 66     364 croak 'must specify either group-object or ICMP type'
24             if !defined $arg_ref->{group_object}
25             and !defined $arg_ref->{icmp_type};
26              
27 5 100 100     192 croak 'cannot specify both group-object and ICMP type'
28             if defined $arg_ref->{group_object}
29             and defined $arg_ref->{icmp_type};
30              
31 4 100 100     195 croak 'bad group-object'
32             if defined $arg_ref->{group_object}
33             and ! UNIVERSAL::isa( $arg_ref->{group_object}, __PACKAGE__ );
34              
35              
36 3 100 66     13 $arg_ref->{icmp_type}
      100        
37             = __PACKAGE__->__dict->{$arg_ref->{icmp_type}}
38             if defined $arg_ref->{icmp_type}
39             and defined __PACKAGE__->__dict
40             and exists __PACKAGE__->__dict->{$arg_ref->{icmp_type}};
41              
42 3 100       49 my $line = defined $arg_ref->{icmp_type}
43             ? "icmp-object $arg_ref->{icmp_type}"
44             : 'group-object '. $arg_ref->{group_object}->get_name;
45              
46 3         9 push @{$self->get_objs}, $line;
  3         15  
47              
48 3         25 return $self;
49             }
50              
51             1;
52              
53             # Copyright (c) The University of Oxford 2006. All Rights Reserved.
54             #
55             # This program is free software; you can redistribute it and/or modify it
56             # under the terms of version 2 of the GNU General Public License as published
57             # by the Free Software Foundation.
58             #
59             # This program is distributed in the hope that it will be useful, but WITHOUT
60             # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
61             # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
62             # more details.
63             #
64             # You should have received a copy of the GNU General Public License along with
65             # this program; if not, write to the Free Software Foundation, Inc., 51
66             # Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
67              
68             __DATA__