Publish/Constant.pm

filter: Statementstmt 86.4% 32 / 37 Branchbran 33.3% 2 / 6 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 70.9% 39 / 55 CC 1 SCAR 0.0
CC
1
Cov
71%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Publish/Docusaurus.pm ↑ Summary
1 #
2 # This file is part of 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 Markdown::Publish::Constant;
14  
15 2 ▶use strict qw(vars);
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS %Constant);
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 2 ▶use Cwd qw(abs_path);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 2 $VERSION='1.004';
22  
23 2 %Constant=(
24 MARKDOWN_PUBLISH_MODULE => 'Markdown::Publish::MkDocs',
25 MARKDOWN_PUBLISH_CONFIG_FN => 'doc/project.json',
26 MARKDOWN_PUBLISH_OUTPUT_DN => 'site',
27 MARKDOWN_PUBLISH_BRANCH => 'gh-pages',
28 MARKDOWN_PUBLISH_NPM_VERBOSE => 0,
29 MARKDOWN_PUBLISH_HOST => undef,
30 MARKDOWN_PUBLISH_PORT => undef
31 );
32  
33 # Local preferences sit beside the installed module. Environment variables
34 # with the same names take precedence over both the file and built-in values.
35 #
36 2 my $local_fn=abs_path(__FILE__).'.local';
37 2 ▶if (-f $local_fn) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $local_fn) 0 2 2
38 0 my $local_hr=do($local_fn);
39 0 ▶ die "unable to load local publication constants $local_fn: ".($@ || $! || 'expected a hash reference')."\n"
Branch: 1 branch
BranchTrueFalseTotal
unless ref $local_hr eq "HASH" 0 0 0
Condition0%0/5
$@ || $! || 'expected a hash reference'
l!l
00
$@ or $!
l!l&&r!l&&!r
000
MC/DC0%0/2
$@ || $! || 'expected a hash reference'
$@ $!
Truth table0%0/3
A or B
A= $@B= $!
ABresult
1X1
011
000
40 unless ref($local_hr) eq 'HASH';
41 0 @Constant{keys(%{$local_hr})}=values(%{$local_hr});
42 }
43 2 foreach my $name (keys(%Constant)) {
44 14 ▶ $Constant{$name}=$ENV{$name} if defined($ENV{$name});
Branch: 1 branch
BranchTrueFalseTotal
if defined $ENV{$name} 0 14 14
45 }
46  
47 2 require Exporter;
48 2 @ISA=qw(Exporter);
49 {
50 2 ▶ no warnings qw(once);
Subroutine BEGIN: called CC=1 SCAR=0.0
51 2 foreach (keys(%Constant)) {${$_}=$Constant{$_}}
52 }
53 2 @EXPORT=map {'$'.$_} keys(%Constant);
54 2 @EXPORT_OK=@EXPORT;
55 2 %EXPORT_TAGS=(all => [@EXPORT_OK]);
56  
57 2 1;
58 __END__
« Publish/Docusaurus.pm ↑ Summary