blib/lib/Nagios/Passive/Role/Tempfile.pm

filter: Statementstmt 54.5% 12 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod n/a totaltotal 48.3% 15 / 31 CC 3 SCAR 17.7
CC
3
Cov
46%
_touch_file
12.0
_build_tempfile
2.0
BEGIN
1.0
CRAP 5.9
« blib/lib/Nagios/Passive/ResultPath.pm ↑ Summary Build »
1 package Nagios::Passive::Role::Tempfile;
2  
3 2 ▶use Any::Moose 'Role';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use File::Temp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Fcntl qw/:DEFAULT :flock/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 requires 'checkresults_dir';
8  
9 2 has 'tempfile' => ( is => 'ro', isa => 'File::Temp', lazy_build => 1);
10  
11 sub _build_tempfile {
12 0 ▶ my $self = shift;
Subroutine _build_tempfile: not called CC=1 SCAR=6.9
13 0 my $fh = File::Temp->new(
14 TEMPLATE => "cXXXXXX",
15 DIR => $self->checkresults_dir,
16 );
17 0 $fh->unlink_on_destroy(0);
18 0 return $fh;
19 }
20  
21 sub _touch_file {
22 0 ▶ my $self = shift;
Subroutine _touch_file: not called CC=3 SCAR=24.8
23 0 my $fh = $self->tempfile;
24 0 my $file = $fh->filename.".ok";
25 0 ▶ sysopen my $t,$file,O_WRONLY|O_CREAT|O_NONBLOCK|O_NOCTTY
Branch: 1 branch
BranchTrueFalseTotal
sysopen my $t, $file, 2369 or croak("Can't create $file : $!") 0 0 0
26 or croak("Can't create $file : $!");
27 0 ▶ close $t or croak("Can't close $file : $!");
Branch: 1 branch
BranchTrueFalseTotal
close $t or croak("Can't close $file : $!") 0 0 0
28 0 return;
29 }
30  
31 2 1;
32  
33 __END__
« blib/lib/Nagios/Passive/ResultPath.pm ↑ Summary Build »