| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Algorithm::Dependency::Item; | 
| 2 |  |  |  |  |  |  | # ABSTRACT: Implements an item in a dependency hierarchy. | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | #pod =pod | 
| 5 |  |  |  |  |  |  | #pod | 
| 6 |  |  |  |  |  |  | #pod =head1 DESCRIPTION | 
| 7 |  |  |  |  |  |  | #pod | 
| 8 |  |  |  |  |  |  | #pod The Algorithm::Dependency::Item class implements a single item within the | 
| 9 |  |  |  |  |  |  | #pod dependency hierarchy. It's quite simple, usually created from within a source, | 
| 10 |  |  |  |  |  |  | #pod and not typically created directly. This is provided for those implementing | 
| 11 |  |  |  |  |  |  | #pod their own source. ( See L for details ). | 
| 12 |  |  |  |  |  |  | #pod | 
| 13 |  |  |  |  |  |  | #pod =head1 METHODS | 
| 14 |  |  |  |  |  |  | #pod | 
| 15 |  |  |  |  |  |  | #pod =cut | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 8 |  |  | 8 |  | 144 | use 5.005; | 
|  | 8 |  |  |  |  | 30 |  | 
| 18 | 8 |  |  | 8 |  | 56 | use strict; | 
|  | 8 |  |  |  |  | 18 |  | 
|  | 8 |  |  |  |  | 178 |  | 
| 19 | 8 |  |  | 8 |  | 43 | use Algorithm::Dependency (); | 
|  | 8 |  |  |  |  | 17 |  | 
|  | 8 |  |  |  |  | 1418 |  | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | our $VERSION = '1.112'; | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | ##################################################################### | 
| 25 |  |  |  |  |  |  | # Constructor | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | #pod =pod | 
| 28 |  |  |  |  |  |  | #pod | 
| 29 |  |  |  |  |  |  | #pod =head2 new $id, @depends | 
| 30 |  |  |  |  |  |  | #pod | 
| 31 |  |  |  |  |  |  | #pod The C constructor takes as its first argument the id ( name ) of the | 
| 32 |  |  |  |  |  |  | #pod item, and any further arguments are assumed to be the ids of other items that | 
| 33 |  |  |  |  |  |  | #pod this one depends on. | 
| 34 |  |  |  |  |  |  | #pod | 
| 35 |  |  |  |  |  |  | #pod Returns a new C on success, or C | 
| 36 |  |  |  |  |  |  | #pod on error. | 
| 37 |  |  |  |  |  |  | #pod | 
| 38 |  |  |  |  |  |  | #pod =cut | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | sub new { | 
| 41 | 100 |  |  | 100 | 1 | 156 | my $class = shift; | 
| 42 | 100 | 50 | 33 |  |  | 456 | my $id    = (defined $_[0] and ! ref $_[0] and $_[0] ne '') ? shift : return undef; | 
| 43 | 100 |  |  |  |  | 437 | bless { id => $id, depends => [ @_ ] }, $class; | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | #pod =pod | 
| 47 |  |  |  |  |  |  | #pod | 
| 48 |  |  |  |  |  |  | #pod =head2 id | 
| 49 |  |  |  |  |  |  | #pod | 
| 50 |  |  |  |  |  |  | #pod The C method returns the id of the item. | 
| 51 |  |  |  |  |  |  | #pod | 
| 52 |  |  |  |  |  |  | #pod =cut | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 111 |  |  | 111 | 1 | 1518 | sub id { $_[0]->{id} } | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | #pod =pod | 
| 57 |  |  |  |  |  |  | #pod | 
| 58 |  |  |  |  |  |  | #pod =head2 depends | 
| 59 |  |  |  |  |  |  | #pod | 
| 60 |  |  |  |  |  |  | #pod The C method returns, as a list, the names of the other items that | 
| 61 |  |  |  |  |  |  | #pod this item depends on. | 
| 62 |  |  |  |  |  |  | #pod | 
| 63 |  |  |  |  |  |  | #pod =cut | 
| 64 |  |  |  |  |  |  |  | 
| 65 | 867 |  |  | 867 | 1 | 1155 | sub depends { @{$_[0]->{depends}} } | 
|  | 867 |  |  |  |  | 2162 |  | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | 1; | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | __END__ |