| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Enbld::Target::Attribute::VersionCondition; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 3 |  |  | 3 |  | 12186 | use strict; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 108 |  | 
| 4 | 3 |  |  | 3 |  | 15 | use warnings; | 
|  | 3 |  |  |  |  | 8 |  | 
|  | 3 |  |  |  |  | 117 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 3 |  |  | 3 |  | 15 | use Carp; | 
|  | 3 |  |  |  |  | 6 |  | 
|  | 3 |  |  |  |  | 245 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 | 3 |  |  | 3 |  | 701 | use parent qw/Enbld::Target::AttributeExtension::Word/; | 
|  | 3 |  |  |  |  | 310 |  | 
|  | 3 |  |  |  |  | 20 |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | sub initialize { | 
| 11 | 45 |  |  | 45 | 0 | 106 | my ( $self, $param ) = @_; | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 45 | 100 |  |  |  | 134 | if ( ! defined $param ) { | 
| 14 | 3 |  |  |  |  | 27 | $self->{value} = 'latest'; | 
| 15 | 3 |  |  |  |  | 8 | $self->{is_evaluated}++; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 3 |  |  |  |  | 9 | return $self; | 
| 18 |  |  |  |  |  |  | } | 
| 19 |  |  |  |  |  |  |  | 
| 20 | 42 | 100 |  |  |  | 123 | if ( $param ) { | 
| 21 | 41 |  |  |  |  | 1086 | $self->SUPER::initialize( $param ); | 
| 22 | 41 |  |  |  |  | 109 | return $self; | 
| 23 |  |  |  |  |  |  | } | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 1 |  |  |  |  | 4 | require Enbld::Exception; | 
| 26 | 1 |  |  |  |  | 2 | my $err = "Attribute 'VersionCondition' isn't defined"; | 
| 27 | 1 |  |  |  |  | 7 | croak( Enbld::Exception->new( $err )); | 
| 28 |  |  |  |  |  |  | } | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub validate { | 
| 31 | 84 |  |  | 84 | 0 | 118 | my ( $self, $string ) = @_; | 
| 32 |  |  |  |  |  |  |  | 
| 33 | 84 |  |  |  |  | 281 | $self->SUPER::validate( $string ); | 
| 34 |  |  |  |  |  |  |  | 
| 35 | 82 | 100 |  |  |  | 309 | return $string if ( $string eq 'latest' ); | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 60 |  |  |  |  | 348 | my $allowed = $self->{attributes}->AllowedCondition; | 
| 38 | 60 | 100 | 100 |  |  | 201 | return $string if ( $allowed and ( $string eq $allowed ) ); | 
| 39 |  |  |  |  |  |  |  | 
| 40 | 59 |  |  |  |  | 456 | my $form = $self->{attributes}->VersionForm; | 
| 41 | 59 | 100 |  |  |  | 677 | return $string if ( $string =~ /^$form$/ ); | 
| 42 |  |  |  |  |  |  |  | 
| 43 | 2 |  |  |  |  | 6 | my $err = "Invalid Version Condition:$string," . | 
| 44 |  |  |  |  |  |  | " please check install condition"; | 
| 45 | 2 |  |  |  |  | 788 | require Enbld::Error; | 
| 46 | 2 |  |  |  |  | 8 | die( Enbld::Error->new( $err )); | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | 1; |