| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: Iterates through distribution prerequisites |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Pinto::PrerequisiteWalker; |
|
4
|
|
|
|
|
|
|
|
|
5
|
51
|
|
|
51
|
|
107121
|
use Moose; |
|
|
51
|
|
|
|
|
764079
|
|
|
|
51
|
|
|
|
|
405
|
|
|
6
|
51
|
|
|
51
|
|
322501
|
use MooseX::StrictConstructor; |
|
|
51
|
|
|
|
|
46300
|
|
|
|
51
|
|
|
|
|
457
|
|
|
7
|
51
|
|
|
51
|
|
167418
|
use MooseX::Types::Moose qw(CodeRef ArrayRef HashRef Bool); |
|
|
51
|
|
|
|
|
85028
|
|
|
|
51
|
|
|
|
|
633
|
|
|
8
|
51
|
|
|
51
|
|
251036
|
use MooseX::MarkAsMethods ( autoclean => 1 ); |
|
|
51
|
|
|
|
|
14694
|
|
|
|
51
|
|
|
|
|
454
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.14'; # 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
|
491
|
my ($self) = @_; |
|
55
|
|
|
|
|
|
|
|
|
56
|
131
|
100
|
|
|
|
4791
|
my $prereq = $self->dequeue or return; |
|
57
|
55
|
|
|
|
|
1634
|
my $dist = $self->callback->($prereq); |
|
58
|
|
|
|
|
|
|
|
|
59
|
50
|
100
|
|
|
|
42158
|
if ( defined $dist ) { |
|
60
|
37
|
|
|
|
|
276
|
my $path = $dist->path; |
|
61
|
37
|
|
|
|
|
4179
|
my @prereqs = $self->apply_filters( $dist->prerequisites ); |
|
62
|
37
|
100
|
|
|
|
1097
|
$self->enqueue(@prereqs) unless $self->seen->{$path}; |
|
63
|
37
|
|
|
|
|
977
|
$self->seen->{$path} = 1; |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
50
|
|
|
|
|
490
|
return $prereq; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub apply_filters { |
|
72
|
118
|
|
|
118
|
0
|
415548
|
my ( $self, @prereqs ) = @_; |
|
73
|
|
|
|
|
|
|
|
|
74
|
118
|
100
|
|
|
|
5178
|
return @prereqs if not $self->has_filters; |
|
75
|
|
|
|
|
|
|
|
|
76
|
112
|
|
|
|
|
301
|
for my $filter ( @{ $self->filters } ) { |
|
|
112
|
|
|
|
|
3226
|
|
|
77
|
218
|
|
|
|
|
770
|
@prereqs = grep { !$filter->($_) } @prereqs; |
|
|
104
|
|
|
|
|
486
|
|
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
|
|
80
|
112
|
|
|
|
|
3638
|
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.14 |
|
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 |