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 16     16   83779 use 5.006;
  16         66  
4 16     16   114 use strict;
  16         110  
  16         487  
5 16     16   108 use warnings;
  16         37  
  16         930  
6              
7             our $VERSION = '0.002';
8              
9 16     16   1049 use Class::Tiny 1 qw(name xtf);
  16         3767  
  16         117  
10              
11 16     16   6917 use Role::Tiny::With ();
  16         5284  
  16         380  
12              
13             Role::Tiny::With::with 'XT::Files::Role::Logger';
14              
15 16     16   82 use Carp ();
  16         29  
  16         210  
16 16     16   71 use Scalar::Util ();
  16         30  
  16         2856  
17              
18             sub BUILD {
19 46     46 0 19638 my ( $self, $args ) = @_;
20              
21 46         1326 my $xtf = $self->xtf;
22 46 100       1721 Carp::croak 'xtf attribute required' if !defined $xtf;
23 40 100 66     1068 Carp::croak q{'xtf' is not of class 'XT::Files'} if !defined Scalar::Util::blessed($xtf) || !$xtf->isa('XT::Files');
24              
25 35 100       710 if ( !defined $self->name ) {
26 33         780 $self->name( Scalar::Util::blessed($self) );
27             }
28              
29 35         221 return;
30             }
31              
32             sub log_prefix {
33 14     14 0 2087 my ($self) = @_;
34              
35 14         345 return $self->name;
36             }
37              
38             1;
39              
40             __END__