| 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
| |||||||||||||||||||||||||||||||||
| 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
Condition0%0/5
$@ || $! || 'expected a hash reference'
$@ or $!
MC/DC0%0/2
$@ || $! || 'expected a hash reference'
$@
$!
Truth table0%0/3
A or B
A= $@B= $!
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||