| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
3
|
|
|
3
|
|
9254707
|
use strict; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
91
|
|
|
2
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
214
|
|
|
3
|
|
|
|
|
|
|
# vim: set ts=8 sts=2 sw=2 tw=115 et : |
|
4
|
|
|
|
|
|
|
# ABSTRACT: Indicates in metadata the value of PERL_USE_UNSAFE_INC to use during installation |
|
5
|
|
|
|
|
|
|
# KEYWORDS: metadata PERL_USE_UNSAFE_INC INC distribution testing compatibility environment security |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.002'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Moose; |
|
10
|
3
|
|
|
3
|
|
19
|
with 'Dist::Zilla::Role::MetaProvider', |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
|
|
'Dist::Zilla::Role::AfterBuild', |
|
12
|
|
|
|
|
|
|
'Dist::Zilla::Role::BeforeRelease'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use namespace::autoclean; |
|
15
|
3
|
|
|
3
|
|
17400
|
|
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
25
|
|
|
16
|
|
|
|
|
|
|
has dot_in_INC => ( |
|
17
|
|
|
|
|
|
|
is => 'ro', isa => 'Bool', |
|
18
|
|
|
|
|
|
|
required => 1, |
|
19
|
|
|
|
|
|
|
); |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
around dump_config => sub |
|
22
|
|
|
|
|
|
|
{ |
|
23
|
|
|
|
|
|
|
my ($orig, $self) = @_; |
|
24
|
|
|
|
|
|
|
my $config = $self->$orig; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$config->{+__PACKAGE__} = { |
|
27
|
|
|
|
|
|
|
dot_in_INC => $self->dot_in_INC ? 1 : 0, |
|
28
|
|
|
|
|
|
|
blessed($self) ne __PACKAGE__ ? ( version => $VERSION ) : (), |
|
29
|
|
|
|
|
|
|
}; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
return $config; |
|
32
|
|
|
|
|
|
|
}; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
{ |
|
35
|
|
|
|
|
|
|
my $self = shift; |
|
36
|
|
|
|
|
|
|
+{ x_use_unsafe_inc => $self->dot_in_INC ? 1 : 0 }; |
|
37
|
6
|
|
|
6
|
0
|
11405
|
} |
|
38
|
6
|
100
|
|
|
|
211
|
|
|
39
|
|
|
|
|
|
|
{ |
|
40
|
|
|
|
|
|
|
my $self = shift; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# this is kind of kludgy but we just need to have this set before TestRunners run. |
|
43
|
6
|
|
|
6
|
0
|
90003
|
$self->log_debug([ 'Setting PERL_USE_UNSAFE_INC = %s for local testing...', $self->dot_in_INC ]); |
|
44
|
|
|
|
|
|
|
$ENV{PERL_USE_UNSAFE_INC} = $self->dot_in_INC; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
6
|
|
|
|
|
318
|
|
|
47
|
6
|
|
|
|
|
2188
|
{ |
|
48
|
|
|
|
|
|
|
my $self = shift; |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$self->log('DZIL_ANY_PERL set: skipping perl version check'), return |
|
51
|
|
|
|
|
|
|
if $ENV{DZIL_ANY_PERL}; |
|
52
|
6
|
|
|
6
|
0
|
536683
|
|
|
53
|
|
|
|
|
|
|
$self->log_fatal('Perl must be 5.025007 or newer to test with PERL_USE_UNSAFE_INC -- disable check with DZIL_ANY_PERL=1') |
|
54
|
|
|
|
|
|
|
if "$]" < 5.025007; |
|
55
|
6
|
100
|
|
|
|
110
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
4
|
100
|
|
|
|
82
|
__PACKAGE__->meta->make_immutable; |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=pod |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=encoding UTF-8 |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NAME |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Dist::Zilla::Plugin::UseUnsafeInc - Indicates in metadata the value of PERL_USE_UNSAFE_INC to use during installation |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 VERSION |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
version 0.002 |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
In your F<dist.ini>: |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
; this distribution still requires . to be in @INC |
|
77
|
|
|
|
|
|
|
[UseUnsafeInc] |
|
78
|
|
|
|
|
|
|
dot_in_INC = 1 |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
or: |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
; this distribution does not need . to be in @INC |
|
83
|
|
|
|
|
|
|
[UseUnsafeInc] |
|
84
|
|
|
|
|
|
|
dot_in_INC = 0 |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=for Pod::Coverage metadata after_build before_release |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This is a L<Dist::Zilla> plugin that populates the C<x_use_unsafe_inc> key in your distribution metadata. This |
|
91
|
|
|
|
|
|
|
indicates to components of the toolchain that C<PERL_USE_UNSAFE_INC> should be set to a certain value during |
|
92
|
|
|
|
|
|
|
installation and testing. If C<PERL_USE_UNSAFE_INC> has already been set in the environment, it is unchanged, but |
|
93
|
|
|
|
|
|
|
the metadata is respected at a higher precedence than any setting that other tools e.g. L<Test::Harness> might have |
|
94
|
|
|
|
|
|
|
done. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
The environment variable is also set in L<Dist::Zilla> while building and testing the distribution, to ensure |
|
97
|
|
|
|
|
|
|
that local testing behaves in an expected fashion. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Additionally, the release must be performed using a Perl version that supports C<PERL_USE_UNSAFE_INC> (that is, |
|
100
|
|
|
|
|
|
|
5.26), to further guarantee test integrity. To bypass this check, set C<DZIL_ANY_PERL=1> in the environment. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 CONFIGURATION OPTIONS |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 C<use_unsafe_inc> |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This configuration value must be set in your F<dist.ini>, to either 0 or 1. C<PERL_USE_UNSAFE_INC> will be set to |
|
107
|
|
|
|
|
|
|
the same value by tools that support it. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head2 C<DZIL_ANY_PERL> |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
When this environment variable is true, the Perl version check at release time (see above) is skipped. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 BACKGROUND |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=over 4 |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L<perl5260delta/'.' and @INC> |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L<Dist::Zilla::Plugin::EnsureLatestPerl> |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=back |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SUPPORT |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Plugin-UseUnsafeInc> |
|
132
|
|
|
|
|
|
|
(or L<bug-Dist-Zilla-Plugin-UseUnsafeInc@rt.cpan.org|mailto:bug-Dist-Zilla-Plugin-UseUnsafeInc@rt.cpan.org>). |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
There is also a mailing list available for users of this distribution, at |
|
135
|
|
|
|
|
|
|
L<http://dzil.org/#mailing-list>. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
There is also an irc channel available for users of this distribution, at |
|
138
|
|
|
|
|
|
|
L<C<#distzilla> on C<irc.perl.org>|irc://irc.perl.org/#distzilla>. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
I am also usually active on irc, as 'ether' at C<irc.perl.org> and C<irc.libera.chat>. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 AUTHOR |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Karen Etheridge. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
151
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=cut |