Agent/Tag/String.pm

filter: Statementstmt 100% 21 / 21 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 50.0% 1 / 2 totaltotal 93.5% 29 / 31 CC 3 SCAR 6.9
CC
3
Cov
96%
make
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« Agent/File_Pool.pm ↑ Summary Agent/Tag/Priority.pm »
1 ###########################################################################
2 #
3 # String.pm
4 #
5 # Copyright (C) 1999 Raphael Manfredi.
6 # Copyright (C) 2002-2017 Mark Rogaski, mrogaski@cpan.org;
7 # all rights reserved.
8 #
9 # See the README file included with the
10 # distribution for license information.
11 #
12 ##########################################################################
13  
14 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 ########################################################################
17 package Log::Agent::Tag::String;
18  
19 2 require Log::Agent::Tag;
20 2 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 @ISA = qw(Log::Agent::Tag);
22  
23 #
24 # ->make
25 #
26 # Creation routine.
27 #
28 # Calling arguments: a hash table list.
29 #
30 # The keyed argument list may contain:
31 # -POSTFIX whether to postfix log message or prefix it.
32 # -SEPARATOR separator string to use between tag and message
33 # -NAME tag's name (optional)
34 # -VALUE string value to use
35 #
36 # Attributes:
37 # string the string value
38 #
39 7 ▶sub make {
Subroutine make: called CC=3 SCAR=11.0
Pod undocumented
40 7 my $self = bless {}, shift;
41 7 my (%args) = @_;
42 7 my ($name, $postfix, $separator, $value);
43  
44 7 my %set = (
45 -name => \$name,
46 -value => \$value,
47 -postfix => \$postfix,
48 -separator => \$separator,
49 );
50  
51 7 ▶ while (my ($arg, $val) = each %args) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %args) 23 7 30
52 23 my $vset = $set{lc($arg)};
53 23 ▶ next unless ref $vset;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $vset 0 23 23
54 23 $$vset = $val;
55 }
56  
57 7 $self->_init($name, $postfix, $separator);
58 7 $self->{string} = $value;
59  
60 7 return $self;
61 }
62  
63 #
64 # Defined routines
65 #
66  
67 8 ▶sub string { $_[0]->{'string'} }
Subroutine string: called CC=1 SCAR=0.0
Pod documented
68  
69 2 1; # for "require"
70 __END__
« Agent/File_Pool.pm ↑ Summary Agent/Tag/Priority.pm »