| 1 | # | ||||||||||||
| 2 | # This file is part of ASPEER::MakeMaker::Markdown::Pod. | ||||||||||||
| 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 | |||||||||||||
| 14 | # | ||||||||||||
| 15 | |||||||||||||
| 16 | |||||||||||||
| 17 | # Pragma | ||||||||||||
| 18 | # | ||||||||||||
| 19 | package ASPEER::MakeMaker::Markdown::Pod::MM::Constant; | ||||||||||||
| 20 | 6 | ▶ | use strict qw(vars); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 21 | 6 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 22 | 6 | ▶ | use vars qw($VERSION @ISA %EXPORT_TAGS @EXPORT_OK @EXPORT %Constant); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 23 | |||||||||||||
| 24 | |||||||||||||
| 25 | # Modules we need | ||||||||||||
| 26 | # | ||||||||||||
| 27 | 6 | ▶ | use File::Spec; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 28 | 6 | ▶ | use File::Basename qw(dirname); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 29 | |||||||||||||
| 30 | |||||||||||||
| 31 | # Version information | ||||||||||||
| 32 | # | ||||||||||||
| 33 | 6 | $VERSION='1.012'; | |||||||||||
| 34 | |||||||||||||
| 35 | |||||||||||||
| 36 | # Get module file name and path, derive name of file to store local constants | ||||||||||||
| 37 | # | ||||||||||||
| 38 | 6 | ▶ | use Cwd qw(abs_path); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 39 | 6 | my $local_fn=abs_path(__FILE__) . '.local'; | |||||||||||
| 40 | |||||||||||||
| 41 | |||||||||||||
| 42 | # Hash of constants | ||||||||||||
| 43 | # | ||||||||||||
| 44 | %Constant=( | ||||||||||||
| 45 | |||||||||||||
| 46 | MM_PREFIX => 'MARKPOD', | ||||||||||||
| 47 | |||||||||||||
| 48 | TEMPLATE_POSTAMBLE_FN => | ||||||||||||
| 49 | File::Spec->catfile(dirname(abs_path(__FILE__)), 'postamble.inc'), | ||||||||||||
| 50 | |||||||||||||
| 51 | MARKPOD_PM => 'ASPEER::MakeMaker::Markdown::Pod::MM', | ||||||||||||
| 52 | |||||||||||||
| 53 | MARKPOD_PM_ARGV => join(',', qw[ | ||||||||||||
| 54 | "$(NAME)" | ||||||||||||
| 55 | "$(NAME_SYM)" | ||||||||||||
| 56 | "$(DISTNAME)" | ||||||||||||
| 57 | "$(DISTVNAME)" | ||||||||||||
| 58 | "$(VERSION)" | ||||||||||||
| 59 | "$(VERSION_SYM)" | ||||||||||||
| 60 | "$(VERSION_FROM)" | ||||||||||||
| 61 | "$(LICENSE)" | ||||||||||||
| 62 | "$(AUTHOR)" | ||||||||||||
| 63 | "$(TO_INST_PM)" | ||||||||||||
| 64 | "$(EXE_FILES)" | ||||||||||||
| 65 | "$(DIST_DEFAULT_TARGET)" | ||||||||||||
| 66 | "$(SUFFIX)" | ||||||||||||
| 67 | "$(ABSTRACT_FROM)" | ||||||||||||
| 68 | ]), | ||||||||||||
| 69 | |||||||||||||
| 70 | |||||||||||||
| 71 | # Local constants override anything above | ||||||||||||
| 72 | # | ||||||||||||
| 73 | 6 | ▶ | %{do($local_fn) || {}}, | ||||||||||
|
Condition50%1/2
do $local_fn || {}
MC/DC0%0/1
do $local_fn || {}
do $local_fn
Truth table50%1/2
A
A= do $local_fn
| |||||||||||||
| 74 | 6 | ▶ | %{do(glob(sprintf('~/.%s.local', __PACKAGE__))) || {}} # || {} avoids warning | ||||||||||
|
Condition50%1/2
do (glob('~/.ASPEER::MakeMaker::Markdown::Pod::MM::Constant.local')) || {}
MC/DC0%0/1
do (glob('~/.ASPEER::MakeMaker::Markdown::Pod::MM::Constant.local')) || {}
do (glob('~/.ASPEER::MakeMaker::Markdown::Pod::MM::Constant.local'))
Truth table50%1/2
A
A= do (glob('~/.ASPEER::MakeMaker::Markdown::Pod::MM::Constant.local'))
| |||||||||||||
| 75 | |||||||||||||
| 76 | ); | ||||||||||||
| 77 | |||||||||||||
| 78 | |||||||||||||
| 79 | # Export constants to namespace, place in export tags | ||||||||||||
| 80 | # | ||||||||||||
| 81 | 6 | require Exporter; | |||||||||||
| 82 | 6 | @ISA=qw(Exporter); | |||||||||||
| 83 | { | ||||||||||||
| 84 | 6 | ▶ | no warnings qw(once); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 85 | 6 | foreach (keys %Constant) {${$_}=$Constant{$_}} | |||||||||||
| 86 | } | ||||||||||||
| 87 | 6 | @EXPORT=map {'$' . $_} keys %Constant; | |||||||||||
| 88 | 6 | @EXPORT_OK=@EXPORT; | |||||||||||
| 89 | 6 | %EXPORT_TAGS=(all => [@EXPORT_OK]); | |||||||||||
| 90 | __END__ | ||||||||||||
| 91 | |||||||||||||
| 92 | =begin markdown | ||||||||||||
| 93 | |||||||||||||
| 94 | # NAME | ||||||||||||
| 95 | |||||||||||||
| 96 | ASPEER::MakeMaker::Markdown::Pod::MM::Constant - constants for MakeMaker integration | ||||||||||||
| 97 | |||||||||||||
| 98 | # SYNOPSIS | ||||||||||||
| 99 | |||||||||||||
| 100 | ```perl | ||||||||||||
| 101 | use ASPEER::MakeMaker::Markdown::Pod::MM::Constant; | ||||||||||||
| 102 | |||||||||||||
| 103 | my $postamble = $TEMPLATE_POSTAMBLE_FN; | ||||||||||||
| 104 | my $module = $MARKPOD_PM; | ||||||||||||
| 105 | my $argv = $MARKPOD_PM_ARGV; | ||||||||||||
| 106 | ``` | ||||||||||||
| 107 | |||||||||||||
| 108 | # DESCRIPTION | ||||||||||||
| 109 | |||||||||||||
| 110 | `ASPEER::MakeMaker::Markdown::Pod::MM::Constant` defines constants used by | ||||||||||||
| 111 | `ASPEER::MakeMaker::Markdown::Pod::MM` when it extends `ExtUtils::MakeMaker`. | ||||||||||||
| 112 | |||||||||||||
| 113 | `MM_PREFIX` selects the private `MARKPOD_*` Makefile macro namespace used by | ||||||||||||
| 114 | the shared hook implementation. It is hook configuration and is not emitted as | ||||||||||||
| 115 | a generic `MM_PREFIX` Makefile macro. | ||||||||||||
| 116 | |||||||||||||
| 117 | The constants describe where the Makefile postamble template lives, which Perl | ||||||||||||
| 118 | module should be invoked by the generated targets, and which MakeMaker | ||||||||||||
| 119 | variables should be passed back into the target dispatcher. | ||||||||||||
| 120 | |||||||||||||
| 121 | # CONSTANTS | ||||||||||||
| 122 | |||||||||||||
| 123 | `$TEMPLATE_POSTAMBLE_FN` | ||||||||||||
| 124 | : Path to the bundled `postamble.inc` template. | ||||||||||||
| 125 | |||||||||||||
| 126 | `$MARKPOD_PM` | ||||||||||||
| 127 | : Module name invoked by the generated Makefile targets. This is normally | ||||||||||||
| 128 | `ASPEER::MakeMaker::Markdown::Pod::MM`. | ||||||||||||
| 129 | |||||||||||||
| 130 | `$MARKPOD_PM_ARGV` | ||||||||||||
| 131 | : Quoted list of MakeMaker variables passed to the target dispatcher so methods | ||||||||||||
| 132 | such as `doc` and `readme` can reconstruct their input parameters. | ||||||||||||
| 133 | |||||||||||||
| 134 | # LOCAL OVERRIDES | ||||||||||||
| 135 | |||||||||||||
| 136 | Local constants can be overridden by files loaded from: | ||||||||||||
| 137 | |||||||||||||
| 138 | ```text | ||||||||||||
| 139 | lib/ASPEER/MakeMaker/Markdown/Pod/MM/Constant.pm.local | ||||||||||||
| 140 | ~/.ASPEER::MakeMaker::Markdown::Pod::MM::Constant.local | ||||||||||||
| 141 | ``` | ||||||||||||
| 142 | |||||||||||||
| 143 | Those files are expected to return a hash reference suitable for merging into | ||||||||||||
| 144 | `%Constant`. | ||||||||||||
| 145 | |||||||||||||
| 146 | # SEE ALSO | ||||||||||||
| 147 | |||||||||||||
| 148 | `ASPEER::MakeMaker::Markdown::Pod::MM`, `ExtUtils::MakeMaker` | ||||||||||||
| 149 | |||||||||||||
| 150 | # AUTHOR | ||||||||||||
| 151 | |||||||||||||
| 152 | Andrew Speer <andrew.speer@isolutions.com.au> | ||||||||||||
| 153 | |||||||||||||
| 154 | # LICENSE and COPYRIGHT | ||||||||||||
| 155 | |||||||||||||
| 156 | This file is part of ASPEER::MakeMaker::Markdown::Pod. | ||||||||||||
| 157 | |||||||||||||
| 158 | This software is copyright (c) 2026 by Andrew Speer <andrew.speer@isolutions.com.au>. | ||||||||||||
| 159 | |||||||||||||
| 160 | This is free software; you can redistribute it and/or modify it under | ||||||||||||
| 161 | the same terms as the Perl 5 programming language system itself. | ||||||||||||
| 162 | |||||||||||||
| 163 | Full license text is available at: | ||||||||||||
| 164 | |||||||||||||
| 165 | <http://dev.perl.org/licenses/> | ||||||||||||
| 166 | |||||||||||||
| 167 | |||||||||||||
| 168 | =end markdown | ||||||||||||
| 169 | |||||||||||||
| 170 | |||||||||||||
| 171 | =head1 NAME | ||||||||||||
| 172 | |||||||||||||
| 173 | ASPEER::MakeMaker::Markdown::Pod::MM::Constant - constants for MakeMaker integration | ||||||||||||
| 174 | |||||||||||||
| 175 | |||||||||||||
| 176 | =head1 SYNOPSIS | ||||||||||||
| 177 | |||||||||||||
| 178 | |||||||||||||
| 179 | use ASPEER::MakeMaker::Markdown::Pod::MM::Constant; | ||||||||||||
| 180 | |||||||||||||
| 181 | my $postamble = $TEMPLATE_POSTAMBLE_FN; | ||||||||||||
| 182 | my $module = $MARKPOD_PM; | ||||||||||||
| 183 | my $argv = $MARKPOD_PM_ARGV; | ||||||||||||
| 184 | |||||||||||||
| 185 | =head1 DESCRIPTION | ||||||||||||
| 186 | |||||||||||||
| 187 | C<ASPEER::MakeMaker::Markdown::Pod::MM::Constant> defines constants used by | ||||||||||||
| 188 | C<ASPEER::MakeMaker::Markdown::Pod::MM> when it extends C<ExtUtils::MakeMaker>. | ||||||||||||
| 189 | |||||||||||||
| 190 | C<MM_PREFIX> selects the private C<MARKPOD_*> Makefile macro namespace used by | ||||||||||||
| 191 | the shared hook implementation. It is hook configuration and is not emitted as | ||||||||||||
| 192 | a generic C<MM_PREFIX> Makefile macro. | ||||||||||||
| 193 | |||||||||||||
| 194 | The constants describe where the Makefile postamble template lives, which Perl | ||||||||||||
| 195 | module should be invoked by the generated targets, and which MakeMaker | ||||||||||||
| 196 | variables should be passed back into the target dispatcher. | ||||||||||||
| 197 | |||||||||||||
| 198 | |||||||||||||
| 199 | =head1 CONSTANTS | ||||||||||||
| 200 | |||||||||||||
| 201 | C<$TEMPLATE_POSTAMBLE_FN> | ||||||||||||
| 202 | : Path to the bundled C<postamble.inc> template. | ||||||||||||
| 203 | |||||||||||||
| 204 | C<$MARKPOD_PM> | ||||||||||||
| 205 | : Module name invoked by the generated Makefile targets. This is normally | ||||||||||||
| 206 | C<ASPEER::MakeMaker::Markdown::Pod::MM>. | ||||||||||||
| 207 | |||||||||||||
| 208 | C<$MARKPOD_PM_ARGV> | ||||||||||||
| 209 | : Quoted list of MakeMaker variables passed to the target dispatcher so methods | ||||||||||||
| 210 | such as C<doc> and C<readme> can reconstruct their input parameters. | ||||||||||||
| 211 | |||||||||||||
| 212 | |||||||||||||
| 213 | =head1 LOCAL OVERRIDES | ||||||||||||
| 214 | |||||||||||||
| 215 | Local constants can be overridden by files loaded from: | ||||||||||||
| 216 | |||||||||||||
| 217 | |||||||||||||
| 218 | lib/ASPEER/MakeMaker/Markdown/Pod/MM/Constant.pm.local | ||||||||||||
| 219 | ~/.ASPEER::MakeMaker::Markdown::Pod::MM::Constant.local | ||||||||||||
| 220 | Those files are expected to return a hash reference suitable for merging into | ||||||||||||
| 221 | C<%Constant>. | ||||||||||||
| 222 | |||||||||||||
| 223 | |||||||||||||
| 224 | =head1 SEE ALSO | ||||||||||||
| 225 | |||||||||||||
| 226 | C<ASPEER::MakeMaker::Markdown::Pod::MM>, C<ExtUtils::MakeMaker> | ||||||||||||
| 227 | |||||||||||||
| 228 | |||||||||||||
| 229 | =head1 AUTHOR | ||||||||||||
| 230 | |||||||||||||
| 231 | Andrew Speer L<mailto:andrew.speer@isolutions.com.au> | ||||||||||||
| 232 | |||||||||||||
| 233 | |||||||||||||
| 234 | =head1 LICENSE AND COPYRIGHT | ||||||||||||
| 235 | |||||||||||||
| 236 | This file is part of ASPEER::MakeMaker::Markdown::Pod. | ||||||||||||
| 237 | |||||||||||||
| 238 | This software is copyright (c) 2026 by Andrew Speer | ||||||||||||
| 239 | L<mailto:andrew.speer@isolutions.com.au>. | ||||||||||||
| 240 | |||||||||||||
| 241 | This is free software; you can redistribute it and/or modify it under | ||||||||||||
| 242 | the same terms as the Perl 5 programming language system itself. | ||||||||||||
| 243 | |||||||||||||
| 244 | Full license text is available at: | ||||||||||||
| 245 | |||||||||||||
| 246 | L<http://dev.perl.org/licenses/> | ||||||||||||
| 247 | |||||||||||||
| 248 | =cut | ||||||||||||