| 1 | # | ||||||||||||||||||||
| 2 | # (c) Jan Gehring <jan.gehring@gmail.com> | ||||||||||||||||||||
| 3 | # | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | package Rex::Pkg::SunOS::pkg; | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | ▶ | use v5.14.4; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 1 | our $VERSION = '1.16.1'; # VERSION | |||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 1 | ▶ | use Rex::Helper::Run; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 1 | ▶ | use Rex::Commands::File; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | 1 | ▶ | use Rex::Pkg::SunOS; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 1 | ▶ | use base qw(Rex::Pkg::SunOS); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 19 | 0 | my $that = shift; | |||||||||||||||||||
| 20 | 0 | ▶ | my $proto = ref($that) || $that; | ||||||||||||||||||
|
Condition0%0/3
ref $that || $that
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table0%0/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||
| 21 | 0 | my $self = $proto->SUPER::new(@_); | |||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 0 | bless( $self, $proto ); | |||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | $self->{commands} = { | ||||||||||||||||||||
| 26 | 0 | install => 'pkg install -q --accept %s', | |||||||||||||||||||
| 27 | install_version => 'pkg install -q --accept %s', | ||||||||||||||||||||
| 28 | remove => 'pkg uninstall -r -q %s', | ||||||||||||||||||||
| 29 | update_package_db => 'pkg refresh', | ||||||||||||||||||||
| 30 | }; | ||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 0 | return $self; | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 0 | ▶ | sub get_installed { | ||||||||||||||||||
|
Subroutine
get_installed: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||
| 36 | 0 | my ($self) = @_; | |||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 0 | my @lines = i_run "pkg info -l"; | |||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 0 | my @pkg; | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | my ( $version, $name ); | |||||||||||||||||||
| 43 | 0 | for my $line (@lines) { | |||||||||||||||||||
| 44 | 0 | ▶ | if ( $line =~ m/^$/ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 45 | 0 | push( | |||||||||||||||||||
| 46 | @pkg, | ||||||||||||||||||||
| 47 | { | ||||||||||||||||||||
| 48 | name => $name, | ||||||||||||||||||||
| 49 | version => $version, | ||||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||
| 52 | 0 | next; | |||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 0 | ▶ | if ( $line =~ m/Name: .*\/(.*?)$/ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 56 | 0 | $name = $1; | |||||||||||||||||||
| 57 | 0 | next; | |||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | 0 | ▶ | if ( $line =~ m/Version: (.*)$/ ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 61 | 0 | $version = $1; | |||||||||||||||||||
| 62 | 0 | next; | |||||||||||||||||||
| 63 | } | ||||||||||||||||||||
| 64 | } | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | 0 | return @pkg; | |||||||||||||||||||
| 67 | } | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | 1 | 1; | |||||||||||||||||||