blib/lib/Config/Model/Utils/GenClassPod.pm untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 53 CC 3 SCAR 15.5
CC
3
Cov
0%
gen_class_pod
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 4.7
1 #
2 # This file is part of Config-Model
3 #
4 # This software is Copyright (c) 2005-2022 by Dominique Dumont.
5 #
6 # This is free software, licensed under:
7 #
8 # The GNU Lesser General Public License, Version 2.1, February 1999
9 #
10 package Config::Model::Utils::GenClassPod 2.169;
11  
12 # ABSTRACT: generate pod documentation from configuration models
13  
14 use strict;
15 use warnings;
16 use 5.020;
17 use parent qw(Exporter);
18  
19 use feature qw/postderef signatures/;
20 no warnings qw/experimental::postderef experimental::signatures/;
21  
22 # function is used in one liner script, so auto export is easier to use
23 ## no critic (Modules::ProhibitAutomaticExportation)
24 our @EXPORT = qw(gen_class_pod);
25  
26 use Path::Tiny ;
27 use Config::Model ; # to generate doc
28  
29 sub gen_class_pod (@models) {
30 # make sure that doc is generated from models from ./lib and not
31 # installed models
32 my $local_model_dir = path("lib/Config/Model/models") -> absolute;
33 my $cm = Config::Model -> new(model_dir => $local_model_dir->stringify ) ;
34 my %done;
35  
36 if (not scalar @models) {
37 @models = map { /^\s*model\s*=\s*([\w:-]+)/ ? ($1) : (); }
38 map { $_->lines; }
39 map { $_->children; }
40 path ("lib/Config/Model/")->children(qr/\.d$/);
41 }
42  
43 foreach my $model (@models) {
44 # %done avoid generating doc several times (generate_doc scan docs for
45 # classes referenced by the model with config_class_name parameter)
46 print "Checking doc for model $model\n";
47 $cm->load($model) ;
48 $cm->generate_doc ($model,'lib', \%done) ;
49 }
50 return;
51 }
52  
53 1;
54  
55 __END__