| 1 | package oEdtk::Main; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 20 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 20 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 20 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 20 | ▶ | use feature 'state'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 20 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 20 | our $VERSION = 2.1131; | |||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 20 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||
| 12 | 20 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||
| 13 | date2time | ||||||||||||||||||||||||||||||||||||||||||
| 14 | prodEdtk_Current_Rec | ||||||||||||||||||||||||||||||||||||||||||
| 15 | prodEdtk_Previous_Rec | ||||||||||||||||||||||||||||||||||||||||||
| 16 | prodEtk_rec_cdata_join | ||||||||||||||||||||||||||||||||||||||||||
| 17 | recEdtk_erase | ||||||||||||||||||||||||||||||||||||||||||
| 18 | recEdtk_join_tmplte | ||||||||||||||||||||||||||||||||||||||||||
| 19 | recEdtk_post_process | ||||||||||||||||||||||||||||||||||||||||||
| 20 | recEdtk_redefine | ||||||||||||||||||||||||||||||||||||||||||
| 21 | oe_app_usage | ||||||||||||||||||||||||||||||||||||||||||
| 22 | oe_backgrounds_apps | ||||||||||||||||||||||||||||||||||||||||||
| 23 | oe_CAP_sans_accents | ||||||||||||||||||||||||||||||||||||||||||
| 24 | oe_char_xlate | ||||||||||||||||||||||||||||||||||||||||||
| 25 | oe_clean_addr | ||||||||||||||||||||||||||||||||||||||||||
| 26 | oe_clean_addr_line | ||||||||||||||||||||||||||||||||||||||||||
| 27 | oe_close_fo | ||||||||||||||||||||||||||||||||||||||||||
| 28 | oe_compo_link | ||||||||||||||||||||||||||||||||||||||||||
| 29 | oe_corporation_get | ||||||||||||||||||||||||||||||||||||||||||
| 30 | oe_corporation_set | ||||||||||||||||||||||||||||||||||||||||||
| 31 | oe_corporation_tag | ||||||||||||||||||||||||||||||||||||||||||
| 32 | oe_data_build | ||||||||||||||||||||||||||||||||||||||||||
| 33 | oe_date_biggest | ||||||||||||||||||||||||||||||||||||||||||
| 34 | oe_date_smallest | ||||||||||||||||||||||||||||||||||||||||||
| 35 | oe_define_TeX_output | ||||||||||||||||||||||||||||||||||||||||||
| 36 | oe_env_var_completion | ||||||||||||||||||||||||||||||||||||||||||
| 37 | oe_fmt_date | ||||||||||||||||||||||||||||||||||||||||||
| 38 | oe_get_handle_to_input_file | ||||||||||||||||||||||||||||||||||||||||||
| 39 | oe_ID_LDOC | ||||||||||||||||||||||||||||||||||||||||||
| 40 | oe_is_IDLDOC | ||||||||||||||||||||||||||||||||||||||||||
| 41 | oe_iso_country | ||||||||||||||||||||||||||||||||||||||||||
| 42 | oe_list_encodings | ||||||||||||||||||||||||||||||||||||||||||
| 43 | oe_new_ID_LDOC | ||||||||||||||||||||||||||||||||||||||||||
| 44 | oe_new_job | ||||||||||||||||||||||||||||||||||||||||||
| 45 | oe_new_job_input_file | ||||||||||||||||||||||||||||||||||||||||||
| 46 | oe_now_time | ||||||||||||||||||||||||||||||||||||||||||
| 47 | oe_num_sign_x | ||||||||||||||||||||||||||||||||||||||||||
| 48 | oe_num2txt_us | ||||||||||||||||||||||||||||||||||||||||||
| 49 | oe_open_fi_IN | ||||||||||||||||||||||||||||||||||||||||||
| 50 | oe_open_fo_OUT | ||||||||||||||||||||||||||||||||||||||||||
| 51 | oe_options | ||||||||||||||||||||||||||||||||||||||||||
| 52 | oe_params | ||||||||||||||||||||||||||||||||||||||||||
| 53 | oe_print_to_output_file | ||||||||||||||||||||||||||||||||||||||||||
| 54 | oe_process_ref_rec | ||||||||||||||||||||||||||||||||||||||||||
| 55 | oe_rec_motif | ||||||||||||||||||||||||||||||||||||||||||
| 56 | oe_rec_output | ||||||||||||||||||||||||||||||||||||||||||
| 57 | oe_rec_pre_process | ||||||||||||||||||||||||||||||||||||||||||
| 58 | oe_rec_process | ||||||||||||||||||||||||||||||||||||||||||
| 59 | oe_round | ||||||||||||||||||||||||||||||||||||||||||
| 60 | oe_set_sys_date | ||||||||||||||||||||||||||||||||||||||||||
| 61 | oe_simple_job | ||||||||||||||||||||||||||||||||||||||||||
| 62 | oe_to_date | ||||||||||||||||||||||||||||||||||||||||||
| 63 | oe_trimp_space | ||||||||||||||||||||||||||||||||||||||||||
| 64 | oe_trt_ref_rec | ||||||||||||||||||||||||||||||||||||||||||
| 65 | oe_uc_sans_accents | ||||||||||||||||||||||||||||||||||||||||||
| 66 | oe_unique_data_name | ||||||||||||||||||||||||||||||||||||||||||
| 67 | *OUT *IN @DATATAB $LAST_ENR | ||||||||||||||||||||||||||||||||||||||||||
| 68 | %motifs %ouTags %evalSsTrt | ||||||||||||||||||||||||||||||||||||||||||
| 69 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 20 | ▶ | use POSIX qw(mkfifo); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 20 | ▶ | use Date::Calc qw(Add_Delta_Days Delta_Days Date_to_Time Today Gmtime Week_of_Year); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 20 | ▶ | use Encode; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 20 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 20 | ▶ | use Getopt::Long qw(GetOptionsFromArray); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 20 | ▶ | use List::MoreUtils qw(uniq); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 20 | ▶ | use List::Util qw(reduce); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 20 | ▶ | use Math::Round qw(nearest); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 20 | ▶ | use Sys::Hostname; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 20 | ▶ | use Scalar::Util qw(openhandle); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 20 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 20 | ▶ | use Readonly; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 20 | ▶ | use Data::UUID; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 20 | ▶ | use oEdtk; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 20 | require oEdtk::Outmngr; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 20 | require oEdtk::TexDoc; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 20 | ▶ | use oEdtk::Dict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 20 | ▶ | use oEdtk::Config qw(config_read); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 20 | ▶ | use oEdtk::Run qw(oe_status_to_msg oe_compo_run oe_after_compo oe_outmngr_output_run_tex); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | #use oEUser::Lib; | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | # | ||||||||||||||||||||||||||||||||||||||||||
| 95 | # CODE - DOC AT THE END | ||||||||||||||||||||||||||||||||||||||||||
| 96 | # | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | # GENERIC METHOD FOR EXTRACTING AND PROCESSING DATA | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | 20 | our @DATATAB; # the array into which records are distributed | |||||||||||||||||||||||||||||||||||||||||
| 101 | # rename to OE_DATATAB | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 20 | our $LAST_ENR = ""; # WHAT ABOUT LAST_ENR ???? | |||||||||||||||||||||||||||||||||||||||||
| 103 | 20 | our $CURRENT_REC = ""; # current record | |||||||||||||||||||||||||||||||||||||||||
| 104 | 20 | our $PREVIOUS_REC = ""; # previous record | |||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 20 | our %motifs; #make private | |||||||||||||||||||||||||||||||||||||||||
| 107 | 20 | our %ouTags; #make private | |||||||||||||||||||||||||||||||||||||||||
| 108 | 20 | our %evalSsTrt; #make private | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 20 | my $_ID_LDOC = ''; # initialize the unique document id (one per run) | |||||||||||||||||||||||||||||||||||||||||
| 111 | 20 | my $_IDLDOC_FORMAT; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 20 | my $PUSH_VALUE = ""; | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | # Default option values (see oe_options). | ||||||||||||||||||||||||||||||||||||||||||
| 115 | 20 | Readonly my %DEFAULT_OPTIONS => ( | |||||||||||||||||||||||||||||||||||||||||
| 116 | index => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 117 | massmail => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 118 | edms => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 119 | bpdf => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 120 | cgi => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 121 | input_code => 0 | ||||||||||||||||||||||||||||||||||||||||||
| 122 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | # [PRIVATE] Default dump mode (0: off, 1: on). Leave it at 0. | ||||||||||||||||||||||||||||||||||||||||||
| 125 | # @see _dump() | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 20 | Readonly::Scalar my $_DEFAULT_OUTPUT_DUMP_MODE => 0; | |||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | # [PRIVATE] Default path of the output debug file. | ||||||||||||||||||||||||||||||||||||||||||
| 129 | # @see _dump() | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 20 | Readonly::Scalar my $_DEFAULT_OUTPUT_DUMP_FILE => 'output.rec'; | |||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | # PLANNED : CONFIGURATION OF OUTPUT SYSTEM | ||||||||||||||||||||||||||||||||||||||||||
| 133 | # return "\\long\\gdef\\$name\{$value\}"; | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 20 | my ( $TAG_OPEN, $TAG_CLOSE, $TAG_COMMENT ); | |||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 20 | ▶ | sub oe_define_TeX_output() { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_define_TeX_output: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | # \\long\\gdef\\$name\{$value\} | ||||||||||||||||||||||||||||||||||||||||||
| 139 | # \long\gdef\NUMCONT{000014770} | ||||||||||||||||||||||||||||||||||||||||||
| 140 | # \long\gdef\PRENOM{MIREILLE}\long\gdef\DATE{01/08/2009}\long\gdef\NICY{10}\STARTGAR | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 20 | $TAG_OPEN = "\\"; # a tag opening (open) | |||||||||||||||||||||||||||||||||||||||||
| 142 | 20 | $TAG_CLOSE = ""; # a tag closing (close) | |||||||||||||||||||||||||||||||||||||||||
| 143 | 20 | $TAG_COMMENT = "%"; # a comment (rem) | |||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | # \long\gdef\xProdApp\} | ||||||||||||||||||||||||||||||||||||||||||
| 146 | 20 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | 20 | oe_define_TeX_output(); # default values | |||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | ################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 152 | ## GENERIC RECORD HELPERS, USED ELSEWHERE (XLS) | ||||||||||||||||||||||||||||||||||||||||||
| 153 | ################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | sub oe_rec_motif { # migrate oe_rec_motif | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_rec_motif: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | # FUNCTION TO DESCRIBE THE UNPACK PATTERN OF THE RECORD | ||||||||||||||||||||||||||||||||||||||||||
| 157 | # | ||||||||||||||||||||||||||||||||||||||||||
| 158 | # appel : | ||||||||||||||||||||||||||||||||||||||||||
| 159 | # oe_rec_motif ($keyRec, "A2 A10 A15 A10 A15 A*"); | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | my $keyRec = shift; | |||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | my $motif = shift; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $motifs{$keyRec} = $motif; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | sub oe_rec_pre_process { # migrate oe_rec_pre_process | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_rec_pre_process: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | # FUNCTION TO ATTACH A PRE-PROCESSING TO A RECORD | ||||||||||||||||||||||||||||||||||||||||||
| 168 | # this processing runs before the record is loaded into DATATAB | ||||||||||||||||||||||||||||||||||||||||||
| 169 | # the previous record content is always available in DATATAB | ||||||||||||||||||||||||||||||||||||||||||
| 170 | # the current record type is known in the execution context | ||||||||||||||||||||||||||||||||||||||||||
| 171 | # | ||||||||||||||||||||||||||||||||||||||||||
| 172 | # appel : | ||||||||||||||||||||||||||||||||||||||||||
| 173 | # oe_rec_pre_process ($keyRec, \&fonction); | ||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my $keyRec = shift; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my $refFonction = shift; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $evalSsTrt{$keyRec}[0] = $refFonction; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | sub oe_rec_output { # migrate oe_rec_output | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_rec_output: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | # FUNCTION TO DESCRIBE THE RECORD OUTPUT FORMAT FOR SPRINTF | ||||||||||||||||||||||||||||||||||||||||||
| 182 | # | ||||||||||||||||||||||||||||||||||||||||||
| 183 | # appel : | ||||||||||||||||||||||||||||||||||||||||||
| 184 | # oe_rec_output ($keyRec, "<#GESTION=%s><#PENOCOD=%s><#LICCODC=%s><SK>%s"); | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | my $keyRec = shift; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my $format = shift; | |||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $ouTags{$keyRec} = $format; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | sub recEdtk_erase { # migrate oe_rec_erase | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recEdtk_erase: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | # FUNCTION TO REMOVE THE PROCESSING OF A RECORD | ||||||||||||||||||||||||||||||||||||||||||
| 193 | # | ||||||||||||||||||||||||||||||||||||||||||
| 194 | # appel : | ||||||||||||||||||||||||||||||||||||||||||
| 195 | # recEdtk_erase ($keyRec); | ||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | my $keyRec = shift; | |||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $evalSsTrt{$keyRec}[0] = ""; | |||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $evalSsTrt{$keyRec}[1] = ""; | |||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | $evalSsTrt{$keyRec}[2] = ""; | |||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | $motifs{$keyRec} = ""; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | $ouTags{$keyRec} = "-1"; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | sub recEdtk_redefine { # migrate oe_rec_redefine | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recEdtk_redefine: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | # FUNCTION TO REDEFINE THE PROCESSING OF A RECORD | ||||||||||||||||||||||||||||||||||||||||||
| 207 | # | ||||||||||||||||||||||||||||||||||||||||||
| 208 | # appel : | ||||||||||||||||||||||||||||||||||||||||||
| 209 | # recEdtk_redefine ($keyRec, "A2 A10 A15 A10 A15 A*"); | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $keyRec = shift; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | my $motif = shift; | |||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | recEdtk_erase($keyRec); | |||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | oe_rec_motif( $keyRec, $motif ); | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | ▶ | sub recEdtk_join_tmplte { # migrate oe_rec_joined_descriptors | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recEdtk_join_tmplte: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 218 | # FUNCTION TO COMPLETE THE UNPACK PATTERN DESCRIPTORS OF THE RECORD | ||||||||||||||||||||||||||||||||||||||||||
| 219 | # AND THE OUTPUT FORMAT IN PARALLEL | ||||||||||||||||||||||||||||||||||||||||||
| 220 | # | ||||||||||||||||||||||||||||||||||||||||||
| 221 | # appel : | ||||||||||||||||||||||||||||||||||||||||||
| 222 | # recEdtk_join_tmplte ("abc", 'A2', '<#tag=%s>'); | ||||||||||||||||||||||||||||||||||||||||||
| 223 | # recEdtk_join_tmplte ($keyRec, $motif, $output); | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | my $keyRec = shift; | |||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | my $motif = shift; | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | $motif ||= "A*"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$motif ||= "A*"
MC/DC0%0/1
$motif ||= "A*"
$motif
Truth table0%0/2
A
A= $motif
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $output = shift; | |||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | $output ||= "%s"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$output ||= "%s"
MC/DC0%0/1
$output ||= "%s"
$output
Truth table0%0/2
A
A= $output
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | $motifs{$keyRec} .= $motif; | |||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | $ouTags{$keyRec} .= $output; | |||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $ouTags{$keyRec} =~ s/^\-1// | |||||||||||||||||||||||||||||||||||||||||
| 233 | ; # when recEdtk_join_tmplte is used to set ouTags dynamically during oe_trt_ref_rec, the default ouTags value = '-1' (no processing) => remove it so as not to pollute the output | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | ▶ | sub oe_rec_process { # migrate oe_rec_process | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_rec_process: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | # FUNCTION TO ATTACH A PROCESSING TO A RECORD | ||||||||||||||||||||||||||||||||||||||||||
| 239 | # this processing runs right after the record is loaded into DATATAB | ||||||||||||||||||||||||||||||||||||||||||
| 240 | # | ||||||||||||||||||||||||||||||||||||||||||
| 241 | # appel : | ||||||||||||||||||||||||||||||||||||||||||
| 242 | # oe_rec_process ($keyRec, \&fonction); | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | my $keyRec = shift; | |||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my $refFonction = shift; | |||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $evalSsTrt{$keyRec}[1] = $refFonction; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | sub recEdtk_post_process { # migrate recEdtk_post_process | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
recEdtk_post_process: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | # FUNCTION TO ATTACH A POST-PROCESSING TO A RECORD | ||||||||||||||||||||||||||||||||||||||||||
| 251 | # this processing runs right after the record is reformatted in format_sortie | ||||||||||||||||||||||||||||||||||||||||||
| 252 | # the record line is known in the execution context, in its "format_sortie" form | ||||||||||||||||||||||||||||||||||||||||||
| 253 | # | ||||||||||||||||||||||||||||||||||||||||||
| 254 | # appel : | ||||||||||||||||||||||||||||||||||||||||||
| 255 | # recEdtk_post_process ($keyRec, \&fonction); | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | my $keyRec = shift; | |||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | my $refFonction = shift; | |||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $evalSsTrt{$keyRec}[2] = $refFonction; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | ## no critic (ProhibitSubroutinePrototypes) | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | sub oe_process_ref_rec ($$\$;$$) { # migrate oe_process_ref_rec | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_process_ref_rec: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | # COMBINED ANALYSIS AND PROCESSING OF RECORDS | ||||||||||||||||||||||||||||||||||||||||||
| 265 | # it wraps the complete analysis and processing of the record (oe_trt_ref_rec) | ||||||||||||||||||||||||||||||||||||||||||
| 266 | # one call per key length, in decreasing order (from the strictest key to the least restrictive) | ||||||||||||||||||||||||||||||||||||||||||
| 267 | # APPEL : | ||||||||||||||||||||||||||||||||||||||||||
| 268 | # oe_process_ref_rec ($offsetKey, $lenKey, $ligne [,$offsetRec, $lenRec]); | ||||||||||||||||||||||||||||||||||||||||||
| 269 | # RETURNS: status | ||||||||||||||||||||||||||||||||||||||||||
| 270 | # | ||||||||||||||||||||||||||||||||||||||||||
| 271 | # example if (oe_process_ref_rec (0, 3, $ligne)){ | ||||||||||||||||||||||||||||||||||||||||||
| 272 | # } elsif (oe_process_ref_rec (0, 2, $ligne)){ | ||||||||||||||||||||||||||||||||||||||||||
| 273 | # etc. | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | my $offsetKey = shift; | |||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | my $lenKey = shift; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my $refLigne = shift; | |||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | my $offsetRec = shift; # optional | |||||||||||||||||||||||||||||||||||||||||
| 278 | 0 | ▶ | $offsetRec ||= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$offsetRec ||= 0
MC/DC0%0/1
$offsetRec ||= 0
$offsetRec
Truth table0%0/2
A
A= $offsetRec
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | my $lenRec = shift; # optional | |||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | ▶ | $lenRec ||= ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$lenRec ||= ""
MC/DC0%0/1
$lenRec ||= ""
$lenRec
Truth table0%0/2
A
A= $lenRec
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | if ( ${$refLigne} =~ m/^.{$offsetKey}(\w{$lenKey})/s | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
${$refLigne;} =~ /^.{$offsetKey}(\w{$lenKey})/s and &oe_trt_ref_rec($1, $refLigne, $offsetRec, $lenRec)
MC/DC0%0/2
${$refLigne;} =~ /^.{$offsetKey}(\w{$lenKey})/s and &oe_trt_ref_rec($1, $refLigne, $offsetRec, $lenRec)
${$refLigne;} =~ /^.{$offsetKey}(\w{$lenKey})/s
&oe_trt_ref_rec($1, $refLigne, $offsetRec, $lenRec)
Truth table0%0/3
A and B
A= ${$refLigne;} =~ /^.{$offsetKey}(\w{$lenKey})/sB= &oe_trt_ref_rec($1, $refLigne, $offsetRec, $lenRec)
| |||||||||||||||||||||||||||||||||||||||||||
| 283 | && oe_trt_ref_rec( $1, $refLigne, $offsetRec, $lenRec ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 284 | { | ||||||||||||||||||||||||||||||||||||||||||
| 285 | # the record has been identified and processed | ||||||||||||||||||||||||||||||||||||||||||
| 286 | # emit the record | ||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | print OUT ${$refLigne}; | |||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | # OTHERWISE THE RECORD WAS NOT RECOGNIZED, THIS IS A FAILURE | ||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | ## no critic (ProhibitSubroutinePrototypes) | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | sub oe_trt_ref_rec ($\$;$$) { # migrate oe_trt_ref_rec | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_trt_ref_rec: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 297 | # MAIN RECORD PROCESSING | ||||||||||||||||||||||||||||||||||||||||||
| 298 | # GENERIC METHOD V0.2.1 27/04/2009 10:05:03 (reference passing becomes implicit) | ||||||||||||||||||||||||||||||||||||||||||
| 299 | # THE FUNCTION NEEDS THE RECORD TYPE AND THE REFERENCE TO A DATA LINE | ||||||||||||||||||||||||||||||||||||||||||
| 300 | # appel : | ||||||||||||||||||||||||||||||||||||||||||
| 301 | # oe_trt_ref_rec($Rec_ID, $ligne [,$offsetRec,$lenRec]); | ||||||||||||||||||||||||||||||||||||||||||
| 302 | # returns: status, $Rec_ID | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my $Rec_ID = shift; | |||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | my $refLigne = shift; | |||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | my $offsetRec = shift; # OPTIONAL OFFSET OF DATA TO DROP AT THE START OF THE LINE | |||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | my $lenRec = shift; # OPTIONAL LENGTH OF DATA TO PROCESS | |||||||||||||||||||||||||||||||||||||||||
| 307 | # DEFAULT VALUES | ||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | ▶ | $ouTags{$Rec_ID} ||= "-1"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$oEdtk::Main::ouTags{$Rec_ID} ||= -1
MC/DC0%0/1
$oEdtk::Main::ouTags{$Rec_ID} ||= -1
$oEdtk::Main::ouTags{$Rec_ID}
Truth table0%0/2
A
A= $oEdtk::Main::ouTags{$Rec_ID}
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | $motifs{$Rec_ID} ||= ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$oEdtk::Main::motifs{$Rec_ID} ||= ""
MC/DC0%0/1
$oEdtk::Main::motifs{$Rec_ID} ||= ""
$oEdtk::Main::motifs{$Rec_ID}
Truth table0%0/2
A
A= $oEdtk::Main::motifs{$Rec_ID}
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | $offsetRec ||= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$offsetRec ||= 0
MC/DC0%0/1
$offsetRec ||= 0
$offsetRec
Truth table0%0/2
A
A= $offsetRec
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | $lenRec ||= ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$lenRec ||= ""
MC/DC0%0/1
$lenRec ||= ""
$lenRec
Truth table0%0/2
A
A= $lenRec
| |||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | # IF THE EXTRACTION PATTERN OF THE RECORD TYPE IS UNKNOWN, | ||||||||||||||||||||||||||||||||||||||||||
| 314 | # AND IF THERE IS NO PRE-PROCESSING ATTACHED TO THE RECORD TYPE, | ||||||||||||||||||||||||||||||||||||||||||
| 315 | # THEN THE RECORD TYPE IS UNKNOWN | ||||||||||||||||||||||||||||||||||||||||||
| 316 | # | ||||||||||||||||||||||||||||||||||||||||||
| 317 | # THIS CHECK ALLOWS DEFINING A RECORD TYPE DYNAMICALLY BASED ON THE CONTEXT | ||||||||||||||||||||||||||||||||||||||||||
| 318 | # THAT IS, A RECORD OF TYPE "1" MAY HAVE DIFFERENT CHARACTERISTICS | ||||||||||||||||||||||||||||||||||||||||||
| 319 | # DEPENDING ON THE PREVIOUSLY PROCESSED RECORD TYPE. | ||||||||||||||||||||||||||||||||||||||||||
| 320 | # THESE CHARACTERISTICS CAN BE SET AT PRE-PROCESSING TIME. | ||||||||||||||||||||||||||||||||||||||||||
| 321 | # | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | if ( $motifs{$Rec_ID} eq "" && !( $evalSsTrt{$Rec_ID}[0] ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$oEdtk::Main::motifs{$Rec_ID} eq "" and not $oEdtk::Main::evalSsTrt{$Rec_ID}[0]
MC/DC0%0/2
$oEdtk::Main::motifs{$Rec_ID} eq "" and not $oEdtk::Main::evalSsTrt{$Rec_ID}[0]
$oEdtk::Main::motifs{$Rec_ID} eq ""
not $oEdtk::Main::evalSsTrt{$Rec_ID}[0]
Truth table0%0/3
A and not(B)
A= $oEdtk::Main::motifs{$Rec_ID} eq ""B= not $oEdtk::Main::evalSsTrt{$Rec_ID}[0]
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | warn "INFO: oe_trt_ref_rec() > LINE $. REC. >$Rec_ID< (offset $offsetRec) UNKNOWN\n"; | |||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | $PREVIOUS_REC = $CURRENT_REC; | |||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | $CURRENT_REC = $Rec_ID; | |||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | # STEP 0 : EVAL PRE-PROCESSING of $refLigne | ||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | &{ $evalSsTrt{$Rec_ID}[0] }($refLigne) if $evalSsTrt{$Rec_ID}[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | # MAKE SURE TO FULLY CLEAR THE READ ARRAY OF THE PREVIOUS RECORD | ||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | undef @DATATAB; | |||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | # OPTIONALLY DROP UNNEEDED DATA (OFFSET AND OUTSIDE USEFUL DATA (lenData)) | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | ${$refLigne} =~ s/^.{$offsetRec}(.{1,$lenRec}).*/$1/ if ( $offsetRec > 0 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | # SPLIT THE RECORD INTO FIELDS | ||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | @DATATAB = unpack( $motifs{$Rec_ID}, ${$refLigne} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | or die | ||||||||||||||||||||||||||||||||||||||||||
| 342 | "ERROR: oe_trt_ref_rec() > LINE $. typEnr >$Rec_ID< motif >$motifs{$Rec_ID}< UNKNOWN\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | # STEP 1 : EVAL FIELD PROCESSING | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | &{ $evalSsTrt{$Rec_ID}[1] } if $evalSsTrt{$Rec_ID}[1]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | # STRUCTURE THE RECORD FOR OUTPUT | ||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | if ( $ouTags{$Rec_ID} ne "-1" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ${$refLigne} = "${TAG_OPEN}a${Rec_ID}${TAG_CLOSE}"; | |||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | ${$refLigne} .= sprintf( $ouTags{$Rec_ID}, @DATATAB ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | or die "ERROR: oe_trt_ref_rec() > LINE $. typEnr >$Rec_ID< ouTags >$ouTags{$Rec_ID}<\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ${$refLigne} .= "${TAG_OPEN}e${Rec_ID}${TAG_CLOSE}\n"; | |||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | ${$refLigne} = ""; | |||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | $LAST_ENR = $Rec_ID; | |||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | # STEP 2 : EVAL POST-PROCESSING | ||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | &{ $evalSsTrt{$Rec_ID}[2] } if $evalSsTrt{$Rec_ID}[2]; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | # OPTIONALLY ADD EXTRA DATA | ||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ${$refLigne} .= $PUSH_VALUE; | |||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $PUSH_VALUE = ""; | |||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | ${$refLigne} =~ s/\s{2,}/ /g; # CONCATENATION OF BLANKS | |||||||||||||||||||||||||||||||||||||||||
| 366 | #$LAST_ENR=$Rec_ID; | ||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | return 1, $Rec_ID; | |||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | sub prodEtk_rec_cdata_join { # migrate prodEtk_rec_cdata_join | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prodEtk_rec_cdata_join: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $PUSH_VALUE .= shift; | |||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 374 | } | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | sub prodEdtk_Previous_Rec () { # migrate oe_previous_rec | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prodEdtk_Previous_Rec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | return $PREVIOUS_REC; | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | sub prodEdtk_Current_Rec () { # migrate oe_current_rec | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prodEdtk_Current_Rec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | return $CURRENT_REC; | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | ################################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 3 | ▶ | sub oe_round { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_round: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | # http://perl.enstimac.fr/allpod/fr-5.6.0/perlfaq4.pod | ||||||||||||||||||||||||||||||||||||||||||
| 389 | # http://perl.enstimac.fr/DocFr/perlfaq4.html | ||||||||||||||||||||||||||||||||||||||||||
| 390 | # http://www.linux-kheops.com/doc/perl/faq-perl-enstimac/perlfaq4.html | ||||||||||||||||||||||||||||||||||||||||||
| 391 | # Perl is not at fault. It is the same as in C. IEEE says we must do it this way. Perl numbers whose absolute value is an integer below 2**31 (on 32-bit machines) will generally behave as mathematical integers. Other numbers are not guaranteed. | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 3 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||
| 393 | 3 | my $multiple = shift; | |||||||||||||||||||||||||||||||||||||||||
| 394 | 3 | my $decimal; #= shift; | |||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | #if (!(defined $decimal)){$decimal = 2;} # decimal may be 0 (decimal converted to an integer) | ||||||||||||||||||||||||||||||||||||||||||
| 397 | 3 | ▶ | if ( !( defined $multiple ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 398 | 1 | $multiple = .01; | |||||||||||||||||||||||||||||||||||||||||
| 399 | } # $multiple may be 0 (decimal converted to an integer) | ||||||||||||||||||||||||||||||||||||||||||
| 400 | 3 | ▶ | if ( $multiple =~ /^0\./ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 2 | $decimal = length($multiple) - 2; | |||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||
| 403 | elsif ( $multiple =~ /^\./ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | $decimal = length($multiple) - 1; | |||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||
| 406 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 407 | 1 | $decimal = 0; | |||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 409 | 3 | my $motif = "%.0${decimal}f"; | |||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||
| 411 | #my $multiple=1/(10**$decimal); | ||||||||||||||||||||||||||||||||||||||||||
| 412 | 3 | $value = nearest( $multiple, $value ); | |||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | 3 | return sprintf( $motif, $value ); | |||||||||||||||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | # Signed-amount digit map. Read in the substitution below, where "$HX_VAL{$1}" | ||||||||||||||||||||||||||||||||||||||||||
| 418 | # interpolates as a hash element. Hoisted out of oe_num_sign_x, which rebuilt it | ||||||||||||||||||||||||||||||||||||||||||
| 419 | # on every call (17609 on the document path, ~13x the cost of a single lookup). | ||||||||||||||||||||||||||||||||||||||||||
| 420 | 20 | my %HX_VAL = ( | |||||||||||||||||||||||||||||||||||||||||
| 421 | 'p' => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 422 | 'q' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 423 | 'r' => 2, | ||||||||||||||||||||||||||||||||||||||||||
| 424 | 's' => 3, | ||||||||||||||||||||||||||||||||||||||||||
| 425 | 't' => 4, | ||||||||||||||||||||||||||||||||||||||||||
| 426 | 'u' => 5, | ||||||||||||||||||||||||||||||||||||||||||
| 427 | 'v' => 6, | ||||||||||||||||||||||||||||||||||||||||||
| 428 | 'w' => 7, | ||||||||||||||||||||||||||||||||||||||||||
| 429 | 'x' => 8, | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 'y' => 9, | ||||||||||||||||||||||||||||||||||||||||||
| 431 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | ## no critic (ProhibitSubroutinePrototypes) | ||||||||||||||||||||||||||||||||||||||||||
| 434 | 5 | ▶ | sub oe_num_sign_x(\$;$) { # migrate oe_num_sign_x | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_num_sign_x: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | # processing of alphanumeric signed amounts | ||||||||||||||||||||||||||||||||||||||||||
| 436 | # receives: a reference to an alphanumeric variable | ||||||||||||||||||||||||||||||||||||||||||
| 437 | # a number of decimals after the point (optional, 0 by default) | ||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||
| 439 | 5 | my ( $refMontant, $decimal ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 440 | 5 | ▶ | ${$refMontant} ||= ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
${$refMontant;} ||= ""
MC/DC100%1/1
${$refMontant;} ||= ""
${$refMontant;}
Truth table100%2/2
A
A= ${$refMontant;}
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | 5 | ▶ | $decimal ||= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$decimal ||= 0
MC/DC100%1/1
$decimal ||= 0
$decimal
Truth table100%2/2
A
A= $decimal
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | # check the validity of the passed value | ||||||||||||||||||||||||||||||||||||||||||
| 444 | 5 | ${$refMontant} =~ s/\s+//g; | |||||||||||||||||||||||||||||||||||||||||
| 445 | 5 | ▶ | if ( ${$refMontant} eq "" || ${$refMontant} eq 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
${$refMontant;} eq "" or ${$refMontant;} eq 0
MC/DC50%1/2
${$refMontant;} eq "" or ${$refMontant;} eq 0
${$refMontant;} eq ""
${$refMontant;} eq 0
Truth table66%2/3
A or B
A= ${$refMontant;} eq ""B= ${$refMontant;} eq 0
| |||||||||||||||||||||||||||||||||||||||||||
| 446 | 2 | ${$refMontant} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 447 | 2 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||
| 449 | 3 | elsif ( ${$refMontant} =~ /\D{2,}/ ) { | |||||||||||||||||||||||||||||||||||||||||
| 450 | 1 | warn "INFO: value (${$refMontant}) not numeric.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 451 | 1 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | 2 | ▶ | if ( ${$refMontant} =~ s/(\D{1})$/$HX_VAL{$1}/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | # a value with an alphanumeric negative sign 213y => -2139 | ||||||||||||||||||||||||||||||||||||||||||
| 457 | 1 | ${$refMontant} = ( ${$refMontant} * (-1) ); | |||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | # warn "INFO: SIGNED AMOUNT"; | ||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | 1 | elsif ( ${$refMontant} =~ /^-{1}/ ) { | |||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | # a value with a negative sign -123456 | ||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | 2 | ${$refMontant} = ${$refMontant} / ( 10**$decimal ); | |||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||
| 468 | 2 | return ${$refMontant}; | |||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | ▶ | sub date2time { # migrate oe_date_to_time | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
date2time: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 472 | # DEPRECATED FUNCTION, | ||||||||||||||||||||||||||||||||||||||||||
| 473 | # USE THE SPECIALIZED LIBRARY: Date::Calc | ||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | my $date = shift; # a date in YYYYMMDD format | |||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | my $tmpDate = "AAAAMMJJ"; | |||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | my $decalage = 0; | |||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | my $jours = -1; | |||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | my $time = time; | |||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday ) = gmtime($time); | |||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | my $nowDate = sprintf( "%4.0f%02.0f%02.0f", $year + 1900, $mon + 1, $mday ); | |||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | ▶ | if ( $nowDate > $date ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | # date is older | ||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | $decalage = -1; | |||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 488 | elsif ( $nowDate < $date ) { | ||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||
| 490 | # date is newer | ||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | $decalage = +1; | |||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | while ( $date ne $tmpDate ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | $jours++; | |||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | # a day has 86400 seconds | ||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday ) = | |||||||||||||||||||||||||||||||||||||||||
| 499 | gmtime( $time + ( $decalage * $jours * 86400 ) ); | ||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | $tmpDate = sprintf( "%4.0f%02.0f%02.0f", $year + 1900, $mon + 1, $mday ); | |||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | return ( $time + ( $decalage * $jours * 86400 ) ), ( $decalage * $jours ); | |||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | 7 | ▶ | sub oe_now_time() { # migrate oe_now_time | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_now_time: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 507 | # DEPRECATED FUNCTION, | ||||||||||||||||||||||||||||||||||||||||||
| 508 | # USE THE SPECIALIZED LIBRARY: Date::Calc -> Today | ||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | 7 | my $time = time; | |||||||||||||||||||||||||||||||||||||||||
| 511 | 7 | my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday ) = gmtime($time); | |||||||||||||||||||||||||||||||||||||||||
| 512 | 7 | $time = sprintf( | |||||||||||||||||||||||||||||||||||||||||
| 513 | "%4.0f%02.0f%02.0f%02.0f%02.0f%02.0f", | ||||||||||||||||||||||||||||||||||||||||||
| 514 | $year + 1900, | ||||||||||||||||||||||||||||||||||||||||||
| 515 | $mon + 1, $mday, $hour, $min, $sec | ||||||||||||||||||||||||||||||||||||||||||
| 516 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | 7 | return $time; | |||||||||||||||||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | # ISO COUNTRY DICTIONARY | ||||||||||||||||||||||||||||||||||||||||||
| 522 | 20 | my $_DICO_COUNTRY; | |||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | # ABBREVIATIONS DICTIONARY. | ||||||||||||||||||||||||||||||||||||||||||
| 525 | my $_DICO_POST; | ||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||
| 527 | # translation dictionary for characters (discouraged, but sometimes needed). | ||||||||||||||||||||||||||||||||||||||||||
| 528 | 20 | my $_DICO_CHAR; | |||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | { | ||||||||||||||||||||||||||||||||||||||||||
| 531 | 20 | my $_LAST_ISO = ""; | |||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | ▶ | sub oe_iso_country { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_iso_country: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||||||||||||||
| 535 | # returns the country code in country_dico.ini coding or the last known value | ||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | my $country = shift; | |||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | if ( !defined($_DICO_COUNTRY) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | my $cfg = config_read(); | |||||||||||||||||||||||||||||||||||||||||
| 539 | $_DICO_COUNTRY = | ||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | oEdtk::Dict->new( $cfg->{'EDTK_DICO_COUNTRY'}, { section => $cfg->{'EDTK_LANG'} } ); | |||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | ▶ | $_LAST_ISO = $_DICO_COUNTRY->translate($country) if defined($country); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | return $_LAST_ISO; | |||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | 20 | ▶ | sub oe_char_xlate { # to migrate into the dictionary? | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_char_xlate: not called CC=3 SCAR=23.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 548 | 0 | my $scalar = shift; | |||||||||||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||||||||||||
| 550 | 0 | ▶ | if ( !defined($_DICO_CHAR) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | my $section = shift || 'DEFAULT'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'DEFAULT'
MC/DC0%0/1
shift() || 'DEFAULT'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | my $cfg = config_read(); | |||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | $_DICO_CHAR = oEdtk::Dict->new( $cfg->{'EDTK_DICO_XLAT'}, { section => $section } ); | |||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | $scalar = $_DICO_CHAR->substitue($scalar); | |||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | return $scalar; | |||||||||||||||||||||||||||||||||||||||||
| 558 | } | ||||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | ## no critic (ProhibitSubroutinePrototypes) | ||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | sub oe_clean_addr_line(\$) { # migrate oe_clean_addr_line | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_clean_addr_line: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 562 | # THIS FUNCTION CLEANS ADDRESS LINES TO BUILD THE RECIPIENT ADDRESS BLOCKS | ||||||||||||||||||||||||||||||||||||||||||
| 563 | # it works directly on the variable reference but also returns the resulting string | ||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | my $rLine = shift; | |||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||
| 566 | # default value in case the field is undef | ||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | if ( !defined($$rLine) || length($$rLine) == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $$rLine or length $$rLine == 0
MC/DC0%0/2
not defined $$rLine or length $$rLine == 0
not defined $$rLine
length $$rLine == 0
Truth table0%0/3
not(A) or B
A= not defined $$rLineB= length $$rLine == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | $$rLine = ''; | |||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | return $$rLine; | |||||||||||||||||||||||||||||||||||||||||
| 570 | } | ||||||||||||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | chomp($$rLine); # to be sure there is no trailing newline at the end of the field | |||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | oe_trimp_space($rLine); | |||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | $$rLine = oe_char_xlate( $$rLine, 'ADDRESS' ); | |||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | # TODO: a regex that replaces everything that is not 0-9, -, degrees or \w with blanks... | ||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||
| 579 | # THE NEXT LINE MUST BE ENABLED ONLY AFTER TESTING, FOR NOW HANDLED BY oe_char_xlate | ||||||||||||||||||||||||||||||||||||||||||
| 580 | #$$rLine =~ s/\\+/\//g; # we remove/replace backslashes which are escape characters and which apparently are not counted in the size check (sprintf("%.38s",...) | ||||||||||||||||||||||||||||||||||||||||||
| 581 | 0 | $$rLine =~ s/^\s+// | |||||||||||||||||||||||||||||||||||||||||
| 582 | ; # remove consecutive blanks at the start of the string (an oe_trimp_space was done first...) LEFT TRIM | ||||||||||||||||||||||||||||||||||||||||||
| 583 | 0 | $$rLine =~ s/\s+$//; # remove consecutive blanks at the end of the string (...) RIGHT TRIM | |||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | $$rLine =~ | |||||||||||||||||||||||||||||||||||||||||
| 585 | s/^0\s+//; # remove lone zeros at the start of the string (done last, after the LEFT TRIM) | ||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | $$rLine =~ s/\s+/ /; # collapse consecutive blanks | |||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | # Use the given dictionary to translate words. | ||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | ▶ | if ( length($$rLine) > 38 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | ▶ | if ( !defined($_DICO_POST) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | my $cfg = config_read(); | |||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | $_DICO_POST = oEdtk::Dict->new( $cfg->{'EDTK_DICO_POST'} ); | |||||||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | my @words = split( / /, $$rLine ); | |||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | $$rLine = join( ' ', map { $_DICO_POST->translate($_) } @words ); | |||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | $$rLine = sprintf( "%.38s", $$rLine ); # make sure not to exceed 38 characters per line | |||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | return $$rLine; | |||||||||||||||||||||||||||||||||||||||||
| 600 | } | ||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | ## no critic (ProhibitSubroutinePrototypes) | ||||||||||||||||||||||||||||||||||||||||||
| 603 | 2 | ▶ | sub oe_CAP_sans_accents (\$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_CAP_sans_accents: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||
| 605 | # THIS FUNCTION CONVERTS ACCENTED UPPERCASE CHARACTERS INTO NON-ACCENTED UPPERCASE CHARACTERS | ||||||||||||||||||||||||||||||||||||||||||
| 606 | # using localization causes a bug in the "sort" command. | ||||||||||||||||||||||||||||||||||||||||||
| 607 | # We do not rely on the ability to restore the default behavior by escaping | ||||||||||||||||||||||||||||||||||||||||||
| 608 | # (the no locale directive, or when leaving the block enclosing the use locale directive) | ||||||||||||||||||||||||||||||||||||||||||
| 609 | # so as to adopt a standard and simplified operating mode. | ||||||||||||||||||||||||||||||||||||||||||
| 610 | # NB: localization slows sorting down considerably. | ||||||||||||||||||||||||||||||||||||||||||
| 611 | # (cf. Perl documentation about localization: perllocale) | ||||||||||||||||||||||||||||||||||||||||||
| 612 | # | ||||||||||||||||||||||||||||||||||||||||||
| 613 | # the function is called with an implicit reference passing | ||||||||||||||||||||||||||||||||||||||||||
| 614 | # oe_char_no_accents($chaine); | ||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | 2 | my $refChaine = shift; | |||||||||||||||||||||||||||||||||||||||||
| 617 | 2 | ▶ | ${$refChaine} ||= ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
${$refChaine;} ||= ""
MC/DC0%0/1
${$refChaine;} ||= ""
${$refChaine;}
Truth table50%1/2
A
A= ${$refChaine;}
| |||||||||||||||||||||||||||||||||||||||||||
| 618 | 2 | ${$refChaine} =~ s/[ÀÂÄ]/A/g; | |||||||||||||||||||||||||||||||||||||||||
| 619 | 2 | ${$refChaine} =~ s/[ÉÈÊË]/E/g; | |||||||||||||||||||||||||||||||||||||||||
| 620 | 2 | ${$refChaine} =~ s/[ÌÎÏ]/I/g; | |||||||||||||||||||||||||||||||||||||||||
| 621 | 2 | ${$refChaine} =~ s/[ÒÔÖÕ]/O/g; | |||||||||||||||||||||||||||||||||||||||||
| 622 | 2 | ${$refChaine} =~ s/[ÚÙÛÜ]/U/g; | |||||||||||||||||||||||||||||||||||||||||
| 623 | 2 | ${$refChaine} =~ s/Ç/C/g; | |||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | # the uc command is not included; it can be done before calling oe_CAP_sans_accents | ||||||||||||||||||||||||||||||||||||||||||
| 626 | # - either keep accented lowercase letters, or capitalize everything | ||||||||||||||||||||||||||||||||||||||||||
| 627 | ## ${$refChaine}= uc ${$refChaine}; | ||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||
| 629 | 2 | return ${$refChaine}; | |||||||||||||||||||||||||||||||||||||||||
| 630 | } | ||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | ## no critic (ProhibitSubroutinePrototypes) | ||||||||||||||||||||||||||||||||||||||||||
| 633 | 4 | ▶ | sub oe_uc_sans_accents (\$) { # migrate oe_uc_sans_accents | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_uc_sans_accents: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 634 | # THIS FUNCTION CONVERTS ACCENTED CHARACTERS INTO NON-ACCENTED UPPERCASE CHARACTERS | ||||||||||||||||||||||||||||||||||||||||||
| 635 | # using localization causes a bug in the "sort" command. | ||||||||||||||||||||||||||||||||||||||||||
| 636 | # We do not rely on the ability to restore the default behavior by escaping | ||||||||||||||||||||||||||||||||||||||||||
| 637 | # (the no locale directive, or when leaving the block enclosing the use locale directive) | ||||||||||||||||||||||||||||||||||||||||||
| 638 | # so as to adopt a standard and simplified operating mode. | ||||||||||||||||||||||||||||||||||||||||||
| 639 | # NB: localization slows sorting down considerably. | ||||||||||||||||||||||||||||||||||||||||||
| 640 | # (cf. Perl documentation about localization: perllocale) | ||||||||||||||||||||||||||||||||||||||||||
| 641 | # | ||||||||||||||||||||||||||||||||||||||||||
| 642 | # the function is called with an implicit reference passing | ||||||||||||||||||||||||||||||||||||||||||
| 643 | # oe_uc_sans_accents($chaine); | ||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||
| 645 | 4 | my $refChaine = shift; | |||||||||||||||||||||||||||||||||||||||||
| 646 | 4 | ▶ | ${$refChaine} ||= ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
${$refChaine;} ||= ""
MC/DC0%0/1
${$refChaine;} ||= ""
${$refChaine;}
Truth table50%1/2
A
A= ${$refChaine;}
| |||||||||||||||||||||||||||||||||||||||||||
| 647 | 4 | ${$refChaine} =~ s/[àâä]/a/ig; | |||||||||||||||||||||||||||||||||||||||||
| 648 | 4 | ${$refChaine} =~ s/[éèêë]/e/ig; | |||||||||||||||||||||||||||||||||||||||||
| 649 | 4 | ${$refChaine} =~ s/[ìîï]/i/ig; | |||||||||||||||||||||||||||||||||||||||||
| 650 | 4 | ${$refChaine} =~ s/[òôöõ]/o/ig; | |||||||||||||||||||||||||||||||||||||||||
| 651 | 4 | ${$refChaine} =~ s/[úùûü]/u/ig; | |||||||||||||||||||||||||||||||||||||||||
| 652 | 4 | ${$refChaine} =~ s/ç/c/ig; | |||||||||||||||||||||||||||||||||||||||||
| 653 | 4 | ${$refChaine} = uc ${$refChaine}; | |||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | 4 | return ${$refChaine}; | |||||||||||||||||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||
| 658 | ## no critic (ProhibitSubroutinePrototypes) | ||||||||||||||||||||||||||||||||||||||||||
| 659 | 2 | ▶ | sub oe_trimp_space(\$) { # migrate oe_trimp_space | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_trimp_space: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 660 | # REMOVE CONSECUTIVE SPACES (TRAILING BLANK) BY GROUPING | ||||||||||||||||||||||||||||||||||||||||||
| 661 | # the parameter must be a reference, example: oe_trimp_space($chaine) | ||||||||||||||||||||||||||||||||||||||||||
| 662 | # returns the number of removed characters | ||||||||||||||||||||||||||||||||||||||||||
| 663 | 2 | my $rChaine = shift; | |||||||||||||||||||||||||||||||||||||||||
| 664 | 2 | ▶ | ${$rChaine} ||= ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
${$rChaine;} ||= ""
MC/DC0%0/1
${$rChaine;} ||= ""
${$rChaine;}
Truth table50%1/2
A
A= ${$rChaine;}
| |||||||||||||||||||||||||||||||||||||||||||
| 665 | 2 | ${$rChaine} =~ s/\s{2,}/ /go; | |||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||
| 667 | 2 | return ${$rChaine}; | |||||||||||||||||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | ▶ | sub oe_list_encodings { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_list_encodings: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | my @list = Encode->encodings(); | |||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | warn "INFO: available encodings on this machine are : @list\n"; | |||||||||||||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||
| 675 | # migrate oe_open_fi_IN | ||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | ▶ | sub oe_open_fi_IN { # BASIC INPUT FILE HANDLING | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_open_fi_IN: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | my ( $fi, $enc ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||
| 679 | # An explicit encoding wins; otherwise EDTK_OUT_ENCODING from the config. | ||||||||||||||||||||||||||||||||||||||||||
| 680 | # An absent key keeps M behaviour: an open with no encoding layer. | ||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | ▶ | $enc = oe_config_compo()->{'EDTK_OUT_ENCODING'} unless defined $enc; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | ▶ | my $mode = $enc ? "<:encoding($enc)" : '<'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | ▶ | open( IN, $mode, $fi ) or die "ERROR: opening $fi, return code $!\n"; ## no critic (InputOutput::ProhibitBarewordFileHandles) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||
| 688 | # migrate oe_open_fo_OUT | ||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | ▶ | sub oe_open_fo_OUT { # BASIC OUTPUT FILE HANDLING | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_open_fo_OUT: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | my ( $fo, $enc ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | ▶ | $enc = oe_config_compo()->{'EDTK_OUT_ENCODING'} unless defined $enc; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | ▶ | my $mode = $enc ? ">:encoding($enc)" : '>'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | ▶ | open( OUT, $mode, $fo ) or die "ERROR: opening $fo - return code $!\n"; ## no critic (InputOutput::ProhibitBarewordFileHandles) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 697 | } | ||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | ▶ | sub oe_close_fo { # migrate oe_close_fo | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_close_fo: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | my $f = shift; | |||||||||||||||||||||||||||||||||||||||||
| 701 | |||||||||||||||||||||||||||||||||||||||||||
| 702 | 0 | ▶ | close(OUT) or die "ERROR: closing $f - return code $!\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 703 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||
| 706 | ## no critic (ProhibitSubroutinePrototypes) | ||||||||||||||||||||||||||||||||||||||||||
| 707 | 2 | ▶ | sub oe_to_date(\$) { # migrate oe_to_date | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_to_date: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 708 | # RECEIVES A REFERENCE TO A DATE IN YYYYMMDD FORMAT | ||||||||||||||||||||||||||||||||||||||||||
| 709 | # FORMATS AS DD/MM/YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 710 | 2 | my $refVar = shift; | |||||||||||||||||||||||||||||||||||||||||
| 711 | 2 | ▶ | ${$refVar} ||= ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
${$refVar;} ||= ""
MC/DC0%0/1
${$refVar;} ||= ""
${$refVar;}
Truth table50%1/2
A
A= ${$refVar;}
| |||||||||||||||||||||||||||||||||||||||||||
| 712 | 2 | ${$refVar} =~ s/(\d{4})(\d{2})(\d{2})(.*)/$3\/$2\/$1/o; | |||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||
| 714 | 2 | return ${$refVar}; | |||||||||||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||
| 717 | 4 | ▶ | sub oe_fmt_date { # migrate oe_fmt_date | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_fmt_date: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 718 | 4 | my $date = shift; | |||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||
| 720 | 4 | ▶ | die "ERROR: Unexpected date format: \"$date\"\n" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 721 | if $date !~ /^\s*(\d{1,2})\/(\d{1,2})\/(\d{2}|\d{4})\s*$/; | ||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||
| 723 | 3 | return sprintf( "%02s/%02s/%s", $1, $2, $3 ); | |||||||||||||||||||||||||||||||||||||||||
| 724 | } | ||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||
| 726 | # Convert a date in DD/MM/YYYY format to YYYYMMDD format. | ||||||||||||||||||||||||||||||||||||||||||
| 727 | 19 | ▶ | sub oe_date_convert { # oe_date_format | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_date_convert: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 728 | 19 | my $date = shift; | |||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||
| 730 | 19 | ▶ | if ( $date !~ /^\s*(\d{1,2})\/(\d{1,2})\/(\d{4})\s*$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 731 | 4 | return; | |||||||||||||||||||||||||||||||||||||||||
| 732 | } | ||||||||||||||||||||||||||||||||||||||||||
| 733 | 15 | return sprintf( "%d%02d%02d", $3, $2, $1 ); | |||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||
| 735 | |||||||||||||||||||||||||||||||||||||||||||
| 736 | 7 | ▶ | sub oe_date_compare { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_date_compare: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 737 | 7 | my ( $date1, $date2 ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||
| 739 | 7 | ▶ | if ( $date1 eq '' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 740 | 1 | $date1 = $date2; | |||||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||
| 743 | 7 | my $wdate1 = oe_date_convert($date1); | |||||||||||||||||||||||||||||||||||||||||
| 744 | 7 | my $wdate2 = oe_date_convert($date1); | |||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||
| 746 | 7 | ▶ | if ( !defined($wdate1) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 747 | 1 | warn "INFO: Unexpected date format: \"$date1\" should be dd/mm/yyyy. Date ignored\n"; | |||||||||||||||||||||||||||||||||||||||||
| 748 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||||||||||||||||
| 750 | 6 | ▶ | if ( !defined($wdate2) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | warn "INFO: Unexpected date format: \"$date2\" should be dd/mm/yyyy. Date ignored\n"; | |||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 753 | } | ||||||||||||||||||||||||||||||||||||||||||
| 754 | 6 | return $wdate1 <=> $wdate2; | |||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||
| 757 | 1 | ▶ | sub oe_date_smallest { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_date_smallest: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 758 | 1 | my ( $date1, $date2 ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||
| 760 | 1 | ▶ | if ( oe_date_compare( $date1, $date2 ) <= 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 761 | 1 | return $date1; | |||||||||||||||||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||||||||||||||||
| 763 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | return $date2; | |||||||||||||||||||||||||||||||||||||||||
| 765 | } | ||||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||
| 768 | 1 | ▶ | sub oe_date_biggest { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_date_biggest: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 769 | 1 | my ( $date1, $date2 ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||
| 771 | 1 | ▶ | if ( oe_date_compare( $date1, $date2 ) <= 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 772 | 1 | return $date2; | |||||||||||||||||||||||||||||||||||||||||
| 773 | } | ||||||||||||||||||||||||||||||||||||||||||
| 774 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | return $date1; | |||||||||||||||||||||||||||||||||||||||||
| 776 | } | ||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||
| 779 | ## no critic (ProhibitSubroutinePrototypes) | ||||||||||||||||||||||||||||||||||||||||||
| 780 | 3 | ▶ | sub oe_num2txt_us(\$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_num2txt_us: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||||||||||||
| 782 | # process amounts in Text format | ||||||||||||||||||||||||||||||||||||||||||
| 783 | # the decimal separator "," is turned into "." for the load commands | ||||||||||||||||||||||||||||||||||||||||||
| 784 | # the thousands separator "." or " " is removed | ||||||||||||||||||||||||||||||||||||||||||
| 785 | # receives: an alphanumeric variable formatted for display | ||||||||||||||||||||||||||||||||||||||||||
| 786 | # $value = oe_num2txt_us($value); | ||||||||||||||||||||||||||||||||||||||||||
| 787 | # or by reference | ||||||||||||||||||||||||||||||||||||||||||
| 788 | # oe_num2txt_us($value); | ||||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||
| 790 | 3 | my $refValue = shift; | |||||||||||||||||||||||||||||||||||||||||
| 791 | 3 | ▶ | ${$refValue} ||= ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
${$refValue;} ||= ""
MC/DC100%1/1
${$refValue;} ||= ""
${$refValue;}
Truth table100%2/2
A
A= ${$refValue;}
| |||||||||||||||||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||||||||||||||
| 793 | 3 | ▶ | if ( ${$refValue} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 794 | 2 | ${$refValue} =~ s/\s+//g; # remove blanks | |||||||||||||||||||||||||||||||||||||||||
| 795 | 2 | ${$refValue} =~ s/\.//g; # remove thousands separators | |||||||||||||||||||||||||||||||||||||||||
| 796 | 2 | ${$refValue} =~ s/\,/\./g; # replace the decimal separator | |||||||||||||||||||||||||||||||||||||||||
| 797 | 2 | ${$refValue} =~ s/(.*)(\-)$/$2$1/; # optionally move the negative sign to the front | |||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||||||||||||||||
| 800 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 801 | 1 | ${$refValue} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||
| 804 | 3 | return ${$refValue}; | |||||||||||||||||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | ▶ | sub oe_include_build { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_include_build: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | my ( $name, $path ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||||||||||||
| 810 | #import oEdtk::TexDoc; | ||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | my $tag = oEdtk::TexDoc->new(); | |||||||||||||||||||||||||||||||||||||||||
| 813 | 0 | $tag->include( $name, $path ); | |||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | return $tag; | |||||||||||||||||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||||||||||||||||
| 817 | 0 | ▶ | sub oe_data_build { #oe_xdata_build | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_data_build: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | my ( $name, $val ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | my $tag = oEdtk::TexTag->new( $name, $val ); | |||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | return $tag->emit(); | |||||||||||||||||||||||||||||||||||||||||
| 822 | } | ||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | ▶ | sub oe_app_usage() { # migrate oe_app_usage | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_app_usage: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 825 | 0 | my $app = ""; | |||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | $0 =~ /([\w-]+[\.plmex]*$)/; | |||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | ▶ | $1 ? $app = "application.pl" : $app = $1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | print STDOUT <<"EOF"; | |||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||
| 830 | Usage: $app </source/input/file.dat> [job] [options] | ||||||||||||||||||||||||||||||||||||||||||
| 831 | Usage: $app --noinputfiles [job] [options] | ||||||||||||||||||||||||||||||||||||||||||
| 832 | options : | ||||||||||||||||||||||||||||||||||||||||||
| 833 | --massmail to confirm mass treatment | ||||||||||||||||||||||||||||||||||||||||||
| 834 | --edms to confirm edms treatment | ||||||||||||||||||||||||||||||||||||||||||
| 835 | --cgi | ||||||||||||||||||||||||||||||||||||||||||
| 836 | these values depend on ED_REFIDDOC config table | ||||||||||||||||||||||||||||||||||||||||||
| 837 | (example : omgr treatment confirmation) | ||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||
| 839 | --input_code input caracters encoding | ||||||||||||||||||||||||||||||||||||||||||
| 840 | (ie : --input_code=iso-8859-1) | ||||||||||||||||||||||||||||||||||||||||||
| 841 | --noinputfiles no data file needed for treatment | ||||||||||||||||||||||||||||||||||||||||||
| 842 | --help this message | ||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||
| 846 | # --notracking halt tracking, do not track | ||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | oe_list_encodings(); | |||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | exit 1; | |||||||||||||||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||
| 851 | # XXX Global variable used to remember stuff from oe_new_job() when we | ||||||||||||||||||||||||||||||||||||||||||
| 852 | # are in oe_compo_link(). It would be *much* better to keep state in an | ||||||||||||||||||||||||||||||||||||||||||
| 853 | # object instance instead. | ||||||||||||||||||||||||||||||||||||||||||
| 854 | 20 | my $_RUN_PARAMS; | |||||||||||||||||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | ▶ | sub oe_new_job { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_new_job: not called CC=26 SCAR=65.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | @ARGV = | |||||||||||||||||||||||||||||||||||||||||
| 858 | ( @ARGV, @_ ); # optionally override options with the oe_new_job parameters for GetOptions | ||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | my $cfg = config_read('COMPO'); | |||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | my $params = {}; | |||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||
| 862 | # DEFAULT OPTION VALUES. | ||||||||||||||||||||||||||||||||||||||||||
| 863 | 0 | my %defaults = ( | |||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||
| 865 | # xls => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 866 | # tex => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 867 | index => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 868 | massmail => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 869 | edms => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 870 | cgi => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 871 | input_code => 0 | ||||||||||||||||||||||||||||||||||||||||||
| 872 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||
| 874 | # examples of adding parameters at launch | ||||||||||||||||||||||||||||||||||||||||||
| 875 | # oe_new_job('--index'); | ||||||||||||||||||||||||||||||||||||||||||
| 876 | # oe_new_job("--input_code=utf8"); | ||||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | GetOptions( \%defaults, 'help', 'index', 'massmail', 'edms', 'cgi', 'noinputfiles', | |||||||||||||||||||||||||||||||||||||||||
| 879 | 'input_code=s' ); | ||||||||||||||||||||||||||||||||||||||||||
| 880 | 0 | ▶ | while ( my ( $key, $val ) = each(%defaults) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 881 | 0 | ▶ | if ( !defined( $params->{$key} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | $params->{$key} = $val; | |||||||||||||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||||||||||||
| 884 | } | ||||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | if ( $^O ne 'MSWin32' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | $defaults{'fifo'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 888 | } | ||||||||||||||||||||||||||||||||||||||||||
| 889 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | $defaults{'fifo'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 891 | } | ||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | $params->{'doclib'} = _omngr_doclib(); | |||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | $params->{'idldoc'} = oe_ID_LDOC(); | |||||||||||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||||||||||
| 896 | 0 | $params->{'outfile'} = $cfg->{'EDTK_PRGNAME'} . ".txt"; # should be tied to TexMode | |||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | ▶ | $params->{'output_code'} = $cfg->{'EDTK_OUT_ENCODING'} || 'utf8'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$cfg->{'EDTK_OUT_ENCODING'} || 'utf8'
MC/DC0%0/1
$cfg->{'EDTK_OUT_ENCODING'} || 'utf8'
$cfg->{'EDTK_OUT_ENCODING'}
Truth table0%0/2
A
A= $cfg->{'EDTK_OUT_ENCODING'}
| |||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | $params->{'output_code'} = ">:encoding(" . $params->{'output_code'} . ")"; | |||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | ▶ | if ( $params->{'input_code'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | $params->{'input_code'} = "<:encoding(" . $params->{'input_code'} . ")"; | |||||||||||||||||||||||||||||||||||||||||
| 901 | } | ||||||||||||||||||||||||||||||||||||||||||
| 902 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | $params->{'input_code'} = "<"; | |||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||
| 906 | 0 | my $fi; | |||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | ▶ | if ( $defaults{help} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | &oe_app_usage(); | |||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||
| 910 | } | ||||||||||||||||||||||||||||||||||||||||||
| 911 | elsif ( $defaults{noinputfiles} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | $fi = 0; | |||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | warn "INFO: no input file for this treatment\n"; | |||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||
| 915 | elsif ( $#ARGV == -1 ) { # TO KEEP COMPATIBILITY | ||||||||||||||||||||||||||||||||||||||||||
| 916 | 0 | &oe_app_usage(); | |||||||||||||||||||||||||||||||||||||||||
| 917 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||
| 918 | } | ||||||||||||||||||||||||||||||||||||||||||
| 919 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | $fi = $ARGV[0]; # TO KEEP COMPATIBILITY | |||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | ▶ | open( IN, $params->{'input_code'}, $fi ) ## no critic (InputOutput::ProhibitBarewordFileHandles) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 922 | or die "ERROR: Cannot open \"$fi\" for reading: $!\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 923 | warn "INFO: input perl data is $fi (encode \'" | ||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | . $params->{'input_code'} | |||||||||||||||||||||||||||||||||||||||||
| 925 | . "\' $ARGV[-1])\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 926 | } | ||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||
| 928 | # Override default setting if EDTK_COMPO_ASYNC is set in edtk.ini. | ||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | my $async = $cfg->{'EDTK_COMPO_ASYNC'}; | |||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | ▶ | if ( defined($async) && $async =~ /^yes$/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined $async and $async =~ /^yes$/i
MC/DC0%0/2
defined $async and $async =~ /^yes$/i
defined $async
$async =~ /^yes$/i
Truth table0%0/3
A and B
A= defined $asyncB= $async =~ /^yes$/i
| |||||||||||||||||||||||||||||||||||||||||||
| 931 | 0 | $params->{'fifo'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 932 | } | ||||||||||||||||||||||||||||||||||||||||||
| 933 | ▶ | elsif ( defined($async) && $async =~ /^no$/i ) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
defined $async and $async =~ /^no$/i
MC/DC0%0/2
defined $async and $async =~ /^no$/i
defined $async
$async =~ /^no$/i
Truth table0%0/3
A and B
A= defined $asyncB= $async =~ /^no$/i
| |||||||||||||||||||||||||||||||||||||||||||
| 934 | 0 | $params->{'fifo'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 935 | } | ||||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | ▶ | if ( $params->{'fifo'} && $^O eq 'MSWin32' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$params->{"fifo"} and $^O eq "MSWin32"
MC/DC0%0/2
$params->{"fifo"} and $^O eq "MSWin32"
$params->{"fifo"}
$^O eq "MSWin32"
Truth table0%0/3
A and B
A= $params->{"fifo"}B= $^O eq "MSWin32"
| |||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | warn "INFO: FIFO mode is not possible under Windows, ignoring.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | $params->{'fifo'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 940 | } | ||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||
| 942 | # If we are in FIFO mode and there is a left-over text file, the mkfifo() | ||||||||||||||||||||||||||||||||||||||||||
| 943 | # call would fail. If we are not in FIFO mode and there's a left-over FIFO, | ||||||||||||||||||||||||||||||||||||||||||
| 944 | # we would hang indefinitely, so make sure to remove this file first. | ||||||||||||||||||||||||||||||||||||||||||
| 945 | 0 | unlink( $params->{'outfile'} ); | |||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||
| 947 | # Handle options passed in the EDTK_OPTIONS environment variable. | ||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | ▶ | if ( exists( $ENV{'EDTK_OPTIONS'} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | my @opts = split( ',', $ENV{'EDTK_OPTIONS'} ); | |||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | foreach my $opt (@opts) { | |||||||||||||||||||||||||||||||||||||||||
| 951 | 0 | $params->{$opt} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 952 | } | ||||||||||||||||||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||||||||||||||||
| 954 | |||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | ▶ | if ( $params->{'fifo'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | warn "INFO: Creating FIFO for output data file (" . $params->{'outfile'} . ")\n"; | |||||||||||||||||||||||||||||||||||||||||
| 957 | 0 | ▶ | mkfifo( $params->{'outfile'}, oct('700') ) or die "ERROR: Could not create fifo : $!\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | my $pid = oe_compo_run( $cfg->{'EDTK_PRGNAME'}, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 959 | 0 | $params->{'pid'} = $pid; | |||||||||||||||||||||||||||||||||||||||||
| 960 | } | ||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||
| 962 | open( OUT, $params->{'output_code'}, $params->{'outfile'} ) ## no critic (InputOutput::ProhibitBarewordFileHandles) | ||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | ▶ | or die "ERROR: Cannot open \'" . $params->{'outfile'} . "\' for writing: $!\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 964 | warn "INFO: input compo data is " | ||||||||||||||||||||||||||||||||||||||||||
| 965 | . $params->{'outfile'} | ||||||||||||||||||||||||||||||||||||||||||
| 966 | . " (encode \'" | ||||||||||||||||||||||||||||||||||||||||||
| 967 | 0 | . $params->{'output_code'} . "\')\n"; | |||||||||||||||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||||||||||||||||
| 969 | # Remember for later use in oe_compo_link() & oEdtk::Main. | ||||||||||||||||||||||||||||||||||||||||||
| 970 | 0 | $_RUN_PARAMS = $params; | |||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | ▶ | if ( defined $cfg->{'EDTK_COMPO_INCLUDE'} && $cfg->{'EDTK_COMPO_INCLUDE'} =~ /yes/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $cfg->{"EDTK_COMPO_INCLUDE"} and $cfg->{"EDTK_COMPO_INCLUDE"} =~ /yes/i
MC/DC0%0/2
defined $cfg->{"EDTK_COMPO_INCLUDE"} and $cfg->{"EDTK_COMPO_INCLUDE"} =~ /yes/i
defined $cfg->{"EDTK_COMPO_INCLUDE"}
$cfg->{"EDTK_COMPO_INCLUDE"} =~ /yes/i
Truth table0%0/3
A and B
A= defined $cfg->{"EDTK_COMPO_INCLUDE"}B= $cfg->{"EDTK_COMPO_INCLUDE"} =~ /yes/i
| |||||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | print OUT oe_include_build( $cfg->{'EDTK_PRGNAME'} . "." . $cfg->{'EDTK_EXT_COMPO'}, | |||||||||||||||||||||||||||||||||||||||||
| 974 | 'EDTK_DIR_SCRIPT' ); | ||||||||||||||||||||||||||||||||||||||||||
| 975 | } | ||||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | print OUT oe_data_build( oe_corporation_tag() ); | |||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | print OUT oe_data_build( 'xIdLdoc', $params->{'idldoc'} ); | |||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | print OUT oe_data_build('xDebFlux'); | |||||||||||||||||||||||||||||||||||||||||
| 979 | 0 | print OUT oe_data_build( 'xAppRef', $cfg->{'EDTK_PRGNAME'} ); | |||||||||||||||||||||||||||||||||||||||||
| 980 | 0 | print OUT oe_data_build( 'xDOCLIB', $params->{'doclib'} ); | |||||||||||||||||||||||||||||||||||||||||
| 981 | |||||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | my $env = $cfg->{'EDTK_TYPE_ENV'}; | |||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | ▶ | if ( $env ne 'Production' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||
| 985 | # Generate the 'TEST EDITION' watermark. | ||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | ▶ | print OUT oe_data_build( 'xWaterM', $cfg->{'EDTK_WATERMARKTEXT'} || ' ' ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$cfg->{'EDTK_WATERMARKTEXT'} || ' '
MC/DC0%0/1
$cfg->{'EDTK_WATERMARKTEXT'} || ' '
$cfg->{'EDTK_WATERMARKTEXT'}
Truth table0%0/2
A
A= $cfg->{'EDTK_WATERMARKTEXT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | print OUT oe_data_build('xTstApp'); | |||||||||||||||||||||||||||||||||||||||||
| 988 | } | ||||||||||||||||||||||||||||||||||||||||||
| 989 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 990 | # No watermark. | ||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | print OUT oe_data_build('xProdApp'); | |||||||||||||||||||||||||||||||||||||||||
| 992 | } | ||||||||||||||||||||||||||||||||||||||||||
| 993 | 0 | print OUT oe_data_build( 'xTYPPROD', substr( $env, 0, 1 ) ); | |||||||||||||||||||||||||||||||||||||||||
| 994 | 0 | print OUT oe_data_build( 'xHOST', hostname() ); | |||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||
| 996 | # Do we want to generate an index file? | ||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | ▶ | if ( $params->{'index'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 998 | 0 | print OUT oe_data_build('xStOmgr'); | |||||||||||||||||||||||||||||||||||||||||
| 999 | 0 | print OUT oe_data_build( 'xHost', hostname() ); | |||||||||||||||||||||||||||||||||||||||||
| 1000 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1001 | 0 | print OUT $TAG_COMMENT; | |||||||||||||||||||||||||||||||||||||||||
| 1002 | 0 | print OUT "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1003 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||
| 1005 | # True when the dissemination-plan URL is configured and carries a non-blank | ||||||||||||||||||||||||||||||||||||||||||
| 1006 | # value: the one switch that lets a 'call-plan' run reach the service. Sites | ||||||||||||||||||||||||||||||||||||||||||
| 1007 | # that do not run a dissemination plan leave the key absent, so the call stays | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | # inert (the mainline behaviour). | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | 0 | ▶ | sub _dissemination_plan_url_set { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dissemination_plan_url_set: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1010 | 0 | my $cfg = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1011 | 0 | my $url = $cfg->{'DISSEMINATION_PLAN_URL'}; | |||||||||||||||||||||||||||||||||||||||||
| 1012 | 0 | ▶ | return ( defined $url && $url =~ /\S/ ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $url and $url =~ /\S/
MC/DC0%0/2
defined $url and $url =~ /\S/
defined $url
$url =~ /\S/
Truth table0%0/3
A and B
A= defined $urlB= $url =~ /\S/
| |||||||||||||||||||||||||||||||||||||||||||
| 1013 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||
| 1015 | 0 | ▶ | sub oe_compo_link { # migrate oe_close_files oe_compo_link | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_compo_link: not called CC=15 SCAR=54.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1016 | # IF THE INPUT STREAM HAS LESS THAN 1 LINE (variable $.), EXIT WITH ERROR | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | # if ($. == 0) { | ||||||||||||||||||||||||||||||||||||||||||
| 1018 | # # INVALID STREAM, STOP | ||||||||||||||||||||||||||||||||||||||||||
| 1019 | # die "ERROR: uncomplete datastream\n $message \n\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1020 | #} | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | 0 | my @opt = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||||||||||||
| 1024 | 0 | my $cfg = config_read('COMPO'); | |||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | my $params = $_RUN_PARAMS; | |||||||||||||||||||||||||||||||||||||||||
| 1026 | 0 | $params->{'corp'} = oe_corporation_set(); | |||||||||||||||||||||||||||||||||||||||||
| 1027 | 0 | ▶ | if (@opt) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1028 | 0 | foreach (@opt) { | |||||||||||||||||||||||||||||||||||||||||
| 1029 | 0 | $_ =~ s/\-+//g; | |||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | $params->{$_} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1031 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1032 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||||||||||||||
| 1034 | 0 | print OUT oe_data_build('xFinFlux'); | |||||||||||||||||||||||||||||||||||||||||
| 1035 | 0 | ▶ | close(OUT) or die "ERROR: closing output $!\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1036 | 0 | ▶ | if ( $params->{'noinputfiles'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1037 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1038 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | 0 | ▶ | close(IN) or die "ERROR: closing input $!\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1040 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | ▶ | if ( $params->{'fifo'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||||||||||||||||
| 1044 | # Disable signal handler. | ||||||||||||||||||||||||||||||||||||||||||
| 1045 | 0 | $SIG{'CHLD'} = 'DEFAULT'; | |||||||||||||||||||||||||||||||||||||||||
| 1046 | 0 | ▶ | if ( !defined( $params->{'cldstatus'} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||
| 1048 | # Wait for the LaTeX process to terminate. | ||||||||||||||||||||||||||||||||||||||||||
| 1049 | 0 | my $pid = $params->{'pid'}; | |||||||||||||||||||||||||||||||||||||||||
| 1050 | 0 | warn "INFO: Waiting for the LaTeX process to terminate ($pid)...\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1051 | 0 | my $kid = waitpid( $pid, 0 ); | |||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | ▶ | if ( $kid <= 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | die "ERROR: Could not collect child process status: $!\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1054 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1055 | 0 | $params->{'cldstatus'} = $?; | |||||||||||||||||||||||||||||||||||||||||
| 1056 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | my $status = $params->{'cldstatus'}; | |||||||||||||||||||||||||||||||||||||||||
| 1058 | 0 | ▶ | if ( $status != 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1059 | 0 | my $msg = oe_status_to_msg($status); | |||||||||||||||||||||||||||||||||||||||||
| 1060 | 0 | die "ERROR: LaTeX process failed: $msg\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1061 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | warn "INFO: The LaTeX process terminated successfully.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1063 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1064 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1065 | # Run the LaTeX process. | ||||||||||||||||||||||||||||||||||||||||||
| 1066 | 0 | oe_compo_run( $cfg->{'EDTK_PRGNAME'}, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1067 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | oe_after_compo( $cfg->{'EDTK_PRGNAME'}, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||
| 1070 | # Dissemination plan: only when the caller opted in (and did not veto), | ||||||||||||||||||||||||||||||||||||||||||
| 1071 | # and the service URL is configured. The delegate loads oEUser on demand, | ||||||||||||||||||||||||||||||||||||||||||
| 1072 | # so a missing companion distribution never breaks the oEdtk load. | ||||||||||||||||||||||||||||||||||||||||||
| 1073 | 0 | ▶ | if ( $params->{'call-plan'} && !defined $params->{'nocallplan'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$params->{"call-plan"} and not defined $params->{"nocallplan"}
MC/DC0%0/2
$params->{"call-plan"} and not defined $params->{"nocallplan"}
$params->{"call-plan"}
not defined $params->{"nocallplan"}
Truth table0%0/3
A and not(B)
A= $params->{"call-plan"}B= not defined $params->{"nocallplan"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1074 | 0 | ▶ | if ( _dissemination_plan_url_set($cfg) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1075 | 0 | require oEdtk::DisseminationPlan; | |||||||||||||||||||||||||||||||||||||||||
| 1076 | 0 | my $app = $params->{'app-ref'}; | |||||||||||||||||||||||||||||||||||||||||
| 1077 | 0 | my $id_lot = $params->{'idldoc'}; | |||||||||||||||||||||||||||||||||||||||||
| 1078 | 0 | ▶ | defined $app or croak "ERROR: no 'app-ref' in params\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1079 | 0 | ▶ | defined $id_lot or croak "ERROR: no 'idldoc' in params\n"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1080 | oEdtk::DisseminationPlan::idx1_app_idlot( $cfg, $app, $id_lot, | ||||||||||||||||||||||||||||||||||||||||||
| 1081 | 0 | $params->{'forced-paper'} ); | |||||||||||||||||||||||||||||||||||||||||
| 1082 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1083 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | 0 | warn "INFO: not calling the dissemination plan (DISSEMINATION_PLAN_URL absent)\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1085 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1086 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1089 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||||||||||||
| 1091 | ## no critic (ProhibitSubroutinePrototypes) | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | 1 | ▶ | sub oe_env_var_completion (\$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_env_var_completion: called CC=4 SCAR=17.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1093 | |||||||||||||||||||||||||||||||||||||||||||
| 1094 | # expand paths by replacing environment variables with their real values | ||||||||||||||||||||||||||||||||||||||||||
| 1095 | # all nesting levels defined in the environment variables are expanded | ||||||||||||||||||||||||||||||||||||||||||
| 1096 | # requires the environment variables to be defined beforehand | ||||||||||||||||||||||||||||||||||||||||||
| 1097 | 1 | my $rValue = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1098 | 1 | ▶ | if ( $^O eq "MSWin32" ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||
| 1100 | # environment variables may themselves contain variables | ||||||||||||||||||||||||||||||||||||||||||
| 1101 | 0 | ▶ | while ( ${$rValue} =~ /\$/g ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | ${$rValue} =~ s/\$(\w+)/${ENV{$1}}/g; | |||||||||||||||||||||||||||||||||||||||||
| 1103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | ${$rValue} =~ s/(\/)/\\/g; | |||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||
| 1106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1107 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | # CHECK COMPATIBILITY UNDER *NIX | ||||||||||||||||||||||||||||||||||||||||||
| 1109 | 1 | ▶ | while ( ${$rValue} =~ /\$/g ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1110 | 1 | ${$rValue} =~ s/\$(\w+)/${ENV{$1}}/g; | |||||||||||||||||||||||||||||||||||||||||
| 1111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1112 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1113 | 1 | return ${$rValue}; | |||||||||||||||||||||||||||||||||||||||||
| 1114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||||||||||||||||
| 1116 | # Maximum length accepted for a forced document id (a 36-char UUID; S70, D1). | ||||||||||||||||||||||||||||||||||||||||||
| 1117 | 20 | ▶ | use constant IDLDOC_MAX_LEN => 36; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||||||||||
| 1119 | 2 | ▶ | sub oe_ID_LDOC { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_ID_LDOC: called CC=5 SCAR=20.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1120 | 2 | my $force_ID = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||
| 1122 | # document batch id: a 36-char UUID by default (S70, D1). A forced id (the | ||||||||||||||||||||||||||||||||||||||||||
| 1123 | # -iddoc option, or the witnesses' SETIDLOT) still wins. The id is generated | ||||||||||||||||||||||||||||||||||||||||||
| 1124 | # only once per run: several calls in the same instance return the same id. | ||||||||||||||||||||||||||||||||||||||||||
| 1125 | # EDTK_IDLDOC_FORMAT=LEGACY (or the alias =old) restores the 16-digit | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | # YWWWDHHMMSSPPPP.r format. | ||||||||||||||||||||||||||||||||||||||||||
| 1127 | 2 | ▶ | if ( $_ID_LDOC eq '' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||
| 1129 | 1 | ▶ | if ( defined $force_ID ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1130 | 0 | ▶ | if ( length $force_ID > IDLDOC_MAX_LEN ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1131 | 0 | die "ERROR: forced ID_LDOC too long (>" . IDLDOC_MAX_LEN . " car) : $force_ID \n"; | |||||||||||||||||||||||||||||||||||||||||
| 1132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1133 | 0 | $_ID_LDOC = $force_ID; | |||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||
| 1135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1136 | elsif ( _idldoc_format() eq 'LEGACY' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1137 | 0 | $_ID_LDOC = _idldoc_legacy_new(); | |||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||
| 1139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1140 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1141 | 1 | oe_new_ID_LDOC(); | |||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||
| 1143 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1144 | |||||||||||||||||||||||||||||||||||||||||||
| 1145 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||
| 1147 | 2 | return $_ID_LDOC; | |||||||||||||||||||||||||||||||||||||||||
| 1148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||
| 1150 | # The mainline (M) 16-digit id YWWWDHHMMSSPPPP.r, kept for | ||||||||||||||||||||||||||||||||||||||||||
| 1151 | # EDTK_IDLDOC_FORMAT=LEGACY (or its 'old' alias). | ||||||||||||||||||||||||||||||||||||||||||
| 1152 | 0 | ▶ | sub _idldoc_legacy_new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_idldoc_legacy_new: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1153 | 0 | my $time = time; | |||||||||||||||||||||||||||||||||||||||||
| 1154 | 0 | my ( $year, $month, $day, $hour, $min, $sec, $doy, $dow, $dst ) = Gmtime($time); | |||||||||||||||||||||||||||||||||||||||||
| 1155 | 0 | my ( $week, ) = Week_of_Year( $year, $month, $day ); | |||||||||||||||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||||||||||||||||
| 1157 | 0 | my $pid = "$$"; | |||||||||||||||||||||||||||||||||||||||||
| 1158 | 0 | my $rnd = int( rand(10) ); | |||||||||||||||||||||||||||||||||||||||||
| 1159 | 0 | ▶ | if ( length $pid > 5 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1160 | 0 | $pid = $pid / ( 10**( ( length $pid ) - 5 ) ); | |||||||||||||||||||||||||||||||||||||||||
| 1161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||||||||||||||||
| 1163 | 0 | return sprintf( "%1d%02d%1d%02d%02d%02d%05d%1d", | |||||||||||||||||||||||||||||||||||||||||
| 1164 | $year % 10, $week, $dow, $hour, $min, $sec, $pid, $rnd ); | ||||||||||||||||||||||||||||||||||||||||||
| 1165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1166 | |||||||||||||||||||||||||||||||||||||||||||
| 1167 | # EDTK_IDLDOC_FORMAT: 'UUID' (default) or 'LEGACY' (the 16-digit mainline id). | ||||||||||||||||||||||||||||||||||||||||||
| 1168 | # 'old' is an accepted spelling of 'LEGACY' (case-insensitive), normalised here | ||||||||||||||||||||||||||||||||||||||||||
| 1169 | # so oe_ID_LDOC tests a single value. Read once per process: config_read is | ||||||||||||||||||||||||||||||||||||||||||
| 1170 | # not cached, and oe_ID_LDOC is called from contexts that carry no $cfg | ||||||||||||||||||||||||||||||||||||||||||
| 1171 | # (Tracking, EDMS, ...). | ||||||||||||||||||||||||||||||||||||||||||
| 1172 | 1 | ▶ | sub _idldoc_format { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_idldoc_format: called CC=7 SCAR=21.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1173 | 1 | ▶ | unless ( defined $_IDLDOC_FORMAT ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1174 | 1 | ▶ | my $cfg = eval { config_read('COMPO') } || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
config_read('COMPO')
}
} || {}
MC/DC0%0/1
eval {
do {
config_read('COMPO')
}
} || {}
eval {
do {
config_read('COMPO')
}
}
Truth table50%1/2
A
A= eval {
do {
config_read('COMPO')
}
}
| |||||||||||||||||||||||||||||||||||||||||||
| 1175 | 1 | ▶ | my $val = ref $cfg ? $cfg->{'EDTK_IDLDOC_FORMAT'} : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1176 | 1 | ▶ | my $fmt = ( defined $val && $val =~ /\S/ ) ? uc($val) : 'UUID'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $val and $val =~ /\S/
MC/DC0%0/2
defined $val and $val =~ /\S/
defined $val
$val =~ /\S/
Truth table33%1/3
A and B
A= defined $valB= $val =~ /\S/
| |||||||||||||||||||||||||||||||||||||||||||
| 1177 | 1 | ▶ | $fmt = 'LEGACY' if $fmt eq 'OLD'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1178 | 1 | $_IDLDOC_FORMAT = $fmt; | |||||||||||||||||||||||||||||||||||||||||
| 1179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1180 | 1 | return $_IDLDOC_FORMAT; | |||||||||||||||||||||||||||||||||||||||||
| 1181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||
| 1183 | # A document batch id (idldoc). Since S70/D1 it is a 36-char UUID; the legacy | ||||||||||||||||||||||||||||||||||||||||||
| 1184 | # 16-digit YWWWDHHMMSSPPPP.r form is still produced under | ||||||||||||||||||||||||||||||||||||||||||
| 1185 | # EDTK_IDLDOC_FORMAT=LEGACY (or its 'old' alias). Kept in this module so the | ||||||||||||||||||||||||||||||||||||||||||
| 1186 | # CLI tools that classify a user-supplied id (see lib/index_Block_refs.pl) | ||||||||||||||||||||||||||||||||||||||||||
| 1187 | # share one definition. | ||||||||||||||||||||||||||||||||||||||||||
| 1188 | 0 | ▶ | sub oe_is_IDLDOC { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_is_IDLDOC: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1189 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1190 | 0 | ▶ | return 0 unless defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1191 | 0 | ▶ | return $value =~ /^[0-9A-Fa-f]{8}(?:-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$/ | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$value =~ /^[0-9A-Fa-f]{8}(?:-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$/ || $value =~ /^\d{16}$/
MC/DC0%0/2
$value =~ /^[0-9A-Fa-f]{8}(?:-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$/ || $value =~ /^\d{16}$/
$value =~ /^[0-9A-Fa-f]{8}(?:-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$/
$value =~ /^\d{16}$/
Truth table0%0/3
A || B
A= $value =~ /^[0-9A-Fa-f]{8}(?:-[0-9A-Fa-f]{4}){3}-[0-9A-Fa-f]{12}$/B= $value =~ /^\d{16}$/
| |||||||||||||||||||||||||||||||||||||||||||
| 1192 | || $value =~ /^\d{16}$/; | ||||||||||||||||||||||||||||||||||||||||||
| 1193 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||
| 1195 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | 20 | my $_app_typ_trt; # batching processing type, | |||||||||||||||||||||||||||||||||||||||||
| 1197 | # value accessible only through the _app_typ_trt method | ||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||
| 1199 | 0 | ▶ | sub _app_typ_trt { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_app_typ_trt: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||||||||||
| 1201 | # designation of the batching processing type (Output Management) | ||||||||||||||||||||||||||||||||||||||||||
| 1202 | # if the function is called with a parameter, assign it to $_app_typ_trt | ||||||||||||||||||||||||||||||||||||||||||
| 1203 | # if the function is called alone, just return the normalized value | ||||||||||||||||||||||||||||||||||||||||||
| 1204 | # by default the value is 'U' for 'undef' | ||||||||||||||||||||||||||||||||||||||||||
| 1205 | # THE VALUE CANNOT BE CHANGED DURING PROCESSING, EXCEPT to switch to Test or Debug | ||||||||||||||||||||||||||||||||||||||||||
| 1206 | # possible values: | ||||||||||||||||||||||||||||||||||||||||||
| 1207 | # - 'M' -> Mass processing with batching | ||||||||||||||||||||||||||||||||||||||||||
| 1208 | # - 'G' -> reGrouping processing, batching pending | ||||||||||||||||||||||||||||||||||||||||||
| 1209 | # - 'L' -> Local edition processing without batching | ||||||||||||||||||||||||||||||||||||||||||
| 1210 | # - 'H' -> homologation processing without batching | ||||||||||||||||||||||||||||||||||||||||||
| 1211 | # - 'T' -> test/homologation processing, batching test possible | ||||||||||||||||||||||||||||||||||||||||||
| 1212 | # - 'D' -> Debug mode, keep intermediate files | ||||||||||||||||||||||||||||||||||||||||||
| 1213 | # - 'U' -> 'undef' processing without batching | ||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||
| 1215 | # Run types (Mass/Grouped/Local/Homol/Test/Debug/Undef) handled in 3 groups: | ||||||||||||||||||||||||||||||||||||||||||
| 1216 | # - MTD -> do batching | ||||||||||||||||||||||||||||||||||||||||||
| 1217 | # - G -> batching pending | ||||||||||||||||||||||||||||||||||||||||||
| 1218 | # - LHU -> do no batching | ||||||||||||||||||||||||||||||||||||||||||
| 1219 | # - D -> does not delete intermediate files | ||||||||||||||||||||||||||||||||||||||||||
| 1220 | # - U -> default mode | ||||||||||||||||||||||||||||||||||||||||||
| 1221 | # - H -> mode tied to the 'Homologation' extension (-V2) | ||||||||||||||||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||||||||||||||
| 1223 | # New run handling based on EDTK_TYPE_ENV: | ||||||||||||||||||||||||||||||||||||||||||
| 1224 | # EDTK_TYPE_ENV = Production -> cleanup, if indexed mode: determine the trt from EDTK_REFIDDOC | ||||||||||||||||||||||||||||||||||||||||||
| 1225 | # EDTK_TYPE_ENV = Integration -> cleanup, banner, if indexed mode: determine the trt from EDTK_REFIDDOC | ||||||||||||||||||||||||||||||||||||||||||
| 1226 | # EDTK_TYPE_ENV = Test -> banner, if indexed mode: determine the trt from EDTK_REFIDDOC | ||||||||||||||||||||||||||||||||||||||||||
| 1227 | # EDTK_TYPE_ENV = Development -> cleanup, banner, 'short' processing | ||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||
| 1229 | 0 | ▶ | my $xTypTrt = shift || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || ''
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 1230 | 0 | ▶ | if ( defined $_app_typ_trt && $xTypTrt !~ /^[TD]/i ) { return $_app_typ_trt; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_app_typ_trt and not $xTypTrt =~ /^[TD]/i
MC/DC0%0/2
defined $_app_typ_trt and not $xTypTrt =~ /^[TD]/i
defined $_app_typ_trt
not $xTypTrt =~ /^[TD]/i
Truth table0%0/3
A and not(B)
A= defined $_app_typ_trtB= not $xTypTrt =~ /^[TD]/i
| |||||||||||||||||||||||||||||||||||||||||||
| 1231 | |||||||||||||||||||||||||||||||||||||||||||
| 1232 | # only the Test and Debug types allow changing $_app_typ_trt if it is already set | ||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||
| 1234 | 0 | ▶ | if ( $xTypTrt !~ /^([MGLHTDU])/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1235 | 0 | $_app_typ_trt = 'U'; | |||||||||||||||||||||||||||||||||||||||||
| 1236 | |||||||||||||||||||||||||||||||||||||||||||
| 1237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1238 | elsif ( $xTypTrt =~ /^([MGL])/i ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1239 | 0 | $_app_typ_trt = $1; | |||||||||||||||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||||||||||||||||
| 1241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1242 | elsif ( $xTypTrt =~ /^([HTD])/i ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | $_app_typ_trt = $1; | |||||||||||||||||||||||||||||||||||||||||
| 1244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||||||||||||||||
| 1246 | warn | ||||||||||||||||||||||||||||||||||||||||||
| 1247 | 0 | "INFO: OM processing type = $_app_typ_trt (Mass/Grouped/Local/Homol/Test/Debug/Undef)\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1248 | 0 | return $_app_typ_trt; | |||||||||||||||||||||||||||||||||||||||||
| 1249 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||||||||||||
| 1252 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1253 | 20 | my $_DOCLIB; # DCLIB DESIGNATION for batching | |||||||||||||||||||||||||||||||||||||||||
| 1254 | # value accessible only through the _omngr_doclib method | ||||||||||||||||||||||||||||||||||||||||||
| 1255 | |||||||||||||||||||||||||||||||||||||||||||
| 1256 | 0 | ▶ | sub _omngr_doclib { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_omngr_doclib: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1257 | 0 | ▶ | if ( defined $_DOCLIB ) { return $_DOCLIB; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1258 | |||||||||||||||||||||||||||||||||||||||||||
| 1259 | 0 | my $doclib = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1260 | 0 | ▶ | if ( !defined $doclib ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1261 | 0 | my $cfg = config_read('ENVDESC'); | |||||||||||||||||||||||||||||||||||||||||
| 1262 | 0 | ▶ | my $ext = shift || $cfg->{'EDTK_EXT_DEFAULT'}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
shift() || $cfg->{'EDTK_EXT_DEFAULT'}
MC/DC0%0/2
shift() || $cfg->{'EDTK_EXT_DEFAULT'}
shift()
$cfg->{'EDTK_EXT_DEFAULT'}
Truth table0%0/3
A || B
A= shift()B= $cfg->{'EDTK_EXT_DEFAULT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1263 | 0 | $_DOCLIB = "DCLIB_" . oe_ID_LDOC() . "." . $ext; | |||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||
| 1265 | #$_DOCLIB =~ s/\./_/; | ||||||||||||||||||||||||||||||||||||||||||
| 1266 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1267 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1268 | 0 | $_DOCLIB = $doclib; | |||||||||||||||||||||||||||||||||||||||||
| 1269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1270 | |||||||||||||||||||||||||||||||||||||||||||
| 1271 | 0 | return $_DOCLIB; | |||||||||||||||||||||||||||||||||||||||||
| 1272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||||||||||||
| 1275 | #sub user_corp_file_prefixe($;$){ | ||||||||||||||||||||||||||||||||||||||||||
| 1276 | # my($filename, $directories, $suffix) = fileparse(shift); | ||||||||||||||||||||||||||||||||||||||||||
| 1277 | # my $sep = shift || '.'; | ||||||||||||||||||||||||||||||||||||||||||
| 1278 | # my @prefix = split (/$sep/, $filename); | ||||||||||||||||||||||||||||||||||||||||||
| 1279 | # oe_corporation_set ($prefix[0]); | ||||||||||||||||||||||||||||||||||||||||||
| 1280 | # # warn "$filename \$prefix[0] $prefix[0] -> ". oe_corporation_set()."\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1281 | #1; | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | #} | ||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||
| 1284 | 20 | ▶ | sub oe_corporation_tag() { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_corporation_tag: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1285 | 0 | return ( sprintf( "x%.7s", oe_corporation_set() ) ); | |||||||||||||||||||||||||||||||||||||||||
| 1286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||
| 1288 | 20 | my $_xCORPOR; | |||||||||||||||||||||||||||||||||||||||||
| 1289 | my $_DICT; | ||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||
| 1291 | 0 | ▶ | sub oe_corporation_get() { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_corporation_get: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1292 | 0 | return $_xCORPOR; | |||||||||||||||||||||||||||||||||||||||||
| 1293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||||||||||
| 1295 | 0 | ▶ | sub oe_corporation_set { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_corporation_set: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||||||||||||||||
| 1297 | # DICTIONARY USE: | ||||||||||||||||||||||||||||||||||||||||||
| 1298 | # - if the parameter is known in the dictionary => dictionary value | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | # - if the parameter is unknown => default value (edtk.ini / EDTK_CORP) | ||||||||||||||||||||||||||||||||||||||||||
| 1300 | # - if no parameter => last known value | ||||||||||||||||||||||||||||||||||||||||||
| 1301 | 0 | my $parametre = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||
| 1303 | 0 | ▶ | if ( !defined($_DICT) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1304 | 0 | my $cfg = config_read(); | |||||||||||||||||||||||||||||||||||||||||
| 1305 | 0 | $_xCORPOR = $cfg->{'EDTK_CORP'}; # Default value | |||||||||||||||||||||||||||||||||||||||||
| 1306 | 0 | $_DICT = oEdtk::Dict->new( $cfg->{'EDTK_DICO'}, { invert => 1 } ); | |||||||||||||||||||||||||||||||||||||||||
| 1307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||
| 1309 | 0 | my $entity; | |||||||||||||||||||||||||||||||||||||||||
| 1310 | 0 | ▶ | if ( defined($parametre) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1311 | 0 | $entity = $parametre; | |||||||||||||||||||||||||||||||||||||||||
| 1312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1313 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1314 | 0 | $entity = $_xCORPOR; | |||||||||||||||||||||||||||||||||||||||||
| 1315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1316 | |||||||||||||||||||||||||||||||||||||||||||
| 1317 | 0 | $entity = $_DICT->translate( $entity, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 1318 | |||||||||||||||||||||||||||||||||||||||||||
| 1319 | 0 | ▶ | if ( defined($entity) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1320 | |||||||||||||||||||||||||||||||||||||||||||
| 1321 | # if the value was found in the dictionary | ||||||||||||||||||||||||||||||||||||||||||
| 1322 | 0 | $_xCORPOR = $entity; | |||||||||||||||||||||||||||||||||||||||||
| 1323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1324 | |||||||||||||||||||||||||||||||||||||||||||
| 1325 | # warn "\$entity $entity \$_xCORPOR $_xCORPOR\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1326 | 0 | return $_xCORPOR; | |||||||||||||||||||||||||||||||||||||||||
| 1327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||
| 1329 | { # in progress, not operational yet (recovery from the generator) | ||||||||||||||||||||||||||||||||||||||||||
| 1330 | 20 | my $cpt_sub_call = 0; # constant variable local to the function | |||||||||||||||||||||||||||||||||||||||||
| 1331 | 20 | my %hListeId; | |||||||||||||||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||||||||||||||||
| 1333 | 0 | ▶ | sub oe_unique_data_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_unique_data_name: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||
| 1335 | # define a unique identifier over n characters | ||||||||||||||||||||||||||||||||||||||||||
| 1336 | # the first 6 characters of the passed key are extracted | ||||||||||||||||||||||||||||||||||||||||||
| 1337 | # if the id is already known, take the first 4 and add a 3-digit counter (matches the call sequence) | ||||||||||||||||||||||||||||||||||||||||||
| 1338 | # if it is still not unique, take the first 3 characters and complete the 3-digit counter with a character | ||||||||||||||||||||||||||||||||||||||||||
| 1339 | # receives: - the total number of characters to return | ||||||||||||||||||||||||||||||||||||||||||
| 1340 | # - an identifier | ||||||||||||||||||||||||||||||||||||||||||
| 1341 | # - optional: a reference to a counter value (3 numeric) | ||||||||||||||||||||||||||||||||||||||||||
| 1342 | |||||||||||||||||||||||||||||||||||||||||||
| 1343 | 0 | my ( $nb_car, $id, $cpt_value ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1344 | 0 | ▶ | if ( $nb_car lt 6 ) { $nb_car = 6; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||
| 1346 | 0 | ▶ | if ($cpt_value) { $cpt_sub_call = $cpt_value } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1347 | 0 | else { $cpt_sub_call++ } | |||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||
| 1349 | 0 | my $debut = $nb_car - 2; | |||||||||||||||||||||||||||||||||||||||||
| 1350 | 0 | my $motif = "%-" . $debut . "." . $debut . "s%0.2d"; # "%-4.4s%0.2d" | |||||||||||||||||||||||||||||||||||||||||
| 1351 | 0 | warn "$motif / $id\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1352 | 0 | $id = sprintf( "$motif", $id ); | |||||||||||||||||||||||||||||||||||||||||
| 1353 | 0 | $id =~ s/\s/x/g; | |||||||||||||||||||||||||||||||||||||||||
| 1354 | |||||||||||||||||||||||||||||||||||||||||||
| 1355 | 0 | ▶ | if ( exists( $hListeId{$id} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1356 | 0 | $debut = $nb_car - 3; | |||||||||||||||||||||||||||||||||||||||||
| 1357 | 0 | $motif = "%-" . $debut . "." . $debut . "s%0.3d"; # "%-3.3s%0.3d" | |||||||||||||||||||||||||||||||||||||||||
| 1358 | 0 | $id = sprintf( $motif, $id, $cpt_sub_call ); | |||||||||||||||||||||||||||||||||||||||||
| 1359 | |||||||||||||||||||||||||||||||||||||||||||
| 1360 | 0 | my $cpt = 97; # for the character "a" | |||||||||||||||||||||||||||||||||||||||||
| 1361 | 0 | ▶ | while ( exists( $hListeId{$id} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1362 | 0 | $debut = $nb_car - 4; | |||||||||||||||||||||||||||||||||||||||||
| 1363 | 0 | $motif = "%-" . $debut . "." . $debut . "s%0.3d"; # "%-3.3s%0.3d" | |||||||||||||||||||||||||||||||||||||||||
| 1364 | 0 | $id = sprintf( $motif, $id, $cpt_sub_call, chr( $cpt++ ) ); | |||||||||||||||||||||||||||||||||||||||||
| 1365 | 0 | ▶ | die "ERROR: cannot create a unique key" if ( $cpt >= 123 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||
| 1367 | # use Log::Log4perl; | ||||||||||||||||||||||||||||||||||||||||||
| 1368 | # Log::Log4perl->init("log.conf"); => read log.conf | ||||||||||||||||||||||||||||||||||||||||||
| 1369 | # $logger = Log::Log4perl->get_logger(""); | ||||||||||||||||||||||||||||||||||||||||||
| 1370 | # $logger->logdie("cannot create a unique key") if ($cpt >= 123); | ||||||||||||||||||||||||||||||||||||||||||
| 1371 | # $logger->trace("..."); # Log a trace message | ||||||||||||||||||||||||||||||||||||||||||
| 1372 | # $logger->debug("..."); # Log a debug message | ||||||||||||||||||||||||||||||||||||||||||
| 1373 | # $logger->info("..."); # Log a info message | ||||||||||||||||||||||||||||||||||||||||||
| 1374 | # $logger->warn("..."); # Log a warn message / $logger->error_warn("..."); (includes the call to warn() ) | ||||||||||||||||||||||||||||||||||||||||||
| 1375 | # $logger->error("..."); # Log a error message / $logger->logdie ("..."); (includes the call to die() ) | ||||||||||||||||||||||||||||||||||||||||||
| 1376 | # $logger->fatal("..."); # Log a fatal message | ||||||||||||||||||||||||||||||||||||||||||
| 1377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1379 | 0 | $hListeId{$id} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1380 | 0 | return $id; | |||||||||||||||||||||||||||||||||||||||||
| 1381 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1383 | |||||||||||||||||||||||||||||||||||||||||||
| 1384 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1385 | 20 | my $_backup_date; | |||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||
| 1387 | 0 | ▶ | sub oe_set_sys_date { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_set_sys_date: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1388 | 0 | my $requested_date = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1389 | |||||||||||||||||||||||||||||||||||||||||||
| 1390 | 0 | my $time = time; | |||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | my ( $year, $month, $day, $hour, $min, $sec, $doy, $dow, $dst ) = Gmtime($time); | |||||||||||||||||||||||||||||||||||||||||
| 1392 | |||||||||||||||||||||||||||||||||||||||||||
| 1393 | 0 | my $commande = sprintf( "date %s", $requested_date ); | |||||||||||||||||||||||||||||||||||||||||
| 1394 | 0 | warn "INFO: $commande\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1395 | |||||||||||||||||||||||||||||||||||||||||||
| 1396 | 0 | eval { system($commande); }; | |||||||||||||||||||||||||||||||||||||||||
| 1397 | |||||||||||||||||||||||||||||||||||||||||||
| 1398 | # if ($?){ | ||||||||||||||||||||||||||||||||||||||||||
| 1399 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1400 | 0 | warn "ERROR: command failed $commande : $@\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1401 | 0 | return -1; | |||||||||||||||||||||||||||||||||||||||||
| 1402 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1403 | |||||||||||||||||||||||||||||||||||||||||||
| 1404 | 0 | ▶ | if ( !defined $_backup_date ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1405 | 0 | $_backup_date = sprintf( "%02s-%02s-%02s", $day, $month, $year ); | |||||||||||||||||||||||||||||||||||||||||
| 1406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1407 | 0 | return $_backup_date; | |||||||||||||||||||||||||||||||||||||||||
| 1408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1409 | |||||||||||||||||||||||||||||||||||||||||||
| 1410 | 20 | ▶ | sub _restore_sys_date { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_restore_sys_date: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||||||
| 1411 | 20 | ▶ | oe_set_sys_date($_backup_date) if ( defined $_backup_date ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1412 | 20 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1414 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1415 | |||||||||||||||||||||||||||||||||||||||||||
| 1416 | # Return the handle to the output file, croaking if it was not opened yet. | ||||||||||||||||||||||||||||||||||||||||||
| 1417 | 20 | ▶ | sub _oe_get_handle_to_output_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_oe_get_handle_to_output_file: not called CC=2 SCAR=15.1
| |||||||||||||||||||||||||||||||||||||||||||
| 1418 | 0 | my $fh = openhandle(*OUT); | |||||||||||||||||||||||||||||||||||||||||
| 1419 | 0 | ▶ | if ( !defined $fh ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1420 | 0 | croak | |||||||||||||||||||||||||||||||||||||||||
| 1421 | "You tried to use the handle to the output file. However, the output file has not been opened yet!"; | ||||||||||||||||||||||||||||||||||||||||||
| 1422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1423 | 0 | return $fh; | |||||||||||||||||||||||||||||||||||||||||
| 1424 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1425 | |||||||||||||||||||||||||||||||||||||||||||
| 1426 | # Return the handle to the input file (the file that holds the Infinite flux). | ||||||||||||||||||||||||||||||||||||||||||
| 1427 | # @note The IN handle should not be accessed directly from outside this module | ||||||||||||||||||||||||||||||||||||||||||
| 1428 | # (all the more so as a global variable!). | ||||||||||||||||||||||||||||||||||||||||||
| 1429 | # @TODO write a function oe_read_from_input_file(). | ||||||||||||||||||||||||||||||||||||||||||
| 1430 | 0 | ▶ | sub oe_get_handle_to_input_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_get_handle_to_input_file: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1431 | 0 | my $fh = openhandle(*IN); | |||||||||||||||||||||||||||||||||||||||||
| 1432 | 0 | ▶ | if ( !defined $fh ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1433 | 0 | croak | |||||||||||||||||||||||||||||||||||||||||
| 1434 | "You tried to use the handle to the input file. However, the input file has not been opened yet!"; | ||||||||||||||||||||||||||||||||||||||||||
| 1435 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1436 | 0 | return $fh; | |||||||||||||||||||||||||||||||||||||||||
| 1437 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||||||||||||||||
| 1439 | # Print a text into the output file. | ||||||||||||||||||||||||||||||||||||||||||
| 1440 | # @param [string] $in_text text to print. | ||||||||||||||||||||||||||||||||||||||||||
| 1441 | # @note all actions on the output file should go through an "output adaptor" | ||||||||||||||||||||||||||||||||||||||||||
| 1442 | # implemented as a plugin (a class implementing an interface). | ||||||||||||||||||||||||||||||||||||||||||
| 1443 | 0 | ▶ | sub oe_print_to_output_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_print_to_output_file: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1444 | 0 | my $in_text = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1445 | 0 | ▶ | croak 'in_text undef' if !defined $in_text; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1446 | 0 | my $fh = _oe_get_handle_to_output_file(); | |||||||||||||||||||||||||||||||||||||||||
| 1447 | 0 | return print $fh $in_text; | |||||||||||||||||||||||||||||||||||||||||
| 1448 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||||||||||||
| 1450 | # Print a text into the "output debug file". | ||||||||||||||||||||||||||||||||||||||||||
| 1451 | # @param [string] $in_text text to print. | ||||||||||||||||||||||||||||||||||||||||||
| 1452 | # @note the behaviour of this function can be configured through the | ||||||||||||||||||||||||||||||||||||||||||
| 1453 | # environment variables listed below: | ||||||||||||||||||||||||||||||||||||||||||
| 1454 | # - MNT_OUTPUT_DUMP_MODE: activate or deactivate the recording (0: off, 1: on). | ||||||||||||||||||||||||||||||||||||||||||
| 1455 | # - MNT_OUTPUT_DUMP_PATH: the path to the file used to store the recorded data. | ||||||||||||||||||||||||||||||||||||||||||
| 1456 | # both environment variables have default values (see | ||||||||||||||||||||||||||||||||||||||||||
| 1457 | # $_DEFAULT_OUTPUT_DUMP_MODE and $_DEFAULT_OUTPUT_DUMP_FILE). | ||||||||||||||||||||||||||||||||||||||||||
| 1458 | 0 | ▶ | sub _dump { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dump: not called CC=8 SCAR=39.7
| |||||||||||||||||||||||||||||||||||||||||||
| 1459 | 0 | my ($in_text) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1460 | |||||||||||||||||||||||||||||||||||||||||||
| 1461 | my $dump_mode = | ||||||||||||||||||||||||||||||||||||||||||
| 1462 | exists $ENV{MNT_OUTPUT_DUMP_MODE} && defined $ENV{MNT_OUTPUT_DUMP_MODE} | ||||||||||||||||||||||||||||||||||||||||||
| 1463 | ? $ENV{MNT_OUTPUT_DUMP_MODE} | ||||||||||||||||||||||||||||||||||||||||||
| 1464 | 0 | ▶ | : $_DEFAULT_OUTPUT_DUMP_MODE; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $ENV{"MNT_OUTPUT_DUMP_MODE"} and defined $ENV{"MNT_OUTPUT_DUMP_MODE"}
MC/DC0%0/2
exists $ENV{"MNT_OUTPUT_DUMP_MODE"} and defined $ENV{"MNT_OUTPUT_DUMP_MODE"}
exists $ENV{"MNT_OUTPUT_DUMP_MODE"}
defined $ENV{"MNT_OUTPUT_DUMP_MODE"}
Truth table0%0/3
A and B
A= exists $ENV{"MNT_OUTPUT_DUMP_MODE"}B= defined $ENV{"MNT_OUTPUT_DUMP_MODE"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1465 | 0 | ▶ | if ( !$dump_mode ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1466 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1467 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1468 | |||||||||||||||||||||||||||||||||||||||||||
| 1469 | my $dump_path = | ||||||||||||||||||||||||||||||||||||||||||
| 1470 | exists $ENV{MNT_OUTPUT_DUMP_PATH} && defined $ENV{MNT_OUTPUT_DUMP_PATH} | ||||||||||||||||||||||||||||||||||||||||||
| 1471 | ? $ENV{MNT_OUTPUT_DUMP_PATH} | ||||||||||||||||||||||||||||||||||||||||||
| 1472 | 0 | ▶ | : $_DEFAULT_OUTPUT_DUMP_FILE; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $ENV{"MNT_OUTPUT_DUMP_PATH"} and defined $ENV{"MNT_OUTPUT_DUMP_PATH"}
MC/DC0%0/2
exists $ENV{"MNT_OUTPUT_DUMP_PATH"} and defined $ENV{"MNT_OUTPUT_DUMP_PATH"}
exists $ENV{"MNT_OUTPUT_DUMP_PATH"}
defined $ENV{"MNT_OUTPUT_DUMP_PATH"}
Truth table0%0/3
A and B
A= exists $ENV{"MNT_OUTPUT_DUMP_PATH"}B= defined $ENV{"MNT_OUTPUT_DUMP_PATH"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1473 | 20 | ▶ | use open ':encoding(iso-8859-15)'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1474 | 0 | ▶ | open( my $fd, '>>', $dump_path ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1475 | or die sprintf( | ||||||||||||||||||||||||||||||||||||||||||
| 1476 | 'The module "%s::Main" is configured to record all text written to the output file. Can not open the dump file "%s": %s.', | ||||||||||||||||||||||||||||||||||||||||||
| 1477 | __PACKAGE__, $dump_path, $! ); | ||||||||||||||||||||||||||||||||||||||||||
| 1478 | 0 | printf $fd "%s\n", $in_text; | |||||||||||||||||||||||||||||||||||||||||
| 1479 | 0 | ▶ | close($fd) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1480 | or die sprintf( | ||||||||||||||||||||||||||||||||||||||||||
| 1481 | 'The module "%s::Main" is configured to record all text written to the output file. Can not close the dump file "%s": %s.', | ||||||||||||||||||||||||||||||||||||||||||
| 1482 | __PACKAGE__, $dump_path, $! ); | ||||||||||||||||||||||||||||||||||||||||||
| 1483 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1484 | |||||||||||||||||||||||||||||||||||||||||||
| 1485 | # Dictionary of the applications' backgrounds. | ||||||||||||||||||||||||||||||||||||||||||
| 1486 | 20 | my $_DICO_BACKGROUNDS; | |||||||||||||||||||||||||||||||||||||||||
| 1487 | |||||||||||||||||||||||||||||||||||||||||||
| 1488 | 0 | ▶ | sub oe_backgrounds_apps { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_backgrounds_apps: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1489 | 0 | my ($section) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1490 | |||||||||||||||||||||||||||||||||||||||||||
| 1491 | 0 | my $cfg = config_read(); | |||||||||||||||||||||||||||||||||||||||||
| 1492 | 0 | ▶ | if ( !defined($_DICO_BACKGROUNDS) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1493 | $_DICO_BACKGROUNDS = | ||||||||||||||||||||||||||||||||||||||||||
| 1494 | 0 | oEdtk::Dict->new( $cfg->{'EDTK_APPS_BACKGROUNDS'}, { section => $section } ); | |||||||||||||||||||||||||||||||||||||||||
| 1495 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1496 | 0 | return $_DICO_BACKGROUNDS->translate( $cfg->{EDTK_PRGNAME} ); | |||||||||||||||||||||||||||||||||||||||||
| 1497 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1498 | |||||||||||||||||||||||||||||||||||||||||||
| 1499 | # Clean up an address line in place to build the recipient address blocks. | ||||||||||||||||||||||||||||||||||||||||||
| 1500 | # It works on the reference to the variable and also returns the resulting string. | ||||||||||||||||||||||||||||||||||||||||||
| 1501 | ## no critic (ProhibitSubroutinePrototypes) | ||||||||||||||||||||||||||||||||||||||||||
| 1502 | 0 | ▶ | sub oe_clean_addr(\$) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_clean_addr: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1503 | 0 | my $rLine = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||||||||||||||||
| 1505 | # default value when the field is undef | ||||||||||||||||||||||||||||||||||||||||||
| 1506 | 0 | ▶ | if ( !defined($$rLine) || length($$rLine) == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $$rLine or length $$rLine == 0
MC/DC0%0/2
not defined $$rLine or length $$rLine == 0
not defined $$rLine
length $$rLine == 0
Truth table0%0/3
not(A) or B
A= not defined $$rLineB= length $$rLine == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 1507 | 0 | $$rLine = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1508 | 0 | return $$rLine; | |||||||||||||||||||||||||||||||||||||||||
| 1509 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||||||||||||
| 1511 | 0 | chomp($$rLine); # make sure there is no trailing newline | |||||||||||||||||||||||||||||||||||||||||
| 1512 | 0 | oe_trimp_space($rLine); | |||||||||||||||||||||||||||||||||||||||||
| 1513 | |||||||||||||||||||||||||||||||||||||||||||
| 1514 | 0 | $$rLine = oe_char_xlate( $$rLine, 'ADDRESS' ); | |||||||||||||||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||||||||||||||||
| 1516 | # TODO: a regular expression turning every non 0-9\-\w character into blanks... XXX | ||||||||||||||||||||||||||||||||||||||||||
| 1517 | |||||||||||||||||||||||||||||||||||||||||||
| 1518 | 0 | $$rLine =~ s/^\s+//; # left trim: drop leading blanks | |||||||||||||||||||||||||||||||||||||||||
| 1519 | 0 | $$rLine =~ s/\s+$//; # right trim: drop trailing blanks | |||||||||||||||||||||||||||||||||||||||||
| 1520 | 0 | $$rLine =~ s/^0\s+//; # drop a lone leading zero (after the trims) | |||||||||||||||||||||||||||||||||||||||||
| 1521 | 0 | $$rLine =~ s/\s+/ /; # collapse consecutive blanks | |||||||||||||||||||||||||||||||||||||||||
| 1522 | 0 | $$rLine =~ s/(\s{1}\W{1}){2}/$1/; # drop a blank followed by a non-alphanumeric | |||||||||||||||||||||||||||||||||||||||||
| 1523 | 0 | $$rLine =~ s/\W+$//; # drop trailing non-alphanumeric characters | |||||||||||||||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||||||||||||||||
| 1525 | 0 | return $$rLine; | |||||||||||||||||||||||||||||||||||||||||
| 1526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1527 | |||||||||||||||||||||||||||||||||||||||||||
| 1528 | # Production type: the first letter of the EDTK_TYPE_ENV configuration value. | ||||||||||||||||||||||||||||||||||||||||||
| 1529 | 0 | ▶ | sub oe_typ_prod { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_typ_prod: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1530 | 0 | my ($cfg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1531 | 0 | ▶ | $cfg //= config_read(); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$cfg //= config_read()
MC/DC0%0/2
$cfg //= config_read()
$cfg
config_read()
Truth table0%0/3
A //= B
A= $cfgB= config_read()
| |||||||||||||||||||||||||||||||||||||||||||
| 1532 | 0 | ▶ | my $env = $cfg->{'EDTK_TYPE_ENV'} // croak 'Env. var. EDTK_TYPE_ENV undef'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$cfg->{"EDTK_TYPE_ENV"} // croak("Env. var. EDTK_TYPE_ENV undef")
MC/DC0%0/1
$cfg->{"EDTK_TYPE_ENV"} // croak("Env. var. EDTK_TYPE_ENV undef")
$cfg->{"EDTK_TYPE_ENV"}
Truth table0%0/2
A
A= $cfg->{"EDTK_TYPE_ENV"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1533 | 0 | return substr( $env, 0, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 1534 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1535 | |||||||||||||||||||||||||||||||||||||||||||
| 1536 | # Create a new "job definition" and, if needed, run asynchronously the process | ||||||||||||||||||||||||||||||||||||||||||
| 1537 | # that produces the output (pdf) file. When run asynchronously the "job | ||||||||||||||||||||||||||||||||||||||||||
| 1538 | # definition" is a "FIFO file", otherwise it is a text file (.txt). | ||||||||||||||||||||||||||||||||||||||||||
| 1539 | # The job file name carries the application name (e.g. "PRACI-AC014.txt") and is | ||||||||||||||||||||||||||||||||||||||||||
| 1540 | # reachable through the global file handle OUT. | ||||||||||||||||||||||||||||||||||||||||||
| 1541 | # @param [array] a list of command line options: --help, --index, --edms, | ||||||||||||||||||||||||||||||||||||||||||
| 1542 | # --bpdf, --cgi, --noinputfiles, --input_code=s (e.g. utf8). | ||||||||||||||||||||||||||||||||||||||||||
| 1543 | # @note the input data file (generated by Infinite) is opened and reachable | ||||||||||||||||||||||||||||||||||||||||||
| 1544 | # through the global file handle IN. | ||||||||||||||||||||||||||||||||||||||||||
| 1545 | 0 | ▶ | sub oe_new_job_input_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_new_job_input_file: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1546 | 0 | my $params = oe_params(); | |||||||||||||||||||||||||||||||||||||||||
| 1547 | |||||||||||||||||||||||||||||||||||||||||||
| 1548 | 0 | ▶ | if ( $params->{'input_code'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1549 | 0 | $params->{'input_code'} = "<:encoding(" . $params->{'input_code'} . ")"; | |||||||||||||||||||||||||||||||||||||||||
| 1550 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1551 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1552 | 0 | $params->{'input_code'} = "<"; | |||||||||||||||||||||||||||||||||||||||||
| 1553 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1554 | |||||||||||||||||||||||||||||||||||||||||||
| 1555 | 0 | my $fi; | |||||||||||||||||||||||||||||||||||||||||
| 1556 | 0 | ▶ | if ( $params->{help} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1557 | 0 | oe_app_usage(); | |||||||||||||||||||||||||||||||||||||||||
| 1558 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||
| 1559 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1560 | elsif ( $params->{noinputfiles} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1561 | 0 | $fi = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1562 | 0 | warn "INFO: no input file for this treatment\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1563 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1564 | elsif ( !scalar @ARGV ) { # TO KEEP COMPATIBILITY | ||||||||||||||||||||||||||||||||||||||||||
| 1565 | 0 | oe_app_usage(); | |||||||||||||||||||||||||||||||||||||||||
| 1566 | 0 | exit 0; | |||||||||||||||||||||||||||||||||||||||||
| 1567 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1568 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1569 | 0 | $fi = $ARGV[0]; # TO KEEP COMPATIBILITY | |||||||||||||||||||||||||||||||||||||||||
| 1570 | 0 | $params->{'inputfile'} = $fi; | |||||||||||||||||||||||||||||||||||||||||
| 1571 | |||||||||||||||||||||||||||||||||||||||||||
| 1572 | 0 | ▶ | open( IN, $params->{input_code}, $fi ) ## no critic (InputOutput::ProhibitBarewordFileHandles) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1573 | or die sprintf( 'Cannot open the input file "%s": %s', $fi, $! ); | ||||||||||||||||||||||||||||||||||||||||||
| 1574 | 0 | warn "INFO: input perl data is $fi (encode '" . $params->{'input_code'} . "' $ARGV[-1])\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1576 | |||||||||||||||||||||||||||||||||||||||||||
| 1577 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1578 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1579 | |||||||||||||||||||||||||||||||||||||||||||
| 1580 | 0 | ▶ | sub oe_new_job_output_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_new_job_output_file: not called CC=16 SCAR=56.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1581 | 0 | my $params = oe_params(); | |||||||||||||||||||||||||||||||||||||||||
| 1582 | 0 | my $cfg = oe_config_compo(); | |||||||||||||||||||||||||||||||||||||||||
| 1583 | |||||||||||||||||||||||||||||||||||||||||||
| 1584 | 0 | $params->{'outfile'} = $cfg->{'EDTK_PRGNAME'} . ".txt"; # should be tied to TexMode | |||||||||||||||||||||||||||||||||||||||||
| 1585 | 0 | ▶ | $params->{'output_code'} = $cfg->{'EDTK_OUT_ENCODING'} || 'utf8'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$cfg->{'EDTK_OUT_ENCODING'} || 'utf8'
MC/DC0%0/1
$cfg->{'EDTK_OUT_ENCODING'} || 'utf8'
$cfg->{'EDTK_OUT_ENCODING'}
Truth table0%0/2
A
A= $cfg->{'EDTK_OUT_ENCODING'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1586 | 0 | $params->{'output_code'} = ">:encoding(" . $params->{'output_code'} . ")"; | |||||||||||||||||||||||||||||||||||||||||
| 1587 | |||||||||||||||||||||||||||||||||||||||||||
| 1588 | # Override default setting if EDTK_COMPO_ASYNC is set in edtk.ini. | ||||||||||||||||||||||||||||||||||||||||||
| 1589 | |||||||||||||||||||||||||||||||||||||||||||
| 1590 | 0 | ▶ | if ( exists $cfg->{'EDTK_COMPO_ASYNC'} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $cfg->{"EDTK_COMPO_ASYNC"} and defined $cfg->{"EDTK_COMPO_ASYNC"} and $cfg->{"EDTK_COMPO_ASYNC"}
exists $cfg->{"EDTK_COMPO_ASYNC"} and defined $cfg->{"EDTK_COMPO_ASYNC"}
MC/DC0%0/3
exists $cfg->{"EDTK_COMPO_ASYNC"} and defined $cfg->{"EDTK_COMPO_ASYNC"} and $cfg->{"EDTK_COMPO_ASYNC"}
exists $cfg->{"EDTK_COMPO_ASYNC"}
defined $cfg->{"EDTK_COMPO_ASYNC"}
$cfg->{"EDTK_COMPO_ASYNC"}
Truth table0%0/4
A and B and C
A= exists $cfg->{"EDTK_COMPO_ASYNC"}B= defined $cfg->{"EDTK_COMPO_ASYNC"}C= $cfg->{"EDTK_COMPO_ASYNC"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1591 | && defined $cfg->{'EDTK_COMPO_ASYNC'} | ||||||||||||||||||||||||||||||||||||||||||
| 1592 | && $cfg->{'EDTK_COMPO_ASYNC'} ) | ||||||||||||||||||||||||||||||||||||||||||
| 1593 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1594 | 0 | my $async = $cfg->{'EDTK_COMPO_ASYNC'}; | |||||||||||||||||||||||||||||||||||||||||
| 1595 | 0 | ▶ | if ( $async =~ /^yes$/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1596 | 0 | $params->{'fifo'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1597 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1598 | elsif ( $async =~ /^no$/i ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1599 | 0 | $params->{'fifo'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1600 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1601 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1602 | 0 | die sprintf | |||||||||||||||||||||||||||||||||||||||||
| 1603 | 'Unexpected value for configuration tag EDTK_COMPO_ASYNC: "%s"', | ||||||||||||||||||||||||||||||||||||||||||
| 1604 | $async; | ||||||||||||||||||||||||||||||||||||||||||
| 1605 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1606 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1607 | |||||||||||||||||||||||||||||||||||||||||||
| 1608 | 0 | ▶ | if ( $params->{'fifo'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1609 | 0 | ▶ | if ( ( exists $cfg->{EDTK_FIFO_MODE} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
exists $cfg->{"EDTK_FIFO_MODE"} and $cfg->{"EDTK_FIFO_MODE"} eq "NONE"
MC/DC0%0/2
exists $cfg->{"EDTK_FIFO_MODE"} and $cfg->{"EDTK_FIFO_MODE"} eq "NONE"
exists $cfg->{"EDTK_FIFO_MODE"}
$cfg->{"EDTK_FIFO_MODE"} eq "NONE"
Truth table0%0/3
A and B
A= exists $cfg->{"EDTK_FIFO_MODE"}B= $cfg->{"EDTK_FIFO_MODE"} eq "NONE"
| |||||||||||||||||||||||||||||||||||||||||||
| 1610 | && ( $cfg->{EDTK_FIFO_MODE} eq 'NONE' ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 1611 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1612 | 0 | warn "INFO: Deactivating FIFO MODE, as requested in the configuration"; | |||||||||||||||||||||||||||||||||||||||||
| 1613 | 0 | $params->{'fifo'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1614 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1615 | elsif ( $^O eq 'MSWin32' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1616 | 0 | warn "INFO: FIFO mode is not possible under Windows, ignoring.\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1617 | 0 | $params->{'fifo'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1618 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1619 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1620 | |||||||||||||||||||||||||||||||||||||||||||
| 1621 | # In FIFO mode a left-over text file makes mkfifo() fail; without FIFO mode a | ||||||||||||||||||||||||||||||||||||||||||
| 1622 | # left-over FIFO would hang us indefinitely, so remove it first. | ||||||||||||||||||||||||||||||||||||||||||
| 1623 | 0 | ▶ | if ( -e $params->{'outfile'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1624 | unlink( $params->{'outfile'} ) | ||||||||||||||||||||||||||||||||||||||||||
| 1625 | 0 | ▶ | or die( sprintf 'Cannot remove the file "%s": %s', $params->{'outfile'}, $! ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1626 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1627 | |||||||||||||||||||||||||||||||||||||||||||
| 1628 | # start the LaTeX engine when the FIFO mode is activated. | ||||||||||||||||||||||||||||||||||||||||||
| 1629 | 0 | ▶ | if ( $params->{'fifo'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1630 | mkfifo( $params->{'outfile'}, oct(700) ) | ||||||||||||||||||||||||||||||||||||||||||
| 1631 | or die | ||||||||||||||||||||||||||||||||||||||||||
| 1632 | 0 | ▶ | sprintf( 'ERROR: Could not create fifo in file "%s": %s', $params->{'outfile'}, $! ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1633 | 0 | my $pid = oe_compo_run( $cfg->{'EDTK_PRGNAME'}, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1634 | 0 | $params->{'pid'} = $pid; | |||||||||||||||||||||||||||||||||||||||||
| 1635 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1636 | |||||||||||||||||||||||||||||||||||||||||||
| 1637 | # create the output file "/path/to/lateX/file.tex". | ||||||||||||||||||||||||||||||||||||||||||
| 1638 | 0 | _dump( sprintf "\n%%\n%% ==> %s <==\n%%\n%%", $params->{outfile} ); | |||||||||||||||||||||||||||||||||||||||||
| 1639 | open( OUT, $params->{output_code}, $params->{outfile} ) ## no critic (InputOutput::ProhibitBarewordFileHandles) | ||||||||||||||||||||||||||||||||||||||||||
| 1640 | 0 | ▶ | or die sprintf 'Can not open the output file "%s": %s', $params->{outfile}, $!; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1641 | warn sprintf( 'INFO: input compo data is "%s" (encode is "%s".', | ||||||||||||||||||||||||||||||||||||||||||
| 1642 | 0 | $params->{'outfile'}, $params->{'output_code'} ); | |||||||||||||||||||||||||||||||||||||||||
| 1643 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1644 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1645 | |||||||||||||||||||||||||||||||||||||||||||
| 1646 | 0 | ▶ | sub oe_watermark { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_watermark: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1647 | 0 | my ($cfg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1648 | 0 | ▶ | $cfg //= config_read('COMPO'); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$cfg //= config_read("COMPO")
MC/DC0%0/2
$cfg //= config_read("COMPO")
$cfg
config_read("COMPO")
Truth table0%0/3
A //= B
A= $cfgB= config_read("COMPO")
| |||||||||||||||||||||||||||||||||||||||||||
| 1649 | 0 | ▶ | return $cfg->{'EDTK_WATERMARKTEXT'} || q{ }; # XXX //? | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$cfg->{'EDTK_WATERMARKTEXT'} || ' '
MC/DC0%0/1
$cfg->{'EDTK_WATERMARKTEXT'} || ' '
$cfg->{'EDTK_WATERMARKTEXT'}
Truth table0%0/2
A
A= $cfg->{'EDTK_WATERMARKTEXT'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1650 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1651 | |||||||||||||||||||||||||||||||||||||||||||
| 1652 | # Getter (no argument) / setter (a hash ref) for the run parameters. | ||||||||||||||||||||||||||||||||||||||||||
| 1653 | 0 | ▶ | sub oe_params { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_params: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1654 | 0 | my ($params) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1655 | 0 | state $_RUN_PARAMS; | |||||||||||||||||||||||||||||||||||||||||
| 1656 | 0 | ▶ | if ( defined $params ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1657 | 0 | $_RUN_PARAMS = $params; | |||||||||||||||||||||||||||||||||||||||||
| 1658 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1659 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1660 | 0 | return $_RUN_PARAMS; | |||||||||||||||||||||||||||||||||||||||||
| 1661 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1662 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1663 | |||||||||||||||||||||||||||||||||||||||||||
| 1664 | # The COMPO configuration, read once per run. | ||||||||||||||||||||||||||||||||||||||||||
| 1665 | 0 | ▶ | sub oe_config_compo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_config_compo: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 1666 | 0 | state $_RUN_CFG = config_read(); | |||||||||||||||||||||||||||||||||||||||||
| 1667 | 0 | return $_RUN_CFG; | |||||||||||||||||||||||||||||||||||||||||
| 1668 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1669 | |||||||||||||||||||||||||||||||||||||||||||
| 1670 | 0 | ▶ | sub oe_options { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_options: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1671 | 0 | my (@args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1672 | 0 | my $params = oe_params(); # read (getter) | |||||||||||||||||||||||||||||||||||||||||
| 1673 | 0 | my $cfg = oe_config_compo(); | |||||||||||||||||||||||||||||||||||||||||
| 1674 | 0 | ▶ | return ( $params, $cfg ) if defined $params; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1675 | 0 | $params = {}; | |||||||||||||||||||||||||||||||||||||||||
| 1676 | |||||||||||||||||||||||||||||||||||||||||||
| 1677 | # load all configuration parameters that describe the publication | ||||||||||||||||||||||||||||||||||||||||||
| 1678 | # environment: EDTK_BIN_COMPO, EDTK_COMPO, EDTK_COMPO_CMD_PDF... | ||||||||||||||||||||||||||||||||||||||||||
| 1679 | 0 | my $defaults = {%DEFAULT_OPTIONS}; | |||||||||||||||||||||||||||||||||||||||||
| 1680 | 0 | GetOptionsFromArray( | |||||||||||||||||||||||||||||||||||||||||
| 1681 | [ @ARGV, @args ], $defaults, 'help', 'index', | ||||||||||||||||||||||||||||||||||||||||||
| 1682 | 'massmail', 'edms', 'bpdf', 'cgi', | ||||||||||||||||||||||||||||||||||||||||||
| 1683 | 'noinputfiles', 'input_code=s', 'iddoc=s', 'nocallplan', | ||||||||||||||||||||||||||||||||||||||||||
| 1684 | 'forced-paper' | ||||||||||||||||||||||||||||||||||||||||||
| 1685 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1686 | 0 | ▶ | while ( my ( $key, $val ) = each( %{$defaults} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1687 | 0 | ▶ | $params->{$key} //= $val; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$params->{$key} //= $val
MC/DC0%0/2
$params->{$key} //= $val
$params->{$key}
$val
Truth table0%0/3
A //= B
A= $params->{$key}B= $val
| |||||||||||||||||||||||||||||||||||||||||||
| 1688 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1689 | 0 | $params->{'doclib'} = _omngr_doclib(); | |||||||||||||||||||||||||||||||||||||||||
| 1690 | 0 | ▶ | if ( exists $params->{'iddoc'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1691 | 0 | $_ID_LDOC = $params->{'iddoc'}; | |||||||||||||||||||||||||||||||||||||||||
| 1692 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1693 | 0 | $params->{'idldoc'} = oe_ID_LDOC(); | |||||||||||||||||||||||||||||||||||||||||
| 1694 | |||||||||||||||||||||||||||||||||||||||||||
| 1695 | 0 | $params->{'type-prod'} = oe_typ_prod($cfg); | |||||||||||||||||||||||||||||||||||||||||
| 1696 | 0 | $params->{'HOST-NAME'} = hostname(); | |||||||||||||||||||||||||||||||||||||||||
| 1697 | 0 | $params->{'app-ref'} = $cfg->{'EDTK_PRGNAME'}; | |||||||||||||||||||||||||||||||||||||||||
| 1698 | 0 | ▶ | if ( $params->{'index'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1699 | 0 | $params->{'activate-lotissement'} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1700 | 0 | $params->{'Host-name'} = hostname(); | |||||||||||||||||||||||||||||||||||||||||
| 1701 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1702 | 0 | ▶ | $defaults->{'fifo'} = ( $^O eq 'MSWin32' ) ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1703 | 0 | ▶ | my $env = $cfg->{'EDTK_TYPE_ENV'} // croak "Env. var. 'EDTK_TYPE_ENV' undef"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$cfg->{"EDTK_TYPE_ENV"} // croak("Env. var. 'EDTK_TYPE_ENV' undef")
MC/DC0%0/1
$cfg->{"EDTK_TYPE_ENV"} // croak("Env. var. 'EDTK_TYPE_ENV' undef")
$cfg->{"EDTK_TYPE_ENV"}
Truth table0%0/2
A
A= $cfg->{"EDTK_TYPE_ENV"}
| |||||||||||||||||||||||||||||||||||||||||||
| 1704 | 0 | ▶ | if ( $env eq 'Production' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1705 | 0 | $params->{'type-app'} = 'prod'; | |||||||||||||||||||||||||||||||||||||||||
| 1706 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1707 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1708 | 0 | $params->{'watermark'} = oe_watermark($cfg); | |||||||||||||||||||||||||||||||||||||||||
| 1709 | 0 | $params->{'type-app'} = 'test'; | |||||||||||||||||||||||||||||||||||||||||
| 1710 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1711 | |||||||||||||||||||||||||||||||||||||||||||
| 1712 | # handle options passed in the EDTK_OPTIONS environment variable. | ||||||||||||||||||||||||||||||||||||||||||
| 1713 | 0 | ▶ | if ( exists( $ENV{'EDTK_OPTIONS'} ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1714 | 0 | my @opts = split( ',', $ENV{'EDTK_OPTIONS'} ); | |||||||||||||||||||||||||||||||||||||||||
| 1715 | 0 | foreach my $opt (@opts) { | |||||||||||||||||||||||||||||||||||||||||
| 1716 | 0 | $params->{$opt} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 1717 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1718 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1719 | |||||||||||||||||||||||||||||||||||||||||||
| 1720 | 0 | oe_params($params); # write (setter) | |||||||||||||||||||||||||||||||||||||||||
| 1721 | 0 | return ( $params, $cfg ); | |||||||||||||||||||||||||||||||||||||||||
| 1722 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1723 | |||||||||||||||||||||||||||||||||||||||||||
| 1724 | # Historical name kept as an alias of oe_ID_LDOC (same format until S70). | ||||||||||||||||||||||||||||||||||||||||||
| 1725 | # The true generator: a fresh UUID on every call (fork F semantics, S70/D1). | ||||||||||||||||||||||||||||||||||||||||||
| 1726 | # oe_ID_LDOC is the memoized entry point; oe_new_ID_LDOC is exported for the | ||||||||||||||||||||||||||||||||||||||||||
| 1727 | # callers that genuinely want a new id. | ||||||||||||||||||||||||||||||||||||||||||
| 1728 | 1 | ▶ | sub oe_new_ID_LDOC { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_new_ID_LDOC: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1729 | 1 | $_ID_LDOC = Data::UUID->new->create_str(); | |||||||||||||||||||||||||||||||||||||||||
| 1730 | 1 | return $_ID_LDOC; | |||||||||||||||||||||||||||||||||||||||||
| 1731 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1732 | |||||||||||||||||||||||||||||||||||||||||||
| 1733 | 0 | ▶ | sub oe_simple_job { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
oe_simple_job: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1734 | 0 | my (@args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1735 | 0 | oe_options(@args); | |||||||||||||||||||||||||||||||||||||||||
| 1736 | 0 | oe_new_job_input_file(); | |||||||||||||||||||||||||||||||||||||||||
| 1737 | 0 | oe_new_job_output_file(); | |||||||||||||||||||||||||||||||||||||||||
| 1738 | 0 | return ( oe_params(), config_read() ); | |||||||||||||||||||||||||||||||||||||||||
| 1739 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1740 | |||||||||||||||||||||||||||||||||||||||||||
| 1741 | 20 | ▶ | END { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
END: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1742 | 20 | _restore_sys_date; | |||||||||||||||||||||||||||||||||||||||||
| 1743 | |||||||||||||||||||||||||||||||||||||||||||
| 1744 | # duplicate with oEdtk.pm : | ||||||||||||||||||||||||||||||||||||||||||
| 1745 | #warn "(c) 2005-2020 grechary\@cpan.org - edtk\@free.fr - oEdtk v$VERSION\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 1746 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1747 | |||||||||||||||||||||||||||||||||||||||||||
| 1748 | 20 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1749 | |||||||||||||||||||||||||||||||||||||||||||
| 1750 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 1751 | |||||||||||||||||||||||||||||||||||||||||||
| 1752 | oEdtk::Main - core helpers for the oEdtk document pipeline | ||||||||||||||||||||||||||||||||||||||||||
| 1753 | |||||||||||||||||||||||||||||||||||||||||||
| 1754 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 1755 | |||||||||||||||||||||||||||||||||||||||||||
| 1756 | use oEdtk::Main; | ||||||||||||||||||||||||||||||||||||||||||
| 1757 | |||||||||||||||||||||||||||||||||||||||||||
| 1758 | oe_simple_job(@ARGV); # options, input and output files | ||||||||||||||||||||||||||||||||||||||||||
| 1759 | oe_rec_motif($key, $pattern); # describe a record | ||||||||||||||||||||||||||||||||||||||||||
| 1760 | oe_process_ref_rec($off, $len, \$line); | ||||||||||||||||||||||||||||||||||||||||||
| 1761 | |||||||||||||||||||||||||||||||||||||||||||
| 1762 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 1763 | |||||||||||||||||||||||||||||||||||||||||||
| 1764 | The central module of the toolkit. It provides the record template engine | ||||||||||||||||||||||||||||||||||||||||||
| 1765 | (describe a record, match it in a line, unpack and process it), the address, | ||||||||||||||||||||||||||||||||||||||||||
| 1766 | text, date and number helpers, the input/output file handling, the | ||||||||||||||||||||||||||||||||||||||||||
| 1767 | document-batch id generation, and the job run lifecycle (option parsing, | ||||||||||||||||||||||||||||||||||||||||||
| 1768 | FIFO/LaTeX composition, dissemination). The exported globals C<*IN>, C<*OUT>, | ||||||||||||||||||||||||||||||||||||||||||
| 1769 | C<@DATATAB> and the C<%motifs>, C<%ouTags>, C<%evalSsTrt> hashes carry the run | ||||||||||||||||||||||||||||||||||||||||||
| 1770 | state. | ||||||||||||||||||||||||||||||||||||||||||
| 1771 | |||||||||||||||||||||||||||||||||||||||||||
| 1772 | =head1 FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 1773 | |||||||||||||||||||||||||||||||||||||||||||
| 1774 | =head2 date2time | ||||||||||||||||||||||||||||||||||||||||||
| 1775 | |||||||||||||||||||||||||||||||||||||||||||
| 1776 | date2time($date); | ||||||||||||||||||||||||||||||||||||||||||
| 1777 | |||||||||||||||||||||||||||||||||||||||||||
| 1778 | Deprecated: turn a C<YYYYMMDD> date into an epoch time through C<gmtime>. | ||||||||||||||||||||||||||||||||||||||||||
| 1779 | |||||||||||||||||||||||||||||||||||||||||||
| 1780 | =head2 prodEdtk_Current_Rec | ||||||||||||||||||||||||||||||||||||||||||
| 1781 | |||||||||||||||||||||||||||||||||||||||||||
| 1782 | my $key = prodEdtk_Current_Rec(); | ||||||||||||||||||||||||||||||||||||||||||
| 1783 | |||||||||||||||||||||||||||||||||||||||||||
| 1784 | Return the current record identifier. | ||||||||||||||||||||||||||||||||||||||||||
| 1785 | |||||||||||||||||||||||||||||||||||||||||||
| 1786 | =head2 prodEdtk_Previous_Rec | ||||||||||||||||||||||||||||||||||||||||||
| 1787 | |||||||||||||||||||||||||||||||||||||||||||
| 1788 | my $key = prodEdtk_Previous_Rec(); | ||||||||||||||||||||||||||||||||||||||||||
| 1789 | |||||||||||||||||||||||||||||||||||||||||||
| 1790 | Return the previous record identifier. | ||||||||||||||||||||||||||||||||||||||||||
| 1791 | |||||||||||||||||||||||||||||||||||||||||||
| 1792 | =head2 prodEtk_rec_cdata_join | ||||||||||||||||||||||||||||||||||||||||||
| 1793 | |||||||||||||||||||||||||||||||||||||||||||
| 1794 | prodEtk_rec_cdata_join($text); | ||||||||||||||||||||||||||||||||||||||||||
| 1795 | |||||||||||||||||||||||||||||||||||||||||||
| 1796 | Append C<$text> to the pending push value. | ||||||||||||||||||||||||||||||||||||||||||
| 1797 | |||||||||||||||||||||||||||||||||||||||||||
| 1798 | =head2 recEdtk_erase | ||||||||||||||||||||||||||||||||||||||||||
| 1799 | |||||||||||||||||||||||||||||||||||||||||||
| 1800 | recEdtk_erase($key); | ||||||||||||||||||||||||||||||||||||||||||
| 1801 | |||||||||||||||||||||||||||||||||||||||||||
| 1802 | Remove every piece of processing registered for the record C<$key>. | ||||||||||||||||||||||||||||||||||||||||||
| 1803 | |||||||||||||||||||||||||||||||||||||||||||
| 1804 | =head2 recEdtk_join_tmplte | ||||||||||||||||||||||||||||||||||||||||||
| 1805 | |||||||||||||||||||||||||||||||||||||||||||
| 1806 | recEdtk_join_tmplte($key, $pattern, $output); | ||||||||||||||||||||||||||||||||||||||||||
| 1807 | |||||||||||||||||||||||||||||||||||||||||||
| 1808 | Register a record's unpack pattern and output format together. | ||||||||||||||||||||||||||||||||||||||||||
| 1809 | |||||||||||||||||||||||||||||||||||||||||||
| 1810 | =head2 recEdtk_post_process | ||||||||||||||||||||||||||||||||||||||||||
| 1811 | |||||||||||||||||||||||||||||||||||||||||||
| 1812 | recEdtk_post_process($key, $code); | ||||||||||||||||||||||||||||||||||||||||||
| 1813 | |||||||||||||||||||||||||||||||||||||||||||
| 1814 | Attach the post-reformat processing C<$code> for the record C<$key>. | ||||||||||||||||||||||||||||||||||||||||||
| 1815 | |||||||||||||||||||||||||||||||||||||||||||
| 1816 | =head2 recEdtk_redefine | ||||||||||||||||||||||||||||||||||||||||||
| 1817 | |||||||||||||||||||||||||||||||||||||||||||
| 1818 | recEdtk_redefine($key, $pattern); | ||||||||||||||||||||||||||||||||||||||||||
| 1819 | |||||||||||||||||||||||||||||||||||||||||||
| 1820 | Reset and redefine the unpack pattern of the record C<$key>. | ||||||||||||||||||||||||||||||||||||||||||
| 1821 | |||||||||||||||||||||||||||||||||||||||||||
| 1822 | =head2 oe_app_usage | ||||||||||||||||||||||||||||||||||||||||||
| 1823 | |||||||||||||||||||||||||||||||||||||||||||
| 1824 | oe_app_usage(); | ||||||||||||||||||||||||||||||||||||||||||
| 1825 | |||||||||||||||||||||||||||||||||||||||||||
| 1826 | Print the application usage and exit. | ||||||||||||||||||||||||||||||||||||||||||
| 1827 | |||||||||||||||||||||||||||||||||||||||||||
| 1828 | =head2 oe_backgrounds_apps | ||||||||||||||||||||||||||||||||||||||||||
| 1829 | |||||||||||||||||||||||||||||||||||||||||||
| 1830 | my $set = oe_backgrounds_apps($section); | ||||||||||||||||||||||||||||||||||||||||||
| 1831 | |||||||||||||||||||||||||||||||||||||||||||
| 1832 | Look up the application's background set from C<EDTK_APPS_BACKGROUNDS>. | ||||||||||||||||||||||||||||||||||||||||||
| 1833 | |||||||||||||||||||||||||||||||||||||||||||
| 1834 | =head2 oe_CAP_sans_accents | ||||||||||||||||||||||||||||||||||||||||||
| 1835 | |||||||||||||||||||||||||||||||||||||||||||
| 1836 | oe_CAP_sans_accents(\$string); | ||||||||||||||||||||||||||||||||||||||||||
| 1837 | |||||||||||||||||||||||||||||||||||||||||||
| 1838 | Strip the accents from C<$string> and uppercase it, in place. | ||||||||||||||||||||||||||||||||||||||||||
| 1839 | |||||||||||||||||||||||||||||||||||||||||||
| 1840 | =head2 oe_char_xlate | ||||||||||||||||||||||||||||||||||||||||||
| 1841 | |||||||||||||||||||||||||||||||||||||||||||
| 1842 | my $out = oe_char_xlate($string); | ||||||||||||||||||||||||||||||||||||||||||
| 1843 | |||||||||||||||||||||||||||||||||||||||||||
| 1844 | Apply the character-translation dictionary to C<$string>. | ||||||||||||||||||||||||||||||||||||||||||
| 1845 | |||||||||||||||||||||||||||||||||||||||||||
| 1846 | =head2 oe_clean_addr | ||||||||||||||||||||||||||||||||||||||||||
| 1847 | |||||||||||||||||||||||||||||||||||||||||||
| 1848 | oe_clean_addr(\$string); | ||||||||||||||||||||||||||||||||||||||||||
| 1849 | |||||||||||||||||||||||||||||||||||||||||||
| 1850 | A stricter address cleanup (extra trims and C<\W> removal), in place. | ||||||||||||||||||||||||||||||||||||||||||
| 1851 | |||||||||||||||||||||||||||||||||||||||||||
| 1852 | =head2 oe_clean_addr_line | ||||||||||||||||||||||||||||||||||||||||||
| 1853 | |||||||||||||||||||||||||||||||||||||||||||
| 1854 | oe_clean_addr_line(\$string); | ||||||||||||||||||||||||||||||||||||||||||
| 1855 | |||||||||||||||||||||||||||||||||||||||||||
| 1856 | Clean a 38-character address line (trim, translate, C<EDTK_DICO_POST>), in | ||||||||||||||||||||||||||||||||||||||||||
| 1857 | place. | ||||||||||||||||||||||||||||||||||||||||||
| 1858 | |||||||||||||||||||||||||||||||||||||||||||
| 1859 | =head2 oe_close_fo | ||||||||||||||||||||||||||||||||||||||||||
| 1860 | |||||||||||||||||||||||||||||||||||||||||||
| 1861 | oe_close_fo($fh); | ||||||||||||||||||||||||||||||||||||||||||
| 1862 | |||||||||||||||||||||||||||||||||||||||||||
| 1863 | Close the output file handle. | ||||||||||||||||||||||||||||||||||||||||||
| 1864 | |||||||||||||||||||||||||||||||||||||||||||
| 1865 | =head2 oe_compo_link | ||||||||||||||||||||||||||||||||||||||||||
| 1866 | |||||||||||||||||||||||||||||||||||||||||||
| 1867 | oe_compo_link(@options); | ||||||||||||||||||||||||||||||||||||||||||
| 1868 | |||||||||||||||||||||||||||||||||||||||||||
| 1869 | Close the files, run (or wait for) LaTeX, and run the post-composition step. | ||||||||||||||||||||||||||||||||||||||||||
| 1870 | |||||||||||||||||||||||||||||||||||||||||||
| 1871 | =head2 oe_corporation_get | ||||||||||||||||||||||||||||||||||||||||||
| 1872 | |||||||||||||||||||||||||||||||||||||||||||
| 1873 | my $corp = oe_corporation_get(); | ||||||||||||||||||||||||||||||||||||||||||
| 1874 | |||||||||||||||||||||||||||||||||||||||||||
| 1875 | Return the current corporation. | ||||||||||||||||||||||||||||||||||||||||||
| 1876 | |||||||||||||||||||||||||||||||||||||||||||
| 1877 | =head2 oe_corporation_set | ||||||||||||||||||||||||||||||||||||||||||
| 1878 | |||||||||||||||||||||||||||||||||||||||||||
| 1879 | oe_corporation_set($value); | ||||||||||||||||||||||||||||||||||||||||||
| 1880 | |||||||||||||||||||||||||||||||||||||||||||
| 1881 | Translate and set the corporation from C<$value>. | ||||||||||||||||||||||||||||||||||||||||||
| 1882 | |||||||||||||||||||||||||||||||||||||||||||
| 1883 | =head2 oe_corporation_tag | ||||||||||||||||||||||||||||||||||||||||||
| 1884 | |||||||||||||||||||||||||||||||||||||||||||
| 1885 | my $tag = oe_corporation_tag(); | ||||||||||||||||||||||||||||||||||||||||||
| 1886 | |||||||||||||||||||||||||||||||||||||||||||
| 1887 | Return the corporation tag. | ||||||||||||||||||||||||||||||||||||||||||
| 1888 | |||||||||||||||||||||||||||||||||||||||||||
| 1889 | =head2 oe_data_build | ||||||||||||||||||||||||||||||||||||||||||
| 1890 | |||||||||||||||||||||||||||||||||||||||||||
| 1891 | oe_data_build($name, $value); | ||||||||||||||||||||||||||||||||||||||||||
| 1892 | |||||||||||||||||||||||||||||||||||||||||||
| 1893 | Emit a document tag string for C<$name> and C<$value>. | ||||||||||||||||||||||||||||||||||||||||||
| 1894 | |||||||||||||||||||||||||||||||||||||||||||
| 1895 | =head2 oe_date_biggest | ||||||||||||||||||||||||||||||||||||||||||
| 1896 | |||||||||||||||||||||||||||||||||||||||||||
| 1897 | my $date = oe_date_biggest($d1, $d2); | ||||||||||||||||||||||||||||||||||||||||||
| 1898 | |||||||||||||||||||||||||||||||||||||||||||
| 1899 | Return the later of two C<DD/MM/YYYY> dates. | ||||||||||||||||||||||||||||||||||||||||||
| 1900 | |||||||||||||||||||||||||||||||||||||||||||
| 1901 | =head2 oe_date_smallest | ||||||||||||||||||||||||||||||||||||||||||
| 1902 | |||||||||||||||||||||||||||||||||||||||||||
| 1903 | my $date = oe_date_smallest($d1, $d2); | ||||||||||||||||||||||||||||||||||||||||||
| 1904 | |||||||||||||||||||||||||||||||||||||||||||
| 1905 | Return the earlier of two C<DD/MM/YYYY> dates. | ||||||||||||||||||||||||||||||||||||||||||
| 1906 | |||||||||||||||||||||||||||||||||||||||||||
| 1907 | =head2 oe_define_TeX_output | ||||||||||||||||||||||||||||||||||||||||||
| 1908 | |||||||||||||||||||||||||||||||||||||||||||
| 1909 | oe_define_TeX_output(); | ||||||||||||||||||||||||||||||||||||||||||
| 1910 | |||||||||||||||||||||||||||||||||||||||||||
| 1911 | Set the output tag delimiters (default backslash, empty, percent). | ||||||||||||||||||||||||||||||||||||||||||
| 1912 | |||||||||||||||||||||||||||||||||||||||||||
| 1913 | =head2 oe_env_var_completion | ||||||||||||||||||||||||||||||||||||||||||
| 1914 | |||||||||||||||||||||||||||||||||||||||||||
| 1915 | oe_env_var_completion(\$path); | ||||||||||||||||||||||||||||||||||||||||||
| 1916 | |||||||||||||||||||||||||||||||||||||||||||
| 1917 | Expand C<$ENV> references inside the path C<$path>, in place. | ||||||||||||||||||||||||||||||||||||||||||
| 1918 | |||||||||||||||||||||||||||||||||||||||||||
| 1919 | =head2 oe_fmt_date | ||||||||||||||||||||||||||||||||||||||||||
| 1920 | |||||||||||||||||||||||||||||||||||||||||||
| 1921 | my $date = oe_fmt_date($date); | ||||||||||||||||||||||||||||||||||||||||||
| 1922 | |||||||||||||||||||||||||||||||||||||||||||
| 1923 | Normalise a C<DD/MM/YY> or C<DD/MM/YYYY> date. | ||||||||||||||||||||||||||||||||||||||||||
| 1924 | |||||||||||||||||||||||||||||||||||||||||||
| 1925 | =head2 oe_get_handle_to_input_file | ||||||||||||||||||||||||||||||||||||||||||
| 1926 | |||||||||||||||||||||||||||||||||||||||||||
| 1927 | my $fh = oe_get_handle_to_input_file(); | ||||||||||||||||||||||||||||||||||||||||||
| 1928 | |||||||||||||||||||||||||||||||||||||||||||
| 1929 | Return the input file handle, croaking when it is not open. | ||||||||||||||||||||||||||||||||||||||||||
| 1930 | |||||||||||||||||||||||||||||||||||||||||||
| 1931 | =head2 oe_ID_LDOC | ||||||||||||||||||||||||||||||||||||||||||
| 1932 | |||||||||||||||||||||||||||||||||||||||||||
| 1933 | my $id = oe_ID_LDOC($force); | ||||||||||||||||||||||||||||||||||||||||||
| 1934 | |||||||||||||||||||||||||||||||||||||||||||
| 1935 | Return the memoised document-batch id, optionally forcing a value. | ||||||||||||||||||||||||||||||||||||||||||
| 1936 | |||||||||||||||||||||||||||||||||||||||||||
| 1937 | =head2 oe_is_IDLDOC | ||||||||||||||||||||||||||||||||||||||||||
| 1938 | |||||||||||||||||||||||||||||||||||||||||||
| 1939 | my $ok = oe_is_IDLDOC($value); | ||||||||||||||||||||||||||||||||||||||||||
| 1940 | |||||||||||||||||||||||||||||||||||||||||||
| 1941 | Return true when C<$value> is a valid document-batch id. | ||||||||||||||||||||||||||||||||||||||||||
| 1942 | |||||||||||||||||||||||||||||||||||||||||||
| 1943 | =head2 oe_iso_country | ||||||||||||||||||||||||||||||||||||||||||
| 1944 | |||||||||||||||||||||||||||||||||||||||||||
| 1945 | my $label = oe_iso_country($country); | ||||||||||||||||||||||||||||||||||||||||||
| 1946 | |||||||||||||||||||||||||||||||||||||||||||
| 1947 | Translate a country through the ISO dictionary. | ||||||||||||||||||||||||||||||||||||||||||
| 1948 | |||||||||||||||||||||||||||||||||||||||||||
| 1949 | =head2 oe_list_encodings | ||||||||||||||||||||||||||||||||||||||||||
| 1950 | |||||||||||||||||||||||||||||||||||||||||||
| 1951 | oe_list_encodings(); | ||||||||||||||||||||||||||||||||||||||||||
| 1952 | |||||||||||||||||||||||||||||||||||||||||||
| 1953 | Print the encodings available from C<Encode>. | ||||||||||||||||||||||||||||||||||||||||||
| 1954 | |||||||||||||||||||||||||||||||||||||||||||
| 1955 | =head2 oe_new_ID_LDOC | ||||||||||||||||||||||||||||||||||||||||||
| 1956 | |||||||||||||||||||||||||||||||||||||||||||
| 1957 | my $id = oe_new_ID_LDOC(); | ||||||||||||||||||||||||||||||||||||||||||
| 1958 | |||||||||||||||||||||||||||||||||||||||||||
| 1959 | Generate a fresh document-batch id (a UUID). | ||||||||||||||||||||||||||||||||||||||||||
| 1960 | |||||||||||||||||||||||||||||||||||||||||||
| 1961 | =head2 oe_new_job | ||||||||||||||||||||||||||||||||||||||||||
| 1962 | |||||||||||||||||||||||||||||||||||||||||||
| 1963 | oe_new_job(); | ||||||||||||||||||||||||||||||||||||||||||
| 1964 | |||||||||||||||||||||||||||||||||||||||||||
| 1965 | Legacy job bootstrap: parse the options, open the input, create the output and | ||||||||||||||||||||||||||||||||||||||||||
| 1966 | emit the header tags. | ||||||||||||||||||||||||||||||||||||||||||
| 1967 | |||||||||||||||||||||||||||||||||||||||||||
| 1968 | =head2 oe_new_job_input_file | ||||||||||||||||||||||||||||||||||||||||||
| 1969 | |||||||||||||||||||||||||||||||||||||||||||
| 1970 | oe_new_job_input_file(); | ||||||||||||||||||||||||||||||||||||||||||
| 1971 | |||||||||||||||||||||||||||||||||||||||||||
| 1972 | Open the input file using the run parameters. | ||||||||||||||||||||||||||||||||||||||||||
| 1973 | |||||||||||||||||||||||||||||||||||||||||||
| 1974 | =head2 oe_now_time | ||||||||||||||||||||||||||||||||||||||||||
| 1975 | |||||||||||||||||||||||||||||||||||||||||||
| 1976 | my $stamp = oe_now_time(); | ||||||||||||||||||||||||||||||||||||||||||
| 1977 | |||||||||||||||||||||||||||||||||||||||||||
| 1978 | Deprecated: return a C<YYYYMMDDHHMMSS> timestamp. | ||||||||||||||||||||||||||||||||||||||||||
| 1979 | |||||||||||||||||||||||||||||||||||||||||||
| 1980 | =head2 oe_num_sign_x | ||||||||||||||||||||||||||||||||||||||||||
| 1981 | |||||||||||||||||||||||||||||||||||||||||||
| 1982 | my $value = oe_num_sign_x(\$amount, $decimals); | ||||||||||||||||||||||||||||||||||||||||||
| 1983 | |||||||||||||||||||||||||||||||||||||||||||
| 1984 | Decode an alphanumeric signed amount (a trailing C<p>..C<y> letter), in place. | ||||||||||||||||||||||||||||||||||||||||||
| 1985 | |||||||||||||||||||||||||||||||||||||||||||
| 1986 | =head2 oe_num2txt_us | ||||||||||||||||||||||||||||||||||||||||||
| 1987 | |||||||||||||||||||||||||||||||||||||||||||
| 1988 | oe_num2txt_us(\$amount); | ||||||||||||||||||||||||||||||||||||||||||
| 1989 | |||||||||||||||||||||||||||||||||||||||||||
| 1990 | Normalise a display-formatted amount (comma to dot), in place. | ||||||||||||||||||||||||||||||||||||||||||
| 1991 | |||||||||||||||||||||||||||||||||||||||||||
| 1992 | =head2 oe_open_fi_IN | ||||||||||||||||||||||||||||||||||||||||||
| 1993 | |||||||||||||||||||||||||||||||||||||||||||
| 1994 | oe_open_fi_IN($file, $encoding); | ||||||||||||||||||||||||||||||||||||||||||
| 1995 | |||||||||||||||||||||||||||||||||||||||||||
| 1996 | Open the input file (C<IN>), optionally with a given encoding. | ||||||||||||||||||||||||||||||||||||||||||
| 1997 | |||||||||||||||||||||||||||||||||||||||||||
| 1998 | =head2 oe_open_fo_OUT | ||||||||||||||||||||||||||||||||||||||||||
| 1999 | |||||||||||||||||||||||||||||||||||||||||||
| 2000 | oe_open_fo_OUT($file, $encoding); | ||||||||||||||||||||||||||||||||||||||||||
| 2001 | |||||||||||||||||||||||||||||||||||||||||||
| 2002 | Open the output file (C<OUT>), optionally with a given encoding. | ||||||||||||||||||||||||||||||||||||||||||
| 2003 | |||||||||||||||||||||||||||||||||||||||||||
| 2004 | =head2 oe_options | ||||||||||||||||||||||||||||||||||||||||||
| 2005 | |||||||||||||||||||||||||||||||||||||||||||
| 2006 | my ($params, $cfg) = oe_options(@args); | ||||||||||||||||||||||||||||||||||||||||||
| 2007 | |||||||||||||||||||||||||||||||||||||||||||
| 2008 | Parse the command-line options into the run parameters and return them along | ||||||||||||||||||||||||||||||||||||||||||
| 2009 | with the configuration. | ||||||||||||||||||||||||||||||||||||||||||
| 2010 | |||||||||||||||||||||||||||||||||||||||||||
| 2011 | =head2 oe_params | ||||||||||||||||||||||||||||||||||||||||||
| 2012 | |||||||||||||||||||||||||||||||||||||||||||
| 2013 | my $params = oe_params($params); | ||||||||||||||||||||||||||||||||||||||||||
| 2014 | |||||||||||||||||||||||||||||||||||||||||||
| 2015 | Get, or set, the run parameters. | ||||||||||||||||||||||||||||||||||||||||||
| 2016 | |||||||||||||||||||||||||||||||||||||||||||
| 2017 | =head2 oe_print_to_output_file | ||||||||||||||||||||||||||||||||||||||||||
| 2018 | |||||||||||||||||||||||||||||||||||||||||||
| 2019 | oe_print_to_output_file($text); | ||||||||||||||||||||||||||||||||||||||||||
| 2020 | |||||||||||||||||||||||||||||||||||||||||||
| 2021 | Print C<$text> to the output file. | ||||||||||||||||||||||||||||||||||||||||||
| 2022 | |||||||||||||||||||||||||||||||||||||||||||
| 2023 | =head2 oe_process_ref_rec | ||||||||||||||||||||||||||||||||||||||||||
| 2024 | |||||||||||||||||||||||||||||||||||||||||||
| 2025 | oe_process_ref_rec($key_off, $key_len, \$line, $rec_off, $rec_len); | ||||||||||||||||||||||||||||||||||||||||||
| 2026 | |||||||||||||||||||||||||||||||||||||||||||
| 2027 | Match a record key in C<$line> and process the referenced record. | ||||||||||||||||||||||||||||||||||||||||||
| 2028 | |||||||||||||||||||||||||||||||||||||||||||
| 2029 | =head2 oe_rec_motif | ||||||||||||||||||||||||||||||||||||||||||
| 2030 | |||||||||||||||||||||||||||||||||||||||||||
| 2031 | oe_rec_motif($key, $pattern); | ||||||||||||||||||||||||||||||||||||||||||
| 2032 | |||||||||||||||||||||||||||||||||||||||||||
| 2033 | Register the unpack pattern of the record C<$key>. | ||||||||||||||||||||||||||||||||||||||||||
| 2034 | |||||||||||||||||||||||||||||||||||||||||||
| 2035 | =head2 oe_rec_output | ||||||||||||||||||||||||||||||||||||||||||
| 2036 | |||||||||||||||||||||||||||||||||||||||||||
| 2037 | oe_rec_output($key, $format); | ||||||||||||||||||||||||||||||||||||||||||
| 2038 | |||||||||||||||||||||||||||||||||||||||||||
| 2039 | Register the C<sprintf> output format of the record C<$key>. | ||||||||||||||||||||||||||||||||||||||||||
| 2040 | |||||||||||||||||||||||||||||||||||||||||||
| 2041 | =head2 oe_rec_pre_process | ||||||||||||||||||||||||||||||||||||||||||
| 2042 | |||||||||||||||||||||||||||||||||||||||||||
| 2043 | oe_rec_pre_process($key, $code); | ||||||||||||||||||||||||||||||||||||||||||
| 2044 | |||||||||||||||||||||||||||||||||||||||||||
| 2045 | Attach the pre-processing C<$code> for the record C<$key>. | ||||||||||||||||||||||||||||||||||||||||||
| 2046 | |||||||||||||||||||||||||||||||||||||||||||
| 2047 | =head2 oe_rec_process | ||||||||||||||||||||||||||||||||||||||||||
| 2048 | |||||||||||||||||||||||||||||||||||||||||||
| 2049 | oe_rec_process($key, $code); | ||||||||||||||||||||||||||||||||||||||||||
| 2050 | |||||||||||||||||||||||||||||||||||||||||||
| 2051 | Attach the post-load processing C<$code> for the record C<$key>. | ||||||||||||||||||||||||||||||||||||||||||
| 2052 | |||||||||||||||||||||||||||||||||||||||||||
| 2053 | =head2 oe_round | ||||||||||||||||||||||||||||||||||||||||||
| 2054 | |||||||||||||||||||||||||||||||||||||||||||
| 2055 | my $value = oe_round($value, $multiple); | ||||||||||||||||||||||||||||||||||||||||||
| 2056 | |||||||||||||||||||||||||||||||||||||||||||
| 2057 | Round C<$value> to a multiple, inferring the decimals. | ||||||||||||||||||||||||||||||||||||||||||
| 2058 | |||||||||||||||||||||||||||||||||||||||||||
| 2059 | =head2 oe_set_sys_date | ||||||||||||||||||||||||||||||||||||||||||
| 2060 | |||||||||||||||||||||||||||||||||||||||||||
| 2061 | oe_set_sys_date($date); | ||||||||||||||||||||||||||||||||||||||||||
| 2062 | |||||||||||||||||||||||||||||||||||||||||||
| 2063 | Set the system date, remembering the original for restoration at exit. | ||||||||||||||||||||||||||||||||||||||||||
| 2064 | |||||||||||||||||||||||||||||||||||||||||||
| 2065 | =head2 oe_simple_job | ||||||||||||||||||||||||||||||||||||||||||
| 2066 | |||||||||||||||||||||||||||||||||||||||||||
| 2067 | my ($params, $cfg) = oe_simple_job(@args); | ||||||||||||||||||||||||||||||||||||||||||
| 2068 | |||||||||||||||||||||||||||||||||||||||||||
| 2069 | Convenience bootstrap: options, then the input and output files. | ||||||||||||||||||||||||||||||||||||||||||
| 2070 | |||||||||||||||||||||||||||||||||||||||||||
| 2071 | =head2 oe_to_date | ||||||||||||||||||||||||||||||||||||||||||
| 2072 | |||||||||||||||||||||||||||||||||||||||||||
| 2073 | oe_to_date(\$date); | ||||||||||||||||||||||||||||||||||||||||||
| 2074 | |||||||||||||||||||||||||||||||||||||||||||
| 2075 | Rewrite a C<YYYYMMDD> date as C<DD/MM/YYYY>, in place. | ||||||||||||||||||||||||||||||||||||||||||
| 2076 | |||||||||||||||||||||||||||||||||||||||||||
| 2077 | =head2 oe_trimp_space | ||||||||||||||||||||||||||||||||||||||||||
| 2078 | |||||||||||||||||||||||||||||||||||||||||||
| 2079 | oe_trimp_space(\$string); | ||||||||||||||||||||||||||||||||||||||||||
| 2080 | |||||||||||||||||||||||||||||||||||||||||||
| 2081 | Collapse consecutive spaces in C<$string>, in place. | ||||||||||||||||||||||||||||||||||||||||||
| 2082 | |||||||||||||||||||||||||||||||||||||||||||
| 2083 | =head2 oe_trt_ref_rec | ||||||||||||||||||||||||||||||||||||||||||
| 2084 | |||||||||||||||||||||||||||||||||||||||||||
| 2085 | oe_trt_ref_rec($id, \$line, $rec_off, $rec_len); | ||||||||||||||||||||||||||||||||||||||||||
| 2086 | |||||||||||||||||||||||||||||||||||||||||||
| 2087 | The core record processor: pre-process, unpack, process, reformat and | ||||||||||||||||||||||||||||||||||||||||||
| 2088 | post-process the referenced record. | ||||||||||||||||||||||||||||||||||||||||||
| 2089 | |||||||||||||||||||||||||||||||||||||||||||
| 2090 | =head2 oe_uc_sans_accents | ||||||||||||||||||||||||||||||||||||||||||
| 2091 | |||||||||||||||||||||||||||||||||||||||||||
| 2092 | oe_uc_sans_accents(\$string); | ||||||||||||||||||||||||||||||||||||||||||
| 2093 | |||||||||||||||||||||||||||||||||||||||||||
| 2094 | Strip the accents from C<$string> and uppercase it, in place. | ||||||||||||||||||||||||||||||||||||||||||
| 2095 | |||||||||||||||||||||||||||||||||||||||||||
| 2096 | =head2 oe_unique_data_name | ||||||||||||||||||||||||||||||||||||||||||
| 2097 | |||||||||||||||||||||||||||||||||||||||||||
| 2098 | my $name = oe_unique_data_name($n, $id, $counter); | ||||||||||||||||||||||||||||||||||||||||||
| 2099 | |||||||||||||||||||||||||||||||||||||||||||
| 2100 | Generate a unique name of C<$n> characters. | ||||||||||||||||||||||||||||||||||||||||||
| 2101 | |||||||||||||||||||||||||||||||||||||||||||
| 2102 | =head1 EXPORTED VARIABLES | ||||||||||||||||||||||||||||||||||||||||||
| 2103 | |||||||||||||||||||||||||||||||||||||||||||
| 2104 | =head2 *IN | ||||||||||||||||||||||||||||||||||||||||||
| 2105 | |||||||||||||||||||||||||||||||||||||||||||
| 2106 | The input file handle. | ||||||||||||||||||||||||||||||||||||||||||
| 2107 | |||||||||||||||||||||||||||||||||||||||||||
| 2108 | =head2 *OUT | ||||||||||||||||||||||||||||||||||||||||||
| 2109 | |||||||||||||||||||||||||||||||||||||||||||
| 2110 | The output file handle. | ||||||||||||||||||||||||||||||||||||||||||
| 2111 | |||||||||||||||||||||||||||||||||||||||||||
| 2112 | =head2 @DATATAB | ||||||||||||||||||||||||||||||||||||||||||
| 2113 | |||||||||||||||||||||||||||||||||||||||||||
| 2114 | The array into which the records are distributed. | ||||||||||||||||||||||||||||||||||||||||||
| 2115 | |||||||||||||||||||||||||||||||||||||||||||
| 2116 | =head2 $LAST_ENR | ||||||||||||||||||||||||||||||||||||||||||
| 2117 | |||||||||||||||||||||||||||||||||||||||||||
| 2118 | The last processed record marker. | ||||||||||||||||||||||||||||||||||||||||||
| 2119 | |||||||||||||||||||||||||||||||||||||||||||
| 2120 | =head2 %motifs | ||||||||||||||||||||||||||||||||||||||||||
| 2121 | |||||||||||||||||||||||||||||||||||||||||||
| 2122 | The record-to-unpack-pattern table. | ||||||||||||||||||||||||||||||||||||||||||
| 2123 | |||||||||||||||||||||||||||||||||||||||||||
| 2124 | =head2 %ouTags | ||||||||||||||||||||||||||||||||||||||||||
| 2125 | |||||||||||||||||||||||||||||||||||||||||||
| 2126 | The record-to-output-tag table. | ||||||||||||||||||||||||||||||||||||||||||
| 2127 | |||||||||||||||||||||||||||||||||||||||||||
| 2128 | =head2 %evalSsTrt | ||||||||||||||||||||||||||||||||||||||||||
| 2129 | |||||||||||||||||||||||||||||||||||||||||||
| 2130 | The record-to-post-processing table. | ||||||||||||||||||||||||||||||||||||||||||
| 2131 | |||||||||||||||||||||||||||||||||||||||||||
| 2132 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 2133 | |||||||||||||||||||||||||||||||||||||||||||
| 2134 | The oEdtk team. | ||||||||||||||||||||||||||||||||||||||||||
| 2135 | |||||||||||||||||||||||||||||||||||||||||||
| 2136 | =cut | ||||||||||||||||||||||||||||||||||||||||||