File Coverage

blib/lib/Algorithm/DependencySolver/Operation.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package Algorithm::DependencySolver::Operation;
2             $Algorithm::DependencySolver::Operation::VERSION = '1.01';
3 4     4   139643 use Moose;
  4         1427618  
  4         33  
4              
5             =head1 NAME
6              
7             Algorithm::DependencySolver::Operation - An operation representation
8              
9             =head1 VERSION
10              
11             version 1.01
12              
13             =head1 SYNOPSIS
14              
15             my $operation = Algorithm::DependencySolver::Operation->new(
16             id => 2,
17             depends => [qw(x)],
18             affects => [qw(y)],
19             prerequisites => [1],
20             obj => $whatever
21             );
22              
23             =head1 OPTIONAL ATTRIBUTES
24              
25             =head2 obj
26              
27             An arbitrary object, which is never used by anything in the C<Algorithm::DependencySolver::*> namespace.
28              
29             =cut
30              
31             has 'obj' => (
32             is => 'rw',
33             );
34              
35              
36             =head2 prerequisites
37              
38             An arrayref of other Operation objects, identified by their id strings.
39              
40             If an operation C<$b> depends on operation <C$a>, then any cycle which
41             would have resulted in C<$b> running before C<$a> will be broken just
42             before operation C<$a>.
43              
44             That is, if there exists a cycle containing both C<$a> and C<$b>, then
45             edge C<$e> will be removed, where C<$e> is any edge within the cycle
46             which points directly to C<$a>.
47              
48             =cut
49              
50             has 'prerequisites' => (
51             is => 'rw',
52             default => sub { [] },
53             );
54              
55             =head2 id
56              
57             A string which uniquely identifies this operation
58              
59             =cut
60              
61             has 'id' => (
62             is => 'rw',
63             );
64              
65             =head2 depends
66              
67             An arrayref of resources (each resource is simply a string identifier) that
68             this operation depends on.
69              
70             =cut
71              
72             has 'depends' => (
73             is => 'rw',
74             default => sub { [] },
75             );
76              
77             =head2 affects
78              
79             An arrayref of resources (each resource is simply a string identifier)
80             that this operation affects (i.e., modifies).
81              
82             =cut
83              
84             has 'affects' => (
85             is => 'rw',
86             # isa => 'ArrayRef[String]',
87             default => sub { [] },
88             );
89              
90 4     4   27178 no Moose;
  4         9  
  4         21  
91             __PACKAGE__->meta->make_immutable;