File Coverage

lib/XT/Files/Plugin.pm
Criterion Covered Total %
statement 29 29 100.0
branch 6 6 100.0
condition 2 3 66.6
subroutine 9 9 100.0
pod 0 2 0.0
total 46 49 93.8


line stmt bran cond sub pod time code
1             package XT::Files::Plugin;
2              
3 15     15   83947 use 5.006;
  15         72  
4 15     15   80 use strict;
  15         48  
  15         402  
5 15     15   112 use warnings;
  15         34  
  15         858  
6              
7             our $VERSION = '0.001';
8              
9 15     15   1004 use Class::Tiny 1 qw(name xtf);
  15         3795  
  15         141  
10              
11 15     15   6724 use Role::Tiny::With ();
  15         5317  
  15         344  
12              
13             Role::Tiny::With::with 'XT::Files::Role::Logger';
14              
15 15     15   72 use Carp ();
  15         66  
  15         204  
16 15     15   65 use Scalar::Util ();
  15         29  
  15         2431  
17              
18             sub BUILD {
19 44     44 0 19860 my ( $self, $args ) = @_;
20              
21 44         1243 my $xtf = $self->xtf;
22 44 100       1824 Carp::croak 'xtf attribute required' if !defined $xtf;
23 38 100 66     970 Carp::croak q{'xtf' is not of class 'XT::Files'} if !defined Scalar::Util::blessed($xtf) || !$xtf->isa('XT::Files');
24              
25 33 100       676 if ( !defined $self->name ) {
26 31         756 $self->name( Scalar::Util::blessed($self) );
27             }
28              
29 33         215 return;
30             }
31              
32             sub log_prefix {
33 14     14 0 2261 my ($self) = @_;
34              
35 14         379 return $self->name;
36             }
37              
38             1;
39              
40             __END__