1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
package Algorithm::Dependency::Item;
# ABSTRACT: Implements an item in a dependency hierarchy.
#pod =pod
#pod
#pod =head1 DESCRIPTION
#pod
#pod The Algorithm::Dependency::Item class implements a single item within the
#pod dependency hierarchy. It's quite simple, usually created from within a source,
#pod and not typically created directly. This is provided for those implementing
#pod their own source. ( See L<Algorithm::Dependency::Source> for details ).
#pod
#pod =head1 METHODS
#pod
#pod =cut
use 5.005;
use strict;
use Algorithm::Dependency ();
our $VERSION = '1.112';
#####################################################################
# Constructor
#pod =pod
#pod
#pod =head2 new $id, @depends
#pod
#pod The C<new> constructor takes as its first argument the id ( name ) of the
#pod item, and any further arguments are assumed to be the ids of other items that
#pod this one depends on.
#pod
#pod Returns a new C<Algorithm::Dependency::Item> on success, or C<undef>
#pod on error.
#pod
#pod =cut
sub new {
my $class = shift;
my $id = (defined $_[0] and ! ref $_[0] and $_[0] ne '') ? shift : return undef;
bless { id => $id, depends => [ @_ ] }, $class;
}
#pod =pod
#pod
#pod =head2 id
#pod
#pod The C<id> method returns the id of the item.
#pod
#pod =cut
sub id { $_[0]->{id} }
#pod =pod
#pod
#pod =head2 depends
#pod
#pod The C<depends> method returns, as a list, the names of the other items that
#pod this item depends on.
#pod
#pod =cut
sub depends { @{$_[0]->{depends}} }
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Algorithm::Dependency::Item - Implements an item in a dependency hierarchy.
=head1 VERSION
version 1.112
=head1 DESCRIPTION
The Algorithm::Dependency::Item class implements a single item within the
dependency hierarchy. It's quite simple, usually created from within a source,
and not typically created directly. This is provided for those implementing
their own source. ( See L<Algorithm::Dependency::Source> for details ).
=head1 METHODS
=head2 new $id, @depends
The C<new> constructor takes as its first argument the id ( name ) of the
item, and any further arguments are assumed to be the ids of other items that
this one depends on.
Returns a new C<Algorithm::Dependency::Item> on success, or C<undef>
on error.
=head2 id
The C<id> method returns the id of the item.
=head2 depends
The C<depends> method returns, as a list, the names of the other items that
this item depends on.
=head1 SEE ALSO
L<Algorithm::Dependency>
=head1 SUPPORT
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Algorithm-Dependency>
(or L<bug-Algorithm-Dependency@rt.cpan.org|mailto:bug-Algorithm-Dependency@rt.cpan.org>).
=head1 AUTHOR
Adam Kennedy <adamk@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2003 by Adam Kennedy.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|