| 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | package Zest::Author::TABULO::MungersForHas; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | our $VERSION = '1.000014'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Exporter::Shiny qw( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | hm_tabulo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | hm_lazy_if_possible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | hm_enhance_documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | hm_strip_nonstandard_opts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | #region: #== HAS-MUNGERS == | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ##== High level: Apply our own suite of mungers for MooseX::MungeHas | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 106 | ▶ | sub hm_tabulo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hm_tabulo: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ## no critic: Subroutines::ProhibitAmpersandSigils | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 106 | &hm_lazy_if_possible; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 106 | &hm_enhance_documentation; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 106 | &hm_strip_nonstandard_opts; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | ##== Lower level: Individual mungers for MooseX::MungeHas | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 106 | ▶ | sub hm_lazy_if_possible { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hm_lazy_if_possible: called CC=6 SCAR=19.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 106 | ▶ | unless ( exists $_{lazy} && defined $_{lazy} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $_{"lazy"} and defined $_{"lazy"}
MC/DC0%0/2
exists $_{"lazy"} and defined $_{"lazy"}
exists $_{"lazy"}
defined $_{"lazy"}
Truth table33%1/3
A and B
A= exists $_{"lazy"}B= defined $_{"lazy"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 106 | ▶ | $_{lazy} //= 1 if exists $_{default} || exists $_{builder}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition80%4/5
exists $_{"default"} or exists $_{"builder"}
$_{"lazy"} //= 1
MC/DC100%2/2
exists $_{"default"} or exists $_{"builder"}
exists $_{"default"}
exists $_{"builder"}
MC/DC0%0/1
$_{"lazy"} //= 1
$_{"lazy"}
Truth table100%3/3
A or B
A= exists $_{"default"}B= exists $_{"builder"}
Truth table50%1/2
A
A= $_{"lazy"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 106 | ▶ | sub hm_enhance_documentation { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hm_enhance_documentation: called CC=14 SCAR=28.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | #local %_ = ( name => $name, %opt ); # %_ will be available in CODE, filled with whatever we have for attribute META | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # Semi-dynamic documentation (with rudimentary templating) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 58 | ▶ | $_{-document_default} = sub { "Default: '$_{default}'" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 106 | ▶ | if delete $_{-document_default} // 1 and exists $_{default} and defined $_{default} and !ref $_{default}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition72%8/11
delete $_{"-document_default"} // 1 and exists $_{"default"} and defined $_{"default"} and not ref $_{"default"}
delete $_{"-document_default"} // 1 and exists $_{"default"} and defined $_{"default"}
delete $_{"-document_default"} // 1 and exists $_{"default"}
delete $_{"-document_default"} // 1
MC/DC0%0/4
delete $_{"-document_default"} // 1 and exists $_{"default"} and defined $_{"default"} and not ref $_{"default"}
delete $_{"-document_default"}
exists $_{"default"}
defined $_{"default"}
not ref $_{"default"}
Truth table0%0/5
A and B and C and not(D)
A= delete $_{"-document_default"}B= exists $_{"default"}C= defined $_{"default"}D= not ref $_{"default"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 106 | for my $key (qw(documentation -doc -document_default)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 318 | ▶ | my $doc = delete $_{$key} // next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
delete $_{$key} // (next)
MC/DC100%1/1
delete $_{$key} // (next)
delete $_{$key}
Truth table100%2/2
A
A= delete $_{$key}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 164 | ▶ | $doc = $doc->() if ref($doc) =~ /CODE/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 164 | ▶ | $_{$key} = $doc if defined $doc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 106 | ▶ | my $doc = join( " ", delete $_{-doc} // (), delete $_{-document_default} // () ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%3/6
delete $_{"-doc"} // ()
delete $_{"-document_default"} // ()
MC/DC0%0/2
delete $_{"-doc"} // ()
delete $_{"-doc"}
()
MC/DC0%0/2
delete $_{"-document_default"} // ()
delete $_{"-document_default"}
()
Truth table33%1/3
A // B
A= delete $_{"-doc"}B= ()
Truth table66%2/3
A // B
A= delete $_{"-document_default"}B= ()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 106 | ▶ | $_{documentation} //= $doc if $doc; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$_{"documentation"} //= $doc
MC/DC0%0/2
$_{"documentation"} //= $doc
$_{"documentation"}
$doc
Truth table33%1/3
A //= B
A= $_{"documentation"}B= $doc
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 106 | ▶ | sub hm_strip_nonstandard_opts { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hm_strip_nonstandard_opts: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 106 | ▶ | %_ = ( map { ( $_->key =~ m/^-/ ) ? () : (@$_) } List::Util::pairs(%_) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | #endregion HAS-MUNGERS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | =for :stopwords Tabulo[n] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | Zest::Author::TABULO::MungersForHas - Utility functions used by TABULO's authoring dist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | version 1.000014 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | =for Pod::Coverage hm_enhance_documentation hm_lazy_if_possible hm_strip_nonstandard_opts hm_tabulo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | =head1 AUTHORS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | Tabulo[n] <dev@tabulo.net> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | =head1 LEGAL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | This software is copyright (c) 2023 by Tabulo[n]. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||