File: BuildUtilities.pm

package info (click to toggle)
libperl-critic-perl 1.156-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 3,544 kB
  • sloc: perl: 24,092; lisp: 341; makefile: 7
file content (196 lines) | stat: -rw-r--r-- 5,564 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
package Perl::Critic::BuildUtilities;

use 5.010001;
use strict;
use warnings;

use English q<-no_match_vars>;

our $VERSION = '1.126';

use Exporter 'import';

our @EXPORT_OK = qw<
    required_module_versions
    test_required_module_versions
    configure_required_module_versions
    emit_tar_warning_if_necessary
    get_PL_files
>;


use Devel::CheckOS qw< os_is >;


sub required_module_versions {
    return (
        'B::Keywords'                   => 1.23,
        'Carp'                          => 0,
        'Config::Tiny'                  => 2,
        'English'                       => 0,
        'Exception::Class'              => 1.23,
        'Exporter'                      => 5.63,
        'File::Basename'                => 0,
        'File::Find'                    => 0,
        'File::Path'                    => 0,
        'File::Spec'                    => 0,
        'File::Spec::Unix'              => 0,
        'File::Temp'                    => 0,
        'File::Which'                   => 0, # Only for PodSpelling
        'Getopt::Long'                  => 0,
        'List::SomeUtils'               => '0.55',
        'List::Util'                    => 0,
        'Module::Pluggable'             => 3.1,
        'PPI'                           => '1.277',
        'PPI::Document'                 => '1.277',
        'PPI::Document::File'           => '1.277',
        'PPI::Node'                     => '1.277',
        'PPI::Token::Quote::Single'     => '1.277',
        'PPI::Token::Whitespace'        => '1.277',
        'PPIx::QuoteLike'               => 0,
        'PPIx::Regexp'                  => '0.027', # Literal { deprecated in re
        'PPIx::Regexp::Util'            => '0.068', # is_ppi_regexp_element()
        'PPIx::Utils::Traversal'        => '0.003',
        'Perl::Tidy'                    => 0, # Only for RequireTidyCode
        'Pod::PlainText'                => 0,
        'Pod::Select'                   => 0,
        'Pod::Spell'                    => 1, # Only for PodSpelling
        'Pod::Usage'                    => 0,
        'Readonly'                      => 2.00,
        'Scalar::Util'                  => 0,
        'String::Format'                => '1.18',
        'Term::ANSIColor'               => '2.02',
        'Test::Builder'                 => 0.92,
        'Text::ParseWords'              => 3,
        'charnames'                     => 0,
        'overload'                      => 0,
        'parent'                        => 0,
        'perl'                          => 5.010001,
        'strict'                        => 0,
        'version'                       => 0.77,
        'warnings'                      => 0,
    );
}


sub test_required_module_versions {
    return (
        'Test::More'    => 0,
        'lib'           => 0,
    );
}


sub configure_required_module_versions {
    return (
        'B::Keywords'     => 1.23,
        'Carp'            => 0,
        'English'         => 0,
        'Exporter'        => '5.63',
        'List::SomeUtils' => '0.55',
        'Module::Build'   => '0.4204',
        'base'            => 0,
        'lib'             => 0,
    );
}


my @TARGET_FILES = qw<
    t/ControlStructures/ProhibitNegativeExpressionsInUnlessAndUntilConditions.run
    t/NamingConventions/Capitalization.run
    t/Variables/RequireLocalizedPunctuationVars.run
>;

sub get_PL_files {
    my %PL_files = map { ( "$_.PL" => $_ ) } @TARGET_FILES;

    return \%PL_files;
}

sub emit_tar_warning_if_necessary {
    if ( os_is( qw<Solaris> ) ) {
        print <<'END_OF_TAR_WARNING';
NOTE: tar(1) on some Solaris systems cannot deal well with long file
names.

If you get warnings about missing files below, please ensure that you
extracted the Perl::Critic tarball using GNU tar.

END_OF_TAR_WARNING
    }
}




1;

__END__

=head1 NAME

Perl::Critic::BuildUtilities - Common bits of compiling Perl::Critic.


=head1 DESCRIPTION

Various utilities used in assembling Perl::Critic, primary for use by
*.PL programs that generate code.


=head1 IMPORTABLE SUBROUTINES

=over

=item C<get_PL_files()>

Returns a reference to a hash with a mapping from the name of a .PL
program to an array of the parameters to be passed to it, suited for
use by L<Module::Build::API/"PL_files"> or
L<ExtUtils::MakeMaker/"PL_FILES">.  May print to C<STDOUT> messages
about what it is doing.


=item C<dump_unlisted_or_optional_module_versions()>

Prints to C<STDOUT> a list of all the unlisted (e.g. things in core
like L<Exporter|Exporter>), optional (e.g.
L<File::Which|File::Which>), or potentially indirect (e.g.
L<Readonly::XS|Readonly::XS>) dependencies, plus their versions, if
they're installed.


=item C<emit_tar_warning_if_necessary()>

On some Solaris systems, C<tar(1)> can't deal with long file names and
thus files are not correctly extracted from the tarball.  So this
prints a warning if the current system is Solaris.


=back


=head1 AUTHOR

Elliot Shank  C<< <perl@galumph.com> >>


=head1 LICENCE AND COPYRIGHT

Copyright (c) 2007-2023, Elliot Shank.

This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.  The full text of this license
can be found in the LICENSE file included with this module.

=cut

##############################################################################
# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 78
#   indent-tabs-mode: nil
#   c-indentation-style: bsd
# End:
# ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :