line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Pg::CLI::Role::HasVersion; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$Pg::CLI::Role::HasVersion::VERSION = '0.11'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
2869
|
use Moose::Role; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
35
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
17421
|
use namespace::autoclean; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
36
|
|
9
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
288
|
use IPC::Run3 qw( run3 ); |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
253
|
|
11
|
5
|
|
|
5
|
|
19
|
use MooseX::Types::Moose qw( Str ); |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
37
|
|
12
|
5
|
|
|
5
|
|
17800
|
use Pg::CLI::pg_config; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
1346
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has version => ( |
15
|
|
|
|
|
|
|
is => 'ro', |
16
|
|
|
|
|
|
|
isa => Str, |
17
|
|
|
|
|
|
|
init_arg => '_version', # for testing |
18
|
|
|
|
|
|
|
lazy => 1, |
19
|
|
|
|
|
|
|
builder => '_build_version', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has two_part_version => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => Str, |
25
|
|
|
|
|
|
|
init_arg => undef, |
26
|
|
|
|
|
|
|
lazy => 1, |
27
|
|
|
|
|
|
|
builder => '_build_two_part_version', |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _build_version { |
31
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
0
|
my ( $output, $error ); |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
run3( |
36
|
|
|
|
|
|
|
[ $self->executable(), '--version' ], |
37
|
|
|
|
|
|
|
\undef, |
38
|
|
|
|
|
|
|
\$output, |
39
|
|
|
|
|
|
|
\$error, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
0
|
die $error if $error; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
0
|
return $1 if $output =~ /(\d\.\d\.\d)/; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub _build_two_part_version { |
48
|
12
|
|
|
12
|
|
20
|
my $self = shift; |
49
|
|
|
|
|
|
|
|
50
|
12
|
50
|
|
|
|
275
|
return $1 if $self->version() =~ /(\d\.\d)/; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |