blib/lib/Test/Prereq/Build.pm

filter: Statementstmt 89.3% 42 / 47 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 73.3% 11 / 15 Podpod 83.3% 5 / 6 totaltotal 82.8% 58 / 70 CC 2 SCAR 5.9
CC
2
Cov
86%
prereq_ok
6.0
add_build_element
2.0
args
2.0
CRAP 1.8
« blib/lib/Test/Prereq.pm ↑ Summary testdir/build_pl/Build.PL »
1 package Test::Prereq::Build;
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 4 ▶use parent qw(Test::Prereq);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use vars qw($VERSION @EXPORT);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 4 ▶no warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 =encoding utf8
11  
12 =head1 NAME
13  
14 Test::Prereq::Build - test prerequisites in Module::Build scripts
15  
16 =head1 SYNOPSIS
17  
18 use Test::Prereq::Build;
19 prereq_ok();
20  
21 =cut
22  
23 4 $VERSION = '2.005';
24  
25 4 ▶use Module::Build;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 4 my $Test = __PACKAGE__->builder;
28  
29 =head1 METHODS
30  
31 If you have problems, send me your F<Build.PL>.
32  
33 This module overrides methods in C<Test::Prereq> to make it work with
34 C<Module::Build>.
35  
36 This module does not have any public methods. See L<Test::Prereq>.
37  
38 To make everything work out with C<Module::Build>, this module overrides
39 some methods to do nothing.
40  
41 =over 4
42  
43 =item create_build_script
44  
45 =item add_build_element
46  
47 =item args
48  
49 =item notes
50  
51 =back
52  
53 =head1 AUTHOR
54  
55 brian d foy, C<< <briandfoy@pobox.com> >>
56  
57 =head1 COPYRIGHT AND LICENSE
58  
59 Copyright © 2002-2025, brian d foy <briandfoy@pobox.com>. All rights reserved.
60  
61 This program is free software; you can redistribute it and/or modify
62 it under the same terms as Perl itself.
63  
64 =cut
65  
66  
67 sub import
68 2 ▶ {
Subroutine import: called CC=1 SCAR=0.0
69 2 my $self = shift;
70 2 my $caller = caller;
71 4 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
72 2 *{$caller.'::prereq_ok'} = \&prereq_ok;
73  
74 2 $Test->exported_to($caller);
75 2 $Test->plan(@_);
76 }
77  
78 sub prereq_ok
79 0 ▶ {
Subroutine prereq_ok: not called CC=2 SCAR=17.9
Pod documented
80 0 ▶ $Test->plan( tests => 1 ) unless $Test->has_plan;
Branch: 1 branch
BranchTrueFalseTotal
unless $Test->has_plan 0 0 0
81 0 __PACKAGE__->_prereq_check( @_ );
82 }
83  
84 1 ▶sub _master_file { 'Build.PL' }
Subroutine _master_file: called CC=1 SCAR=0.0
85  
86 # override Module::Build
87 1 ▶sub Module::Build::new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
88 1 my $class = shift;
89  
90 1 my %hash = @_;
91  
92 my @requires = sort grep $_ ne 'perl', (
93 1 keys %{ $hash{requires} },
94 1 keys %{ $hash{build_requires} },
95 1 keys %{ $hash{test_requires} },
96 1 keys %{ $hash{configure_requires} },
97 1 keys %{ $hash{recommends} },
98 );
99  
100 1 @Test::Prereq::prereqs = @requires;
101  
102 # intercept further calls to this object
103 1 return bless {}, __PACKAGE__;
104 }
105  
106 # fake Module::Build methods
107 1 ▶sub create_build_script { 1 };
Subroutine create_build_script: called CC=1 SCAR=0.0
Pod documented
108 0 ▶sub add_build_element { 1 };
Subroutine add_build_element: not called CC=1 SCAR=6.9
Pod documented
109 0 ▶sub args { 1 };
Subroutine args: not called CC=1 SCAR=6.9
Pod documented
110 0 ▶sub notes { 1 };
Subroutine notes: not called CC=1 SCAR=6.9
Pod documented
111  
112 4 1;
« blib/lib/Test/Prereq.pm ↑ Summary testdir/build_pl/Build.PL »