blib/lib/ASPEER/MakeMaker/Markdown/Publish/MM.pm

filter: Statementstmt 55.5% 30 / 54 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 20 MC/DCmcdc 0.0% 0 / 11 Subroutinesub 81.8% 9 / 11 Podpod 100% 2 / 2 totaltotal 36.6% 41 / 112 CC 15 SCAR 38.4
CC
15
Cov
34%
const_config
72.0
publish
72.0
BEGIN
1.0
CRAP 46.4
↑ Summary blib/lib/ASPEER/MakeMaker/Markdown/Publish/MM/Constant.pm »
1 #
2 # This file is part of ASPEER::MakeMaker::Markdown::Publish.
3 #
4 # This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>.
5 #
6 # This is free software; you can redistribute it and/or modify it under
7 # the same terms as the Perl 5 programming language system itself.
8 #
9 # Full license text is available at:
10 #
11 # <http://dev.perl.org/licenses/>
12 #
13 package ASPEER::MakeMaker::Markdown::Publish::MM;
14  
15  
16 # Compiler pragma and package variables
17 #
18 2 ▶use strict qw(vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use vars qw($VERSION @ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22  
23 # Shared MakeMaker implementation and configuration
24 #
25 2 ▶use ASPEER::MakeMaker::MM ();
Subroutine BEGIN: called CC=1 SCAR=0.0
26 2 ▶use ASPEER::MakeMaker::MM::Import ();
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use ASPEER::MakeMaker::MM::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 2 ▶use ASPEER::MakeMaker::Markdown::Publish::MM::Constant ();
Subroutine BEGIN: called CC=1 SCAR=0.0
29 2 @ISA=qw(ASPEER::MakeMaker::MM);
30  
31  
32 # Configuration serialization stays inside the MakeMaker layer
33 #
34 2 ▶use JSON::PP qw(decode_json encode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
35 2 ▶use MIME::Base64 qw(decode_base64 encode_base64);
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37  
38 # Version information
39 #
40 2 $VERSION='1.003';
41  
42  
43 # Done
44 #
45 2 1;
46  
47  
48 #======================================================================================================================
49  
50 0 ▶sub const_config {
Subroutine const_config: not called CC=8 SCAR=42.8
Pod documented
51  
52  
53 # Retain the common MakeMaker behavior before adding this plugin's live
54 # x_documentation configuration to its private macro namespace.
55 #
56 0 my ($self, $mm_or, @param)=@_;
57 0 my $const_config=ASPEER::MakeMaker::MM::Import::const_config(
58 $self,
59 $mm_or,
60 @param
61 );
62 0 ▶ my $meta_hr=$mm_or->{'META_MERGE'} || {};
Condition0%0/2
$mm_or->{'META_MERGE'} || {}
l!l
00
MC/DC0%0/1
$mm_or->{'META_MERGE'} || {}
$mm_or->{'META_MERGE'}
Truth table0%0/2
A
A= $mm_or->{'META_MERGE'}
Aresult
11
00
63 0 my $documentation_hr=$meta_hr->{'x_documentation'};
64 0 ▶ if (defined($documentation_hr) && ref($documentation_hr) ne 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $documentation_hr and ref $documentation_hr ne "HASH") 0 0 0
Condition0%0/3
defined $documentation_hr and ref $documentation_hr ne "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $documentation_hr and ref $documentation_hr ne "HASH"
defined $documentation_hr ref $documentation_hr ne "HASH"
Truth table0%0/3
A and B
A= defined $documentation_hrB= ref $documentation_hr ne "HASH"
ABresult
0X0
100
111
65 0 die "META_MERGE.x_documentation must be a hash reference\n";
66 }
67 0 ▶ $documentation_hr={} unless defined($documentation_hr);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $documentation_hr 0 0 0
68 0 my $publish_hr=$documentation_hr->{'publish'};
69 0 ▶ if (defined($publish_hr) && ref($publish_hr) ne 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $publish_hr and ref $publish_hr ne "HASH") 0 0 0
Condition0%0/3
defined $publish_hr and ref $publish_hr ne "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $publish_hr and ref $publish_hr ne "HASH"
defined $publish_hr ref $publish_hr ne "HASH"
Truth table0%0/3
A and B
A= defined $publish_hrB= ref $publish_hr ne "HASH"
ABresult
0X0
100
111
70 0 die "META_MERGE.x_documentation.publish must be a hash reference\n";
71 }
72 0 ▶ $publish_hr={} unless defined($publish_hr);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $publish_hr 0 0 0
73 0 $mm_or->{'macro'}{'PUBLISH_CONFIG'}=encode_base64(encode_json($publish_hr), '');
74 0 return $const_config;
75  
76 }
77  
78  
79 0 ▶sub publish {
Subroutine publish: not called CC=8 SCAR=42.8
Pod documented
80  
81  
82 # Decode the Makefile-safe metadata payload and delegate the requested
83 # action without re-running Makefile.PL.
84 #
85 0 my ($self, $param_hr)=(shift(), arg(@_));
86 0 my ($encoded, $action)=@{$param_hr->{'ARGV_AR'}};
87 0 ▶ die "publication configuration unavailable\n"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $encoded and length $encoded 0 0 0
Condition0%0/3
defined $encoded and length $encoded
!ll&&!rl&&r
000
MC/DC0%0/2
defined $encoded and length $encoded
defined $encoded length $encoded
Truth table0%0/3
A and B
A= defined $encodedB= length $encoded
ABresult
0X0
100
111
88 unless defined($encoded) && length($encoded);
89 0 my $publish_hr=decode_json(decode_base64($encoded));
90 0 ▶ die "publication configuration must decode to a hash reference\n"
Branch: 1 branch
BranchTrueFalseTotal
unless ref $publish_hr eq "HASH" 0 0 0
91 unless ref($publish_hr) eq 'HASH';
92 0 ▶ if (!exists($publish_hr->{'name'}) &&
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $publish_hr->{"name"} || exists $publish_hr->{"config_file"} and defined $param_hr->{"NAME"} and length $param_hr->{"NAME"}) 0 0 0
Condition0%0/9
not exists $publish_hr->{"name"} || exists $publish_hr->{"config_file"} and defined $param_hr->{"NAME"} and length $param_hr->{"NAME"}
!ll&&!rl&&r
000
not exists $publish_hr->{"name"} || exists $publish_hr->{"config_file"} and defined $param_hr->{"NAME"}
!ll&&!rl&&r
000
exists $publish_hr->{'name'} || exists $publish_hr->{'config_file'}
l!l&&r!l&&!r
000
MC/DC0%0/4
not exists $publish_hr->{"name"} || exists $publish_hr->{"config_file"} and defined $param_hr->{"NAME"} and length $param_hr->{"NAME"}
exists $publish_hr->{'name'} exists $publish_hr->{'config_file'} defined $param_hr->{"NAME"} length $param_hr->{"NAME"}
Truth table0%0/5
not(A || B) and C and D
A= exists $publish_hr->{'name'}B= exists $publish_hr->{'config_file'}C= defined $param_hr->{"NAME"}D= length $param_hr->{"NAME"}
ABCDresult
1XXX0
01XX0
000X0
00100
00111
93 !exists($publish_hr->{'config_file'}) &&
94 defined($param_hr->{'NAME'}) && length($param_hr->{'NAME'})) {
95 0 $publish_hr->{'name'}=$param_hr->{'NAME'};
96 }
97 0 require Markdown::Publish;
98 0 my $publish_or=Markdown::Publish->new($publish_hr);
99 0 return $publish_or->run($action);
100  
101 }
102  
103 __END__
104  
105 =begin markdown
106  
107 # NAME
108  
109 ASPEER::MakeMaker::Markdown::Publish::MM - generated publication target dispatcher
110  
111 # DESCRIPTION
112  
113 This class implements the MakeMaker-specific portion of
114 `ASPEER::MakeMaker::Markdown::Publish`. It inherits the common MakeMaker helper,
115 encodes `META_MERGE.x_documentation.publish` into a private Makefile macro, and
116 delegates generated targets to `Markdown::Publish`.
117  
118 # METHODS
119  
120 ## const_config
121  
122 Calls the shared `ASPEER::MakeMaker` `const_config` implementation, validates
123 the `x_documentation` metadata shape, and stores the JSON publication hash as a
124 Makefile-safe Base64 value.
125  
126 ## publish
127  
128 Decodes the configuration passed by the generated target. When inline
129 configuration does not contain `name`, it uses the MakeMaker `NAME` as the
130 default site title. An external `config_file` remains authoritative. The method
131 then constructs `Markdown::Publish` and invokes the requested action on
132 the selected backend class.
133  
134 # SEE ALSO
135  
136 `ASPEER::MakeMaker::Markdown::Publish`, `Markdown::Publish`
137  
138 # AUTHOR
139  
140 Andrew Speer <andrew.speer@isolutions.com.au>
141  
142 # LICENSE and COPYRIGHT
143  
144 This file is part of ASPEER::MakeMaker::Markdown::Publish.
145  
146 This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>.
147  
148 This is free software; you can redistribute it and/or modify it under
149 the same terms as the Perl 5 programming language system itself.
150  
151 Full license text is available at:
152  
153 <http://dev.perl.org/licenses/>
154  
155  
156 =end markdown
157  
158  
159 =head1 NAME
160  
161 ASPEER::MakeMaker::Markdown::Publish::MM - generated publication target dispatcher
162  
163  
164 =head1 DESCRIPTION
165  
166 This class implements the MakeMaker-specific portion of
167 C<ASPEER::MakeMaker::Markdown::Publish>. It inherits the common MakeMaker helper,
168 encodes C<META_MERGE.x_documentation.publish> into a private Makefile macro, and
169 delegates generated targets to C<Markdown::Publish>.
170  
171  
172 =head1 METHODS
173  
174  
175 =head2 const_config
176  
177 Calls the shared C<ASPEER::MakeMaker> C<const_config> implementation, validates
178 the C<x_documentation> metadata shape, and stores the JSON publication hash as a
179 Makefile-safe Base64 value.
180  
181  
182 =head2 publish
183  
184 Decodes the configuration passed by the generated target. When inline
185 configuration does not contain C<name>, it uses the MakeMaker C<NAME> as the
186 default site title. An external C<config_file> remains authoritative. The method
187 then constructs C<Markdown::Publish> and invokes the requested action on
188 the selected backend class.
189  
190  
191 =head1 SEE ALSO
192  
193 C<ASPEER::MakeMaker::Markdown::Publish>, C<Markdown::Publish>
194  
195  
196 =head1 AUTHOR
197  
198 Andrew Speer L<mailto:andrew.speer@isolutions.com.au>
199  
200  
201 =head1 LICENSE AND COPYRIGHT
202  
203 This software is copyright (c) 2026 by Andrew Speer. It may be distributed
204 under the same terms as Perl itself.
205  
206 =cut
↑ Summary blib/lib/ASPEER/MakeMaker/Markdown/Publish/MM/Constant.pm »