| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Enbld::Definition; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 3 |  |  | 3 |  | 940 | use strict; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 122 |  | 
| 4 | 3 |  |  | 3 |  | 17 | use warnings; | 
|  | 3 |  |  |  |  | 7 |  | 
|  | 3 |  |  |  |  | 111 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 3 |  |  | 3 |  | 3137 | use Module::Load::Conditional qw/can_load/; | 
|  | 3 |  |  |  |  | 100646 |  | 
|  | 3 |  |  |  |  | 1100 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | require Enbld::Error; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | sub new { | 
| 11 | 48 |  |  | 48 | 1 | 1226 | my $class = shift; | 
| 12 | 48 |  |  |  |  | 69 | my $name = shift; | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 48 |  |  |  |  | 2936 | my $self = { | 
| 15 |  |  |  |  |  |  | defined => { | 
| 16 |  |  |  |  |  |  | DefaultArgument     =>  undef, | 
| 17 |  |  |  |  |  |  | DarwinArgument      =>  undef, | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | AdditionalArgument  =>  undef, | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | AllowedCondition    =>  undef, | 
| 22 |  |  |  |  |  |  | ArchiveName         =>  undef, | 
| 23 |  |  |  |  |  |  | CopyFiles           =>  undef, | 
| 24 |  |  |  |  |  |  | Dependencies        =>  undef, | 
| 25 |  |  |  |  |  |  | DistName            =>  undef, | 
| 26 |  |  |  |  |  |  | DownloadSite        =>  undef, | 
| 27 |  |  |  |  |  |  | Extension           =>  undef, | 
| 28 |  |  |  |  |  |  | Filename            =>  undef, | 
| 29 |  |  |  |  |  |  | IndexParserForm     =>  undef, | 
| 30 |  |  |  |  |  |  | IndexSite           =>  undef, | 
| 31 |  |  |  |  |  |  | PatchFiles          =>  undef, | 
| 32 |  |  |  |  |  |  | Prefix              =>  undef, | 
| 33 |  |  |  |  |  |  | URL                 =>  undef, | 
| 34 |  |  |  |  |  |  | SortedVersionList   =>  undef, | 
| 35 |  |  |  |  |  |  | Version             =>  undef, | 
| 36 |  |  |  |  |  |  | VersionList         =>  undef, | 
| 37 |  |  |  |  |  |  | #           VersionCondition    =>  undef, | 
| 38 |  |  |  |  |  |  | VersionForm         =>  undef, | 
| 39 |  |  |  |  |  |  | WebSite             =>  undef, | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | TestAction          =>  undef, | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | CommandConfigure    =>  undef, | 
| 44 |  |  |  |  |  |  | CommandMake         =>  undef, | 
| 45 |  |  |  |  |  |  | CommandTest         =>  undef, | 
| 46 |  |  |  |  |  |  | CommandInstall      =>  undef, | 
| 47 |  |  |  |  |  |  | }, | 
| 48 |  |  |  |  |  |  | }; | 
| 49 |  |  |  |  |  |  |  | 
| 50 | 48 |  |  |  |  | 269 | my $module = 'Enbld::Definition::' . ucfirst( $name ); | 
| 51 |  |  |  |  |  |  |  | 
| 52 | 48 | 100 |  |  |  | 530 | can_load( modules => { $module => 0 } ) or | 
| 53 |  |  |  |  |  |  | die( Enbld::Error->new( "no definition for target '$name'" )); | 
| 54 |  |  |  |  |  |  |  | 
| 55 | 47 |  |  |  |  | 20515 | bless $self, $module; | 
| 56 |  |  |  |  |  |  |  | 
| 57 | 47 |  |  |  |  | 6274 | $self->initialize; | 
| 58 |  |  |  |  |  |  |  | 
| 59 | 47 |  |  |  |  | 1005 | return $self; | 
| 60 |  |  |  |  |  |  | } | 
| 61 |  |  |  |  |  |  |  | 
| 62 | 47 |  |  | 47 | 0 | 516 | sub initialize { | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | # do nothing ... virtual method | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | } | 
| 67 |  |  |  |  |  |  |  | 
| 68 |  |  |  |  |  |  | sub parse { | 
| 69 | 46 |  |  | 46 | 1 | 85 | my $self = shift; | 
| 70 |  |  |  |  |  |  |  | 
| 71 | 46 |  |  |  |  | 1056 | require Enbld::Target::AttributeCollector; | 
| 72 | 46 |  |  |  |  | 543 | my $attributes = Enbld::Target::AttributeCollector->new; | 
| 73 |  |  |  |  |  |  |  | 
| 74 | 46 |  |  |  |  | 85 | foreach my $attribute ( keys %{ $self->{defined} } ) { | 
|  | 46 |  |  |  |  | 449 |  | 
| 75 | 1196 |  |  |  |  | 6002 | $attributes->add( $attribute, $self->{defined}{ $attribute } ); | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 | 46 |  |  |  |  | 459 | return $attributes; | 
| 79 |  |  |  |  |  |  | } | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | 1; | 
| 82 |  |  |  |  |  |  |  | 
| 83 |  |  |  |  |  |  | =pod | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | =head1 NAME | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | Enbld::Definition - stores target software' attributes. | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | require Enbld::Definition; | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | my $attributes = Enbld::Definition->new( 'git' )->parse; | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | $attributes->add( 'VersionCondition', '1.8.5' ); | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | $attributes->ArchiveName;  # git | 
| 98 |  |  |  |  |  |  | $attributes->Vesion;       # 1.8.5 | 
| 99 |  |  |  |  |  |  | $attributes->URL;      # http://git-core.googlecode.com/files/git-1.8.5.tar.gz | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | Enbld::Definition stores target software' attributes. | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | =head1 METHODS | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | =over 2 | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | =item new | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | my $def = Enbld::Definition->new( 'git' ); | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | Returns a new definition object for target software. | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | The return value is a Enbld::Definition::[target software] object. | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | When the definition module of the target software specified as the argument does not exist, undef is returned. | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | =item parse | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | my $def = Enbld::Definition->new( 'git' ); | 
| 122 |  |  |  |  |  |  | my $attributes = $def->parse; | 
| 123 |  |  |  |  |  |  | $attributes->ArchiveName; # -> git | 
| 124 |  |  |  |  |  |  | $attributes->Extension;   # -> tar.gz | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | Returns a new attributes collector for target software. | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | The return value is a Enbld::Target::AttributeCollector object. | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | =back | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | =head1 COPYRIGHT | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | copyright 2013- Magnolia C<<  >>. | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | =head1 LICENSE | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 139 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | =cut |