| 1 | package VCS::Lite::Common; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 11 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 11 | our $VERSION = '0.11'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 11 | ▶ | our $username = $ENV{VCSLITE_USER} || $ENV{USER}; | ||||||||||||||||||||||||||
|
Condition33%1/3
$ENV{'VCSLITE_USER'} || $ENV{'USER'}
MC/DC0%0/2
$ENV{'VCSLITE_USER'} || $ENV{'USER'}
$ENV{'VCSLITE_USER'}
$ENV{'USER'}
Truth table33%1/3
A || B
A= $ENV{'VCSLITE_USER'}B= $ENV{'USER'}
| |||||||||||||||||||||||||||||
| 11 | 11 | our $default_store = 'Storable'; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 11 | ▶ | use File::Spec::Functions qw(splitpath splitdir); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | #---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | sub path { | ||||||||||||||||||||||||||||
| 18 | 592 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
path: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 592 | ▶ | return $self->{path} unless @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 189 | my $newpath = shift; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 189 | ▶ | if ($self->{path} ne $newpath) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 6 | $self->{path} = $newpath; | |||||||||||||||||||||||||||
| 26 | 6 | $self->save; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | sub name { | ||||||||||||||||||||||||||||
| 31 | 22 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
name: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 32 | 22 | my ($vol, $dir, $fil) = splitpath($self->path); | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 22 | ▶ | $fil || (splitdir $dir)[-1]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | sub store { | ||||||||||||||||||||||||||||
| 38 | 140 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
store: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 140 | $self->{store}; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | sub save { | ||||||||||||||||||||||||||||
| 44 | 130 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||
|
Subroutine
save: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 130 | $self->store->save($self); | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | sub _mumble { | ||||||||||||||||||||||||||||
| 50 | 115 | ▶ | my ($self,$msg) = @_; | ||||||||||||||||||||||||||
|
Subroutine
_mumble: called CC=3 SCAR=11.7
| |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 115 | ▶ | print $msg,"\n" if exists($self->{verbose}) && $self->{verbose}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $self->{"verbose"} and $self->{"verbose"}
MC/DC0%0/2
exists $self->{"verbose"} and $self->{"verbose"}
exists $self->{"verbose"}
$self->{"verbose"}
Truth table66%2/3
A and B
A= exists $self->{"verbose"}B= $self->{"verbose"}
| |||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | sub latest { | ||||||||||||||||||||||||||||
| 56 | 174 | ▶ | my ($self,$base) = @_; | ||||||||||||||||||||||||||
|
Subroutine
latest: called CC=6 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 174 | ▶ | $base .= '.' if $base && $base =~ /\d$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$base and $base =~ /\d$/
MC/DC0%0/2
$base and $base =~ /\d$/
$base
$base =~ /\d$/
Truth table33%1/3
A and B
A= $baseB= $base =~ /\d$/
| |||||||||||||||||||||||||||||
| 59 | 174 | ▶ | $base ||= ''; | ||||||||||||||||||||||||||
|
Condition50%1/2
$base ||= ""
MC/DC0%0/1
$base ||= ""
$base
Truth table50%1/2
A
A= $base
| |||||||||||||||||||||||||||||
| 60 | 174 | ▶ | return 0 if !exists($self->{latest}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 61 | 53 | ▶ | $self->{latest}{$base} || 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | sub up_generation { | ||||||||||||||||||||||||||||
| 65 | 0 | ▶ | my ($self,$gen) = @_; | ||||||||||||||||||||||||||
|
Subroutine
up_generation: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | ▶ | $gen =~ s/\.0$// or $gen =~ s/([1-9]\d*)$/$1-1/e or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$gen =~ s/\.0$// or $gen =~ s/([1-9]\d*)$/$1 - 1;/e
MC/DC0%0/2
$gen =~ s/\.0$// or $gen =~ s/([1-9]\d*)$/$1 - 1;/e
$gen =~ s/\.0$//
$gen =~ s/([1-9]\d*)$/$1 - 1;/e
Truth table0%0/3
A or B
A= $gen =~ s/\.0$//B= $gen =~ s/([1-9]\d*)$/$1 - 1;/e
| |||||||||||||||||||||||||||||
| 68 | 0 | $gen; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | sub user { | ||||||||||||||||||||||||||||
| 72 | 162 | ▶ | my $obj = shift; | ||||||||||||||||||||||||||
|
Subroutine
user: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 73 | 162 | ▶ | @_ ? ($username = shift) : $username; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | sub default_store { | ||||||||||||||||||||||||||||
| 77 | 218 | ▶ | my $obj = shift; | ||||||||||||||||||||||||||
|
Subroutine
default_store: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||
| 78 | 218 | ▶ | @_ ? ($default_store = shift) : $default_store; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | sub parent { | ||||||||||||||||||||||||||||
| 82 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
parent: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 2 | ▶ | return unless exists $self->{parent}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 2 | $self->{parent_store}->retrieve($self->{parent}); | |||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 11 | 1; | |||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | __END__ | ||||||||||||||||||||||||||||