File Coverage

blib/lib/Pg/CLI/Role/Executable.pm
Criterion Covered Total %
statement 12 16 75.0
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod n/a
total 16 23 69.5


line stmt bran cond sub pod time code
1             package Pg::CLI::Role::Executable;
2             {
3             $Pg::CLI::Role::Executable::VERSION = '0.11';
4             }
5              
6 6     6   3345 use Moose::Role;
  6         11  
  6         47  
7              
8 6     6   21231 use namespace::autoclean;
  6         10  
  6         42  
9              
10 6     6   2830 use File::Which qw( which );
  6         4578  
  6         369  
11 6     6   31 use MooseX::Types::Moose qw( Str );
  6         7  
  6         54  
12              
13             has executable => (
14             is => 'ro',
15             isa => Str,
16             builder => '_build_executable',
17             );
18              
19             sub _build_executable {
20 0     0     my $self = shift;
21              
22 0           my ($bin) = ( ref $self ) =~ /Pg::CLI::(\w+)/;
23              
24 0           my $path = which($bin);
25              
26 0 0         die "Cannot find $bin in your path"
27             unless $path;
28             }
29              
30             1;