blib/lib/oEdtk/Constants.pm

filter: Statementstmt 41.6% 10 / 24 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 2 / 8 Podpod 100% 5 / 5 totaltotal 43.5% 17 / 39 CC 2 SCAR 9.8
CC
2
Cov
38%
_delegate
6.0
check_typdoc
2.0
init
2.0
CRAP 2.7
« blib/lib/oEdtk/FixIdx.pm ↑ Summary blib/lib/oEdtk/DisseminationPlan.pm »
1 package oEdtk::Constants;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = 2.1129;
7 1 our @ISA = qw(Exporter);
8 1 our @EXPORT_OK = qw(check_typdoc init populate trim_array trim_scalar);
9  
10 # The document-type typology is corporate data and now lives in
11 # oEUser::Constants. This generic module is a thin delegate so callers using the
12 # old oEdtk::Constants name keep working. oEUser is an optional companion
13 # distribution: it is loaded on demand, and a missing one fails cleanly rather
14 # than breaking the oEdtk load.
15 0 ▶sub _delegate {
Subroutine _delegate: not called CC=2 SCAR=17.9
16 0 my ( $sub, @args ) = @_;
17 0 my $loaded;
18 {
19 0 local $SIG{__DIE__}; # a caught die must not reach oEdtk::Tracking's handler
20 0 $loaded = eval { require oEUser::Constants; 1 };
21 }
22 0 ▶ die "oEdtk::Constants requires the companion distribution oEUser "
Branch: 1 branch
BranchTrueFalseTotal
unless $loaded 0 0 0
23 . "(oEUser::Constants is not installed): $@"
24 unless $loaded;
25 0 return oEUser::Constants->can($sub)->(@args);
26 }
27  
28 0 ▶sub check_typdoc { return _delegate( 'check_typdoc', @_ ) }
Subroutine check_typdoc: not called CC=1 SCAR=6.9
Pod documented
29 0 ▶sub init { return _delegate( 'init', @_ ) }
Subroutine init: not called CC=1 SCAR=6.9
Pod documented
30 0 ▶sub populate { return _delegate( 'populate', @_ ) }
Subroutine populate: not called CC=1 SCAR=6.9
Pod documented
31 0 ▶sub trim_array { return _delegate( 'trim_array', @_ ) }
Subroutine trim_array: not called CC=1 SCAR=6.9
Pod documented
32 0 ▶sub trim_scalar { return _delegate( 'trim_scalar', @_ ) }
Subroutine trim_scalar: not called CC=1 SCAR=6.9
Pod documented
33  
34 1 1;
35  
36 =head1 NAME
37  
38 oEdtk::Constants - delegate to the oEUser document-type typology
39  
40 =head1 SYNOPSIS
41  
42 use oEdtk::Constants qw(check_typdoc);
43  
44 my $code = check_typdoc('CEQU'); # see oEUser::Constants
45  
46 =head1 DESCRIPTION
47  
48 The document-type typology is corporate data; it lives in C<oEUser::Constants>.
49 This module keeps the old C<oEdtk::Constants> name available to existing callers
50 and forwards every function to the companion distribution, which is loaded on
51 demand. When oEUser is not installed, the call fails with a clear message.
52  
53 =head1 FUNCTIONS
54  
55 Every function below forwards its arguments to the same-named function in
56 C<oEUser::Constants> and returns its result:
57  
58 =over 4
59  
60 =item check_typdoc
61  
62 =item init
63  
64 =item populate
65  
66 =item trim_array
67  
68 =item trim_scalar
69  
70 =back
71  
72 =head1 AUTHOR
73  
74 The oEdtk team.
75  
76 =cut
« blib/lib/oEdtk/FixIdx.pm ↑ Summary blib/lib/oEdtk/DisseminationPlan.pm »