KiokuDB/Role/Verbosity.pm

filter: Statementstmt 92.3% 12 / 13 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 2 totaltotal 78.2% 18 / 23 CC 3 SCAR 5.7
CC
3
Cov
82%
v
2.3
BUILD
2.1
BEGIN
1.0
CRAP 1.8
« KiokuDB/LiveObjects/TXNScope.pm ↑ Summary KiokuDB/LiveObjects/Scope.pm »
1 #!/usr/bin/perl
2  
3 package KiokuDB::Role::Verbosity;
4 3 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 has verbose => (
9 isa => "Bool",
10 is => "ro",
11 );
12  
13 sub BUILD {
14 35 ▶ my $self = shift;
Subroutine BUILD: called CC=2 SCAR=7.2
Pod undocumented
15  
16 35 ▶ STDERR->autoflush(1) if $self->verbose;
Branch: 1 branch
BranchTrueFalseTotal
if $self->verbose 0 35 35
17 }
18  
19 sub v {
20 53 ▶ my $self = shift;
Subroutine v: called CC=2 SCAR=8.1
Pod undocumented
21 53 ▶ return unless $self->verbose;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->verbose 53 0 53
22  
23 0 STDERR->print(@_);
24 }
25  
26 3 __PACKAGE__
27  
28 __END__
29  
30 =pod
31  
32 =head1 NAME
33  
34 KiokuDB::Role::Verbosity - A role for printing diagnosis to STDERR
35  
36 =head1 SYNOPSIS
37  
38 $self->v("blah blah\n"); # only printed if $self->verbose is true
39  
40 =head1 DESCRIPTION
41  
42 This role provides the C<verbose> attribute and a C<v> method that you can use
43 to emit verbose output to C<STDERR>.
« KiokuDB/LiveObjects/TXNScope.pm ↑ Summary KiokuDB/LiveObjects/Scope.pm »