| 1 | package Enbld::Target::Attribute::VersionCondition; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use parent qw/Enbld::Target::AttributeExtension::Word/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | sub initialize { | ||||||||||||||||||||||||||||
| 11 | 45 | ▶ | my ( $self, $param ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
initialize: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 45 | ▶ | if ( ! defined $param ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 14 | 3 | $self->{value} = 'latest'; | |||||||||||||||||||||||||||
| 15 | 3 | $self->{is_evaluated}++; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 3 | return $self; | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 42 | ▶ | if ( $param ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 41 | $self->SUPER::initialize( $param ); | |||||||||||||||||||||||||||
| 22 | 41 | return $self; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | require Enbld::Exception; | |||||||||||||||||||||||||||
| 26 | 1 | my $err = "Attribute 'VersionCondition' isn't defined"; | |||||||||||||||||||||||||||
| 27 | 1 | croak( Enbld::Exception->new( $err )); | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | sub validate { | ||||||||||||||||||||||||||||
| 31 | 84 | ▶ | my ( $self, $string ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
validate: called CC=5 SCAR=16.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 84 | $self->SUPER::validate( $string ); | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 82 | ▶ | return $string if ( $string eq 'latest' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 60 | my $allowed = $self->{attributes}->AllowedCondition; | |||||||||||||||||||||||||||
| 38 | 60 | ▶ | return $string if ( $allowed and ( $string eq $allowed ) ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$allowed and $string eq $allowed
MC/DC100%2/2
$allowed and $string eq $allowed
$allowed
$string eq $allowed
Truth table100%3/3
A and B
A= $allowedB= $string eq $allowed
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 59 | my $form = $self->{attributes}->VersionForm; | |||||||||||||||||||||||||||
| 41 | 59 | ▶ | return $string if ( $string =~ /^$form$/ ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 2 | my $err = "Invalid Version Condition:$string," . | |||||||||||||||||||||||||||
| 44 | " please check install condition"; | ||||||||||||||||||||||||||||
| 45 | 2 | require Enbld::Error; | |||||||||||||||||||||||||||
| 46 | 2 | die( Enbld::Error->new( $err )); | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 3 | 1; | |||||||||||||||||||||||||||