blib/lib/Future/AsyncAwait/ExtensionBuilder.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 34 CC 1 SCAR 6.9
CC
1
Cov
0%
write_AsyncAwait_h
2.0
extra_compiler_flags
2.0
extend_module_build
2.0
CRAP 2.0
1 # You may distribute under the terms of either the GNU General Public License
2 # or the Artistic License (the same terms as Perl itself)
3 #
4 # (C) Paul Evans, 2022-2024 -- leonerd@leonerd.org.uk
5  
6 package Future::AsyncAwait::ExtensionBuilder 0.71;
7  
8 use v5.14;
9 use warnings;
10  
11 =head1 NAME
12  
13 C<Future::AsyncAwait::ExtensionBuilder> - build-time support for extensions to C<Future::AsyncAwait>
14  
15 =head1 SYNOPSIS
16  
17 =for highlighter language=perl
18  
19 In F<Build.PL>:
20  
21 use Future::AsyncAwait::ExtensionBuilder;
22  
23 my $build = Module::Build->new(
24 ...,
25 configure_requires => {
26 ...
27 'Future::AsyncAwait::ExtensionBuilder' => 0,
28 }
29 );
30  
31 Future::AsyncAwait::ExtensionBuilder->extend_module_build( $build );
32  
33 ...
34  
35 =head1 DESCRIPTION
36  
37 This module provides a build-time helper to assist authors writing XS modules
38 that provide extensions to L<Future::AsyncAwait>. It prepares a
39 L<Module::Build>-using distribution to be able to make use of the
40 C<Future::AsyncAwait> extension API.
41  
42 =cut
43  
44 =head1 FUNCTIONS
45  
46 =cut
47  
48 =head2 write_AsyncAwait_h
49  
50 Future::AsyncAwait::ExtensionBuilder->write_AsyncAwait_h;
51  
52 This method no longer does anything I<since version 0.67>.
53  
54 =cut
55  
56 sub write_AsyncAwait_h
57 {
58 }
59  
60 =head2 extra_compiler_flags
61  
62 @flags = Future::AsyncAwait::ExtensionBuilder->extra_compiler_flags;
63  
64 Returns a list of extra flags that the build scripts should add to the
65 compiler invocation. This enables the C compiler to find the
66 F<AsyncAwait.h> file.
67  
68 =cut
69  
70 sub extra_compiler_flags
71 {
72 shift;
73  
74 require File::ShareDir;
75 require File::Spec;
76 require Future::AsyncAwait;
77 return "-I" . File::Spec->catdir( File::ShareDir::module_dir( "Future::AsyncAwait" ), "include" );
78 }
79  
80 =head2 extend_module_build
81  
82 Future::AsyncAwait::ExtensionBuilder->extend_module_build( $build );
83  
84 A convenient shortcut for performing all the tasks necessary to make a
85 L<Module::Build>-based distribution use the helper.
86  
87 =cut
88  
89 sub extend_module_build
90 {
91 my $self = shift;
92 my ( $build ) = @_;
93  
94 # preserve existing flags
95 my @flags = @{ $build->extra_compiler_flags };
96 push @flags, $self->extra_compiler_flags;
97  
98 $build->extra_compiler_flags( @flags );
99 }
100  
101 =head1 AUTHOR
102  
103 Paul Evans <leonerd@leonerd.org.uk>
104  
105 =cut
106  
107 0x55AA;