| 1 | package Net::Cisco::ObjectGroup::Base; | ||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use base qw(Class::Data::Inheritable); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use base qw(Class::Accessor::Fast); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use warnings FATAL => qw(all); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Symbol; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 6 | __PACKAGE__->mk_classdata('__dict'); | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 6 | __PACKAGE__->follow_best_practice; | |||||||||||||||||||||||||||
| 14 | 6 | __PACKAGE__->mk_accessors(qw( type name desc objs )); | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 13 | ▶ | sub _init { | ||||||||||||||||||||||||||
|
Subroutine
_init: called CC=8 SCAR=21.6
| |||||||||||||||||||||||||||||
| 17 | 13 | my $self = shift; | |||||||||||||||||||||||||||
| 18 | 13 | my $arg_ref = shift; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 13 | ▶ | return $self unless $arg_ref->{pretty_print}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 3 | my $pkg = ref $self; | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 3 | ▶ | if (!defined $pkg->__dict) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 3 | $pkg->__dict( {} ); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 3 | my $data = Symbol::qualify_to_ref('DATA', $pkg); | |||||||||||||||||||||||||||
| 27 | 3 | ▶ | while (my $line = <$data>) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | 119 | ▶ | next if $line =~ m/^#/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 51 | ▶ | next if $line !~ m/:/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 46 | $line =~ m/^\s*([0-9]+)\s*:\s*([a-z0-9-]{2,})\s*$/; | |||||||||||||||||||||||||||
| 32 | 46 | ▶ | if (defined $1 and defined $2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $1 and defined $2
MC/DC0%0/2
defined $1 and defined $2
defined $1
defined $2
Truth table33%1/3
A and B
A= defined $1B= defined $2
| |||||||||||||||||||||||||||||
| 33 | 46 | $pkg->__dict->{$1} = $2; | |||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | else { | ||||||||||||||||||||||||||||
| 36 | # pretty printing is nice but not essential, | ||||||||||||||||||||||||||||
| 37 | # so just continue if there is some kind of error. | ||||||||||||||||||||||||||||
| 38 | 0 | chomp $line; | |||||||||||||||||||||||||||
| 39 | 0 | carp "syntax error in __DATA__ portion of $pkg: '$line'"; | |||||||||||||||||||||||||||
| 40 | 0 | next; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 3 | return $self; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub push { | ||||||||||||||||||||||||||
|
Subroutine
push: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 49 | 0 | croak 'attempt to call push() in base class'; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 17 | ▶ | sub dump { | ||||||||||||||||||||||||||
|
Subroutine
dump: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | 17 | my $self = shift; | |||||||||||||||||||||||||||
| 54 | 17 | my $output; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 17 | $output .= sprintf "object-group %s %s\n", | |||||||||||||||||||||||||||
| 57 | $self->get_type, $self->get_name; | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 17 | ▶ | $output .= sprintf " description %s\n", | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | $self->get_desc if defined $self->get_desc; | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 17 | $output .= join "\n", map {' '. $_} @{$self->get_objs}; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 17 | chomp $output; | |||||||||||||||||||||||||||
| 65 | 17 | return $output; | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 6 | 1; | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | # Copyright (c) The University of Oxford 2006. All Rights Reserved. | ||||||||||||||||||||||||||||
| 71 | # | ||||||||||||||||||||||||||||
| 72 | # This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 73 | # under the terms of version 2 of the GNU General Public License as published | ||||||||||||||||||||||||||||
| 74 | # by the Free Software Foundation. | ||||||||||||||||||||||||||||
| 75 | # | ||||||||||||||||||||||||||||
| 76 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||||||||||||||||||||||||||||
| 77 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||||||||||||||||||||||||||
| 78 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||||||||||||||||||||||||||||
| 79 | # more details. | ||||||||||||||||||||||||||||
| 80 | # | ||||||||||||||||||||||||||||
| 81 | # You should have received a copy of the GNU General Public License along with | ||||||||||||||||||||||||||||
| 82 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||||||||||||||||||||||||||||
| 83 | # Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||||||||||||||||||||||||||||