| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: Iterates through distribution prerequisites |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Pinto::PrerequisiteWalker; |
|
4
|
|
|
|
|
|
|
|
|
5
|
51
|
|
|
51
|
|
104837
|
use Moose; |
|
|
51
|
|
|
|
|
1164887
|
|
|
|
51
|
|
|
|
|
377
|
|
|
6
|
51
|
|
|
51
|
|
330799
|
use MooseX::StrictConstructor; |
|
|
51
|
|
|
|
|
108444
|
|
|
|
51
|
|
|
|
|
444
|
|
|
7
|
51
|
|
|
51
|
|
177517
|
use MooseX::Types::Moose qw(CodeRef ArrayRef HashRef Bool); |
|
|
51
|
|
|
|
|
149957
|
|
|
|
51
|
|
|
|
|
522
|
|
|
8
|
51
|
|
|
51
|
|
265599
|
use MooseX::MarkAsMethods ( autoclean => 1 ); |
|
|
51
|
|
|
|
|
27501
|
|
|
|
51
|
|
|
|
|
447
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.13'; # VERSION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has start => ( |
|
17
|
|
|
|
|
|
|
is => 'ro', |
|
18
|
|
|
|
|
|
|
isa => 'Pinto::Schema::Result::Distribution', |
|
19
|
|
|
|
|
|
|
required => 1, |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has callback => ( |
|
23
|
|
|
|
|
|
|
is => 'ro', |
|
24
|
|
|
|
|
|
|
isa => CodeRef, |
|
25
|
|
|
|
|
|
|
required => 1, |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has filters => ( |
|
29
|
|
|
|
|
|
|
is => 'ro', |
|
30
|
|
|
|
|
|
|
isa => ArrayRef [CodeRef], |
|
31
|
|
|
|
|
|
|
predicate => 'has_filters', |
|
32
|
|
|
|
|
|
|
); |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has queue => ( |
|
35
|
|
|
|
|
|
|
isa => ArrayRef ['Pinto::Schema::Result::Prerequisite'], |
|
36
|
|
|
|
|
|
|
traits => [qw(Array)], |
|
37
|
|
|
|
|
|
|
handles => { enqueue => 'push', dequeue => 'shift' }, |
|
38
|
|
|
|
|
|
|
default => sub { return [ $_[0]->apply_filters( $_[0]->start->prerequisites ) ] }, |
|
39
|
|
|
|
|
|
|
init_arg => undef, |
|
40
|
|
|
|
|
|
|
lazy => 1, |
|
41
|
|
|
|
|
|
|
); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has seen => ( |
|
44
|
|
|
|
|
|
|
is => 'ro', |
|
45
|
|
|
|
|
|
|
isa => HashRef, |
|
46
|
|
|
|
|
|
|
default => sub { return { $_[0]->start->path => 1 } }, |
|
47
|
|
|
|
|
|
|
init_arg => undef, |
|
48
|
|
|
|
|
|
|
lazy => 1, |
|
49
|
|
|
|
|
|
|
); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
#----------------------------------------------------------------------------- |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub next { |
|
54
|
131
|
|
|
131
|
0
|
522
|
my ($self) = @_; |
|
55
|
|
|
|
|
|
|
|
|
56
|
131
|
100
|
|
|
|
5027
|
my $prereq = $self->dequeue or return; |
|
57
|
55
|
|
|
|
|
1605
|
my $dist = $self->callback->($prereq); |
|
58
|
|
|
|
|
|
|
|
|
59
|
50
|
100
|
|
|
|
43565
|
if ( defined $dist ) { |
|
60
|
37
|
|
|
|
|
263
|
my $path = $dist->path; |
|
61
|
37
|
|
|
|
|
4287
|
my @prereqs = $self->apply_filters( $dist->prerequisites ); |
|
62
|
37
|
100
|
|
|
|
1113
|
$self->enqueue(@prereqs) unless $self->seen->{$path}; |
|
63
|
37
|
|
|
|
|
1022
|
$self->seen->{$path} = 1; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
50
|
|
|
|
|
559
|
return $prereq; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub apply_filters { |
|
72
|
118
|
|
|
118
|
0
|
437236
|
my ( $self, @prereqs ) = @_; |
|
73
|
|
|
|
|
|
|
|
|
74
|
118
|
100
|
|
|
|
4995
|
return @prereqs if not $self->has_filters; |
|
75
|
|
|
|
|
|
|
|
|
76
|
112
|
|
|
|
|
311
|
for my $filter ( @{ $self->filters } ) { |
|
|
112
|
|
|
|
|
3223
|
|
|
77
|
218
|
|
|
|
|
726
|
@prereqs = grep { !$filter->($_) } @prereqs; |
|
|
104
|
|
|
|
|
552
|
|
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
112
|
|
|
|
|
3751
|
return @prereqs; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
|
88
|
|
|
|
|
|
|
1; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__END__ |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=pod |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=encoding UTF-8 |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=for :stopwords Jeffrey Ryan Thalhammer |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 NAME |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Pinto::PrerequisiteWalker - Iterates through distribution prerequisites |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 VERSION |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
version 0.13 |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 AUTHOR |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@stratopan.com> |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
115
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |