File Coverage

blib/lib/Pg/CLI/Role/Executable.pm
Criterion Covered Total %
statement 18 22 81.8
branch 0 2 0.0
condition n/a
subroutine 6 7 85.7
pod n/a
total 24 31 77.4


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