Dispatch/Handle.pm

filter: Statementstmt 100% 27 / 27 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 2 totaltotal 92.1% 35 / 38 CC 2 SCAR 2.3
CC
2
Cov
97%
log_message
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Dispatch/Screen.pm ↑ Summary Dispatch/Email/MIMELite.pm »
1 package Log::Dispatch::Handle;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '2.71';
7  
8 2 ▶use Log::Dispatch::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Params::ValidationCompiler qw( validation_for );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶use base qw( Log::Dispatch::Output );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 {
14 2 my $validator = validation_for(
15 params => { handle => { type => t('CanPrint') } },
16 slurpy => 1,
17 );
18  
19 1 ▶ sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
20 1 my $class = shift;
21 1 my %p = $validator->(@_);
22  
23 1 my $self = bless { handle => delete $p{handle} }, $class;
24 1 $self->_basic_init(%p);
25  
26 1 return $self;
27 }
28 }
29  
30 2 ▶sub log_message {
Subroutine log_message: called CC=2 SCAR=7.0
Pod undocumented
31 1 my $self = shift;
32 1 my %p = @_;
33  
34 $self->{handle}->print( $p{message} )
35 1 ▶ or die "Cannot write to handle: $!";
Branch: 1 branch
BranchTrueFalseTotal
$self->{"handle"}->print($p{"message"}) or die "Cannot write to handle: $!" 1 0 1
36 }
37  
38 2 1;
39  
40 # ABSTRACT: Object for logging to IO::Handle classes
41  
42 __END__
« Dispatch/Screen.pm ↑ Summary Dispatch/Email/MIMELite.pm »