line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::PPPort; |
2
|
|
|
|
|
|
|
# vi:noet:sts=2:sw=2:ts=2 |
3
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::PPPort::VERSION = '0.008'; |
4
|
1
|
|
|
1
|
|
2982964
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
5
|
|
|
|
|
|
|
with qw/Dist::Zilla::Role::FileGatherer Dist::Zilla::Role::PrereqSource Dist::Zilla::Role::AfterBuild/; |
6
|
1
|
|
|
1
|
|
6777
|
use Moose::Util::TypeConstraints 'enum'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
7
|
1
|
|
|
1
|
|
428
|
use MooseX::Types::Perl qw(StrictVersionStr); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
10
|
|
8
|
1
|
|
|
1
|
|
2854
|
use MooseX::Types::Stringlike 'Stringlike'; |
|
1
|
|
|
|
|
43164
|
|
|
1
|
|
|
|
|
7
|
|
9
|
1
|
|
|
1
|
|
3067
|
use Devel::PPPort 3.23; |
|
1
|
|
|
|
|
345
|
|
|
1
|
|
|
|
|
26
|
|
10
|
1
|
|
|
1
|
|
6
|
use File::Spec::Functions 'catdir'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
54
|
|
11
|
1
|
|
|
1
|
|
6
|
use File::pushd 'pushd'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
450
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has style => ( |
14
|
|
|
|
|
|
|
is => 'ro', |
15
|
|
|
|
|
|
|
isa => enum(['MakeMaker', 'ModuleBuild']), |
16
|
|
|
|
|
|
|
default => 'MakeMaker', |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has filename => ( |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
isa => Stringlike, |
22
|
|
|
|
|
|
|
lazy => 1, |
23
|
|
|
|
|
|
|
coerce => 1, |
24
|
|
|
|
|
|
|
default => sub { |
25
|
|
|
|
|
|
|
my $self = shift; |
26
|
|
|
|
|
|
|
if ($self->style eq 'MakeMaker') { |
27
|
|
|
|
|
|
|
return 'ppport.h'; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
elsif ($self->style eq 'ModuleBuild') { |
30
|
|
|
|
|
|
|
my @module_parts = split /-/, $self->zilla->name; |
31
|
|
|
|
|
|
|
return catdir('lib', @module_parts[0 .. $#module_parts - 1], 'ppport.h'); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
else { |
34
|
|
|
|
|
|
|
confess 'Invalid style for XS file generation'; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has version => ( |
40
|
|
|
|
|
|
|
is => 'ro', |
41
|
|
|
|
|
|
|
isa => StrictVersionStr, |
42
|
|
|
|
|
|
|
default => '3.23', |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub gather_files { |
46
|
2
|
|
|
2
|
0
|
128543
|
my $self = shift; |
47
|
2
|
|
|
|
|
62
|
Devel::PPPort->VERSION($self->version); |
48
|
2
|
|
|
|
|
591
|
require Dist::Zilla::File::InMemory; |
49
|
2
|
|
|
|
|
83000
|
$self->add_file(Dist::Zilla::File::InMemory->new( |
50
|
|
|
|
|
|
|
name => $self->filename, |
51
|
|
|
|
|
|
|
content => Devel::PPPort::GetFileContents($self->filename), |
52
|
|
|
|
|
|
|
encoding => 'ascii', |
53
|
|
|
|
|
|
|
)); |
54
|
2
|
|
|
|
|
3974
|
return; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub after_build { |
58
|
2
|
|
|
2
|
0
|
56334
|
my ($self, $args) = @_; |
59
|
2
|
|
|
|
|
7
|
my $build_root = $args->{build_root}; |
60
|
|
|
|
|
|
|
|
61
|
2
|
|
|
|
|
13
|
my $wd = pushd $build_root; |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
461
|
my $filename = $self->filename; |
64
|
|
|
|
|
|
|
|
65
|
2
|
|
100
|
|
|
66
|
my $perl_prereq = $self->zilla->prereqs->cpan_meta_prereqs |
66
|
|
|
|
|
|
|
->merged_requirements([ qw(configure build runtime test) ], ['requires']) |
67
|
|
|
|
|
|
|
->requirements_for_module('perl') || '5.006'; |
68
|
|
|
|
|
|
|
|
69
|
2
|
50
|
|
|
|
1247
|
if ($self->logger->get_debug) { |
70
|
0
|
|
|
|
|
0
|
chomp(my $out = `$^X $filename --compat-version=$perl_prereq`); |
71
|
0
|
0
|
|
|
|
0
|
$self->log_debug($out) if $out; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
else { |
74
|
2
|
|
|
|
|
182393
|
chomp(my $out = `$^X $filename --compat-version=$perl_prereq --quiet`); |
75
|
2
|
50
|
|
|
|
125
|
$self->log_debug($out) if $out; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub register_prereqs { |
80
|
2
|
|
|
2
|
0
|
5667
|
my $self = shift; |
81
|
2
|
|
|
|
|
66
|
$self->zilla->register_prereqs({ phase => 'develop' }, 'Devel::PPPort' => $self->version); |
82
|
2
|
|
|
|
|
1269
|
return; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
1
|
|
8
|
no Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
#ABSTRACT: PPPort for Dist::Zilla |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=pod |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=encoding UTF-8 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 NAME |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Dist::Zilla::Plugin::PPPort - PPPort for Dist::Zilla |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 VERSION |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
version 0.008 |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 SYNOPSIS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
In your dist.ini |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
[PPPort] |
112
|
|
|
|
|
|
|
filename = ppport.h ;default |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 DESCRIPTION |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This module adds a PPPort file to your distribution. By default it's called C<ppport.h>, but you can name differently. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 style |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
This affects the default value for the C<filename> attribute. It must be either C<MakeMaker> or C<ModuleBuild>, the former being the default. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 filename |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The filename of the ppport file. It defaults to F<ppport.h> if C<style> is C<MakeMaker>, and something module specific if C<style> is C<Module::Build>. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 version |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This describes the minimal version of Devel::PPPort required for this module. It currently defaults to C<3.23>. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=for Pod::Coverage gather_files |
133
|
|
|
|
|
|
|
register_prereqs |
134
|
|
|
|
|
|
|
after_build |
135
|
|
|
|
|
|
|
=end |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 AUTHOR |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Leon Timmermans <leont@cpan.org> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Leon Timmermans. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
146
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |