File Coverage

blib/lib/Log/ger/Format/Block.pm
Criterion Covered Total %
statement 29 29 100.0
branch 5 6 83.3
condition 1 3 33.3
subroutine 7 7 100.0
pod 0 1 0.0
total 42 46 91.3


line stmt bran cond sub pod time code
1             package Log::ger::Format::Block;
2              
3             our $DATE = '2017-08-01'; # DATE
4             our $VERSION = '0.005'; # VERSION
5              
6 1     1   86415 use strict;
  1         4  
  1         38  
7 1     1   6 use warnings;
  1         4  
  1         46  
8              
9 1     1   385 use Sub::Metadata qw(mutate_sub_prototype);
  1         704  
  1         189  
10              
11             sub get_hooks {
12 2     2 0 2279 my %conf = @_;
13              
14             return {
15             create_formatter => [
16             __PACKAGE__, 50,
17             sub {
18 3     3   769 [sub { my $code = shift; $code->(@_) }];
  2         1633  
  2         8  
19             }],
20              
21             before_install_routines => [
22             __PACKAGE__, 50,
23             sub {
24 1     1   10 no strict 'refs';
  1         4  
  1         264  
25              
26 3     3   5366 my %args = @_;
27 3         9 for my $r (@{ $args{routines} }) {
  3         13  
28 36         102 my ($coderef, $name, $lnum, $type) = @$r;
29 36 100       143 next unless $type =~ /\Alog_/;
30             # avoid prototype mismatch warning when redefining
31 18 50 33     70 if ($args{target} eq 'package' ||
32             $args{target} eq 'object') {
33 18 100       36 if (defined ${"$args{target_arg}\::"}{$name}) {
  18         90  
34 12         25 delete ${"$args{target_arg}\::"}{$name};
  12         104  
35             }
36             }
37 18         77 mutate_sub_prototype($coderef, '&');
38             }
39 3         36 [1];
40 2         35 }],
41             };
42             }
43              
44             1;
45             # ABSTRACT: Use formatting using block instead of sprintf-style
46              
47             __END__