blib/lib/oEdtk/libDev.pm

filter: Statementstmt 16.6% 39 / 235 Branchbran 0.0% 0 / 72 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 50.0% 12 / 24 Podpod 91.6% 11 / 12 totaltotal 16.9% 62 / 365 CC 43 SCAR 38.3
CC
43
Cov
12%
clean_full_dir
132.0
file_list
90.0
tree_Directory_Completion
42.0
CRAP 46.0
« lib/oEdtk/TexTag.pm ↑ Summary blib/lib/oEdtk/Restitution.pm »
1 package oEdtk::libDev;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 #[JW for editor]:mode=perl:tabSize=8:indentSize=2:noTabs=true:indentOnEnter=true:
6 #
7  
8 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶ use oEdtk::logger 2.1109;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶ use oEdtk::Main 0.42;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶ use oEdtk::trackEdtk qw (ini_Edtk_Conf conf_To_Env env_Var_Completion);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶ use Config::IniFiles;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 # use File::Copy; # to be provided to run dev in the prod context
15 2 ▶ use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶ use Date::Calc qw(Gmtime Today Compress);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 2 require oEdtk::tuiEdtk;
19  
20 2 ▶ use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶ use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %hListeId); # %EXPORT_TAGS);
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 2 $VERSION = 2.1129;
25 2 @ISA = qw(Exporter);
26 2 @EXPORT = qw(
27 $NOK
28 run_Edtk_dev
29 IdUniqueSur7
30 lastLong
31 lastCourt
32 delSp
33 );
34  
35 2 @EXPORT_OK = qw(
36 check_EDTK_DIR wait_Enter
37 tree_Directory_Completion
38 clean_full_dir file_list
39 prep_Edtk_Data
40 )
41  
42 # catSp
43 }
44  
45 2 our $NOK = -1;
46  
47 #
48 # CODE - DOC AT THE END
49 #
50  
51 # limit the export of these functions (export OK)
52  
53 0 ▶sub check_EDTK_DIR () {
Subroutine check_EDTK_DIR: not called CC=3 SCAR=24.8
Pod documented
54  
55 # check the Edtk environment,
56 # in particular the existence of the EDTK_DIR directories declared in the environment
57 0 ▶ while ( ( my $cle, my $valeur ) = each(%ENV) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %ENV) 0 0 0
58 0 ▶ if ( $cle =~ /EDTK\_DIR/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cle =~ /EDTK\_DIR/) 0 0 0
59  
60 #print "$cle => $valeur\n";
61 0 env_Var_Completion($valeur);
62 0 tree_Directory_Completion($valeur);
63 }
64 }
65 0 1;
66 }
67  
68 0 ▶sub tree_Directory_Completion {
Subroutine tree_Directory_Completion: not called CC=6 SCAR=37.4
Pod documented
69  
70 # complete, if needed, the whole tree of the path passed as a parameter
71 # by creating the directories of the path passed as a parameter
72 0 my $tree = shift;
73  
74 #print $tree."\n";
75  
76 0 my @listDir = split( /[\/\\]/, $tree );
77 0 $tree = "";
78 0 ▶ if ( -e "$listDir[0]/$listDir[1]" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-e "$listDir[0]/$listDir[1]") 0 0 0
79 0 ▶ for ( my $i = 0 ; $i < ( scalar @listDir ) ; $i++ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @listDir) 0 0 0
80 0 $tree .= $listDir[$i] . "/";
81  
82 #print "\t $i = $listDir[$i]\n";
83 0 ▶ if ( -e $tree ) {
Branch: 2 branches
BranchTrueFalseTotal
if (-e $tree) { } 0 0 0
elsif (-d $tree) { } 0 0 0
84 }
85 elsif ( -d $tree ) {
86 }
87 else {
88 0 &logger( 6, "INFO: -> mkdir, create $tree\n" );
89 0 eval { mkdir $tree; };
90 0 ▶ die "ERROR: mkdir $tree $@" if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
91 }
92 }
93 }
94 0 1;
95 }
96  
97 0 ▶sub run_Edtk_dev() {
Subroutine run_Edtk_dev: not called CC=5 SCAR=34.0
Pod documented
98 0 import oEdtk::tuiEdtk;
99  
100 0 my $iniEdtk = ini_Edtk_Conf;
101 0 conf_To_Env( $iniEdtk, 'DEFAULT' );
102 0 conf_To_Env( $iniEdtk, 'ENVDESC' );
103  
104 # $ENV{EDTK_FTYP_DFLT} ||=$ENV{EDTK_FTYP_HOMOL};
105  
106 0 ▶ if ( $ENV{EDTK_DIR_BASE} eq "" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"EDTK_DIR_BASE"} eq "") 0 0 0
107 0 not_Configured();
108 0 exit $NOK;
109 }
110 0 &check_EDTK_DIR;
111  
112 0 start_Screen();
113  
114 0 my $styleApp = $ENV{EDTK_DIR_SCRIPT} . "/" . $ENV{EDTK_PRGNAME};
115 0 env_Var_Completion($styleApp);
116 0 env_Var_Completion( $ENV{EDTK_DIR_APPTMP} );
117 0 warn "INFO: " . oe_now_time() . " -START- \n";
118  
119 0 my $doclean = 1;
120 {
121 # LaTeX case
122 0 $doclean = 0;
123 0 $ENV{EDTK_DOC_OUTPUT} = "$ENV{EDTK_FDATAOUT}.$ENV{EDTK_EXT_WORK}";
124  
125 # xxxxxxxx check, but we no longer need it now that it works (no need to check the intermediate files)
126 # $ENV{EDTK_EXT_DEFAULT}=$ENV{EDTK_EXT_WORK};
127  
128 chdir( $ENV{EDTK_DIR_APPTMP} )
129 0 ▶ or die "ERROR: Cannot change current directory: $!\n";
Branch: 1 branch
BranchTrueFalseTotal
chdir $ENV{"EDTK_DIR_APPTMP"} or die "ERROR: Cannot change current directory: $!\n" 0 0 0
130 my $ctrl = &prep_Edtk_Data( $ENV{EDTK_FDATAIN} . "." . $ENV{EDTK_EXT_DATA} )
131 0 ; #, $ENV{EDTK_DOC_OUTPUT});
132 0 warn "INFO: " . oe_now_time() . " -END Extract- \n";
133  
134 0 ▶ if ( $ctrl eq $NOK ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ctrl eq $oEdtk::libDev::NOK) { } 0 0 0
135 0 warn "ERROR: return $? in prep_Edtk_Data\n";
136 0 &wait_Enter();
137 0 exit $NOK;
138 }
139 else {
140 #warn "INFO: data extraction seem good\n";
141 #$ENV{EDTK_DOC_OUTPUT} =$ctrl;
142 }
143 }
144  
145 0 warn "INFO: " . oe_now_time() . " -END- \n";
146  
147 # if everything ran correctly, empty the tmp dir
148 # $| = 1; # autoflush
149 0 ▶ if ($doclean) {
Branch: 1 branch
BranchTrueFalseTotal
if ($doclean) 0 0 0
150 0 warn "INFO: clean temp\n";
151 0 clean_full_dir( $ENV{EDTK_DIR_APPTMP} );
152 }
153  
154 0 stop_Screen();
155 0 1;
156 }
157  
158 0 ▶sub prep_Edtk_Data {
Subroutine prep_Edtk_Data: not called CC=4 SCAR=30.0
Pod documented
159  
160 # trigger the data extraction process
161 # in the context of the automated run run_Edtk_dev
162 0 my $command = "$ENV{EDTK_DIR_APP}/$ENV{EDTK_PRGNAME}/$ENV{EDTK_PRGNAME}.$ENV{EDTK_EXT_PERL}";
163 0 my $arg1 = shift;
164 0 ▶ my $arg2 = shift || "";
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
165 0 ▶ my $option = shift || "";
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
166  
167 0 env_Var_Completion($arg2);
168 0 warn "INFO: $command $arg1 $arg2\n";
169 0 env_Var_Completion($command);
170 0 env_Var_Completion($arg1);
171 0 env_Var_Completion($option);
172  
173 0 eval {
174 #system($command, $arg1, $arg2, $option);
175 0 system( $command, $arg1, $option );
176 };
177  
178 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
179 0 warn "INFO: ERROR -> $@\n";
180 0 warn "INFO: ERROR $command $arg1 $arg2 return $? \n";
181  
182 0 return $NOK;
183 }
184  
185 0 1;
186 }
187  
188 0 ▶sub wait_Enter() {
Subroutine wait_Enter: not called CC=2 SCAR=17.9
Pod documented
189 0 print "\nPause, press <enter> to continue...\n";
190 0 ▶ until (<STDIN>) {
Branch: 1 branch
BranchTrueFalseTotal
unless (readline STDIN) 0 0 0
191 }
192 0 1;
193 }
194  
195 0 ▶sub delSp(\$) { ## no critic (ProhibitSubroutinePrototypes)
Subroutine delSp: not called CC=1 SCAR=6.9
Pod documented
196  
197 #remove spaces
198 # the parameter is an implicit reference, example: delSp($chaine)
199 # returns the number of removed characters
200 0 my $rChaine = shift;
201 0 return ${$rChaine} =~ s/\s//go;
202 }
203  
204 0 ▶sub IdUniqueSur6 () { # deprecated function
Subroutine IdUniqueSur6: not called CC=2 SCAR=17.9
Pod undocumented
205 #format an id to 6 alphanumeric characters
206 # receives as a parameter the reference to an identifier
207 # duplicate handling internal to the function run
208 0 my $rId = shift;
209 0 my %hListeId;
210 0 my $cpt = 0;
211 0 ${$rId} = sprintf( "%-6.6s", ${$rId} );
212 0 ${$rId} =~ s/\s/x/g;
213  
214 0 ▶ while ( exists( $hListeId{ ${$rId} } ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hListeId{${$rId;}}) 0 0 0
215 0 ${$rId} = sprintf( "%-4.4s%0.2d", ${$rId}, $cpt++ );
216 }
217 0 $hListeId{ ${$rId} } = 1;
218 0 1;
219 }
220  
221 {
222 2 my $appelIUS7 = 0; # constant variable local to the function
223  
224 0 ▶ sub IdUniqueSur7 () {
Subroutine IdUniqueSur7: not called CC=5 SCAR=34.0
Pod documented
225  
226 # define a unique identifier over 7 characters
227 # the first 6 characters of the passed key are extracted
228 # if the id is already known, take the first 4 and append a 3-digit counter (matches the call sequence)
229 # if it is still not unique, take the first 3 characters and pad the 3-digit counter with a character
230 # receives: - a reference to a key
231 # - optional: a reference to a counter value (3 digits)
232  
233 0 my ( $refId, $rInit ) = @_;
234 0 ▶ if ($rInit) { $appelIUS7 = ${$rInit} }
Branch: 1 branch
BranchTrueFalseTotal
if ($rInit) { } 0 0 0
235 0 else { $appelIUS7++ }
236  
237 0 ${$refId} = sprintf( "%-7.7s", ${$refId} );
238 0 ${$refId} =~ s/\s/x/g;
239 0 ▶ if ( exists( $hListeId{ ${$refId} } ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $oEdtk::libDev::hListeId{${$refId;}}) 0 0 0
240 0 ${$refId} = sprintf( "%-4.4s%0.3d", ${$refId}, $appelIUS7 );
241  
242 0 my $cpt = 97; # for the character "a"
243 0 ▶ while ( exists( $hListeId{ ${$refId} } ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $oEdtk::libDev::hListeId{${$refId;}}) 0 0 0
244 0 ${$refId} = sprintf( "%-3.3s%0.3d%1.1s", ${$refId}, $appelIUS7, chr( $cpt++ ) );
245 0 ▶ die &logger( $NOK, "cannot create a unique key" ) if ( $cpt >= 123 );
Branch: 1 branch
BranchTrueFalseTotal
if $cpt >= 123 0 0 0
246  
247 # use Log::Log4perl;
248 # Log::Log4perl->init("log.conf"); => read log.conf
249 # $logger = Log::Log4perl->get_logger("");
250 # $logger->logdie("cannot create a unique key") if ($cpt >= 123);
251 # $logger->trace("..."); # Log a trace message
252 # $logger->debug("..."); # Log a debug message
253 # $logger->info("..."); # Log a info message
254 # $logger->warn("..."); # Log a warn message / $logger->error_warn("..."); (includes the call to warn())
255 # $logger->error("..."); # Log a error message / $logger->logdie ("..."); (includes the call to die())
256 # $logger->fatal("..."); # Log a fatal message
257 }
258 }
259 0 $hListeId{ ${$refId} } = 1;
260 0 return 1;
261 }
262 }
263  
264 2 ▶sub lastLong {
Subroutine lastLong: not called CC=3 SCAR=23.5
Pod documented
265  
266 # select the most significant alpha token of the string passed by reference
267 # example call: $mot=&lastLong ($chaine);
268 # the separator characters are spaces, _ or -
269  
270 0 my $chaine = shift;
271 0 $chaine =~ s/-/ /g;
272 0 $chaine =~ s/_/ /g;
273 0 oe_trimp_space($chaine);
274  
275 # If PATTERN contains parentheses (and therefore subpatterns), an extra element is created
276 # in the result array for each string matched by the subpattern.
277 # split(/([,-])/, "1-10,20", 3);
278 # produces the list of values
279 # (1, '-', 10, ',', 20)
280 # http://perl.enstimac.fr/DocFr/perlfunc.html#item_split
281 0 my @mots = split( " ", $chaine );
282 0 my ( $mot, $motLong );
283 0 my $taille = 0;
284  
285 0 ▶ while ( $mot = shift(@mots) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mot = shift @mots) 0 0 0
286 0 ▶ if ( length($mot) >= $taille ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $mot >= $taille) 0 0 0
287 0 $taille = length($mot);
288 0 $motLong = $mot;
289 }
290 }
291  
292 0 return $motLong;
293 }
294  
295 0 ▶sub lastCourt {
Subroutine lastCourt: not called CC=3 SCAR=24.8
Pod documented
296  
297 # select the shortest alpha token of the string passed by reference
298 # example call: $mot=&lastCourt ($chaine);
299 0 my $chaine = shift;
300 0 $chaine =~ s/-/ /g;
301 0 $chaine =~ s/_/ /g;
302 0 oe_trimp_space($chaine);
303 0 my @mots = split( " ", $chaine );
304 0 my ( $mot, $motCourt );
305 0 my $taille = 1000;
306  
307 0 ▶ while ( $mot = shift(@mots) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mot = shift @mots) 0 0 0
308 0 ▶ if ( length($mot) <= $taille ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $mot <= $taille) 0 0 0
309 0 $taille = length($mot);
310 0 $motCourt = $mot;
311 }
312 }
313  
314 #print "$chaine $taille $motCourt\n";
315 0 return $motCourt;
316 }
317  
318 0 ▶sub clean_full_dir {
Subroutine clean_full_dir: not called CC=11 SCAR=48.8
Pod documented
319  
320 # unlink alone does not work on windows with wildcards ???
321 # this function cleans the directory passed as a parameter
322 # and the subdirectories
323 0 my ( $membre, $option, $key, @listRep );
324 0 my $DIR;
325 0 $membre = shift;
326 0 $option = shift;
327 0 ▶ $option ||= "";
Condition0%0/2
$option ||= ""
l!l
00
MC/DC0%0/1
$option ||= ""
$option
Truth table0%0/2
A
A= $option
Aresult
11
00
328  
329 # build the search pattern for the regular expression
330 0 my $suppr_motif;
331 0 $suppr_motif = ".*";
332  
333 # print "del. -> $suppr_motif -> $membre\n";
334  
335 # handle directory separators
336 # the standard perl separator (on *nix / windows ...) -> /
337 0 $membre .= "/";
338  
339 # the separator supplied on Dos is converted \ -> /
340 0 $membre =~ s/\\+/\//g;
341  
342 # remove repeated /+ -> /
343 0 $membre =~ s/\/+/\//g;
344  
345 0 unshift( @listRep, $membre );
346  
347 0 $key = pop @listRep;
348 0 ▶ITEMS: for ( ; $key ; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key) 0 0 0
349  
350 # since listRep is interactive foreach ignores values added to listRep
351 # print "path= <$key> < \@listRep=>@listRep<\n";
352  
353 0 eval { opendir( $DIR, $key ); };
354 0 ▶ if ($?) {
Branch: 1 branch
BranchTrueFalseTotal
if ($?) 0 0 0
355 0 warn "INFO: WARNING opendir(DIR, $key) return $?\n";
356 0 next ITEMS;
357 }
358  
359 0 $membre = readdir($DIR);
360 0 ▶ for ( ; $membre ; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($membre) 0 0 0
361 0 ▶ if ( $membre ne "." && $membre ne ".." ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($membre ne "." and $membre ne "..") 0 0 0
Condition0%0/3
$membre ne "." and $membre ne ".."
!ll&&!rl&&r
000
MC/DC0%0/2
$membre ne "." and $membre ne ".."
$membre ne "." $membre ne ".."
Truth table0%0/3
A and B
A= $membre ne "."B= $membre ne ".."
ABresult
0X0
100
111
362  
363 # if the member is a directory
364 0 ▶ if ( -d $key . $membre ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $key . $membre) { } 0 0 0
365  
366 # print "$key$membre \t (directory)\n";
367 0 push( @listRep, "$key$membre/" );
368  
369 }
370 else {
371 0 my $file = $key . $membre;
372  
373 # print "$file\n";
374 0 ▶ if ( $file =~ m{$suppr_motif} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($file =~ /$suppr_motif/) 0 0 0
375 0 ▶ if ( $option ne "--dry-run" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($option ne '--dry-run') { } 0 0 0
376 0 ▶ warn "INFO: deleting $file\n" if ( $option eq "--verbose" );
Branch: 1 branch
BranchTrueFalseTotal
if $option eq "--verbose" 0 0 0
377 0 unlink($file);
378 }
379 else {
380 0 warn "INFO: --dry-run : $file\n";
381 }
382 }
383 } #end of if
384 } #end of if
385 0 $membre = readdir($DIR);
386 } #end of for
387  
388 0 closedir($DIR);
389 0 $key = pop @listRep;
390 } #end of for
391  
392 #close OUT;
393  
394 0 1;
395 }
396  
397 0 ▶sub file_list {
Subroutine file_list: not called CC=9 SCAR=45.0
Pod documented
398 0 my ( $key, @listRep, @listFile );
399 0 my $DIR;
400 0 my $membre = shift;
401 0 my $motif = shift;
402 0 my $opt = shift;
403 0 ▶ $opt ||= "";
Condition0%0/2
$opt ||= ""
l!l
00
MC/DC0%0/1
$opt ||= ""
$opt
Truth table0%0/2
A
A= $opt
Aresult
11
00
404  
405 # handle directory separators
406 # the standard perl separator (on *nix / windows ...) -> /
407 0 $membre .= "/";
408  
409 # the separator supplied on Dos is converted \ -> /
410 0 $membre =~ s/\\+/\//g;
411  
412 # remove repeated /+ -> /
413 0 $membre =~ s/\/+/\//g;
414  
415 0 unshift( @listRep, $membre );
416  
417 0 $key = pop @listRep;
418 0 ▶ITEMS: for ( ; $key ; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key) 0 0 0
419  
420 # since listRep is interactive foreach ignores values added to listRep
421 # print "path= <$key> < \@listRep=>@listRep<\n";
422  
423 0 eval { opendir( $DIR, $key ); };
424 0 ▶ if ($?) {
Branch: 1 branch
BranchTrueFalseTotal
if ($?) 0 0 0
425 0 warn "INFO: WARNING opendir(DIR, $key) return $?\n";
426 0 next ITEMS;
427 }
428  
429 0 $membre = readdir($DIR);
430 0 ▶ for ( ; $membre ; ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($membre) 0 0 0
431 0 ▶ if ( $membre ne "." && $membre ne ".." ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($membre ne "." and $membre ne "..") 0 0 0
Condition0%0/3
$membre ne "." and $membre ne ".."
!ll&&!rl&&r
000
MC/DC0%0/2
$membre ne "." and $membre ne ".."
$membre ne "." $membre ne ".."
Truth table0%0/3
A and B
A= $membre ne "."B= $membre ne ".."
ABresult
0X0
100
111
432  
433 # if the member is a directory
434 0 ▶ if ( -d $key . $membre ) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $key . $membre) { } 0 0 0
435  
436 # print "$key$membre \t (directory)\n";
437 0 push( @listRep, "$key$membre/" );
438  
439 }
440 else {
441 0 my $file = $key . $membre;
442  
443 # print "$file\n";
444 0 ▶ if ( $file =~ m{$motif} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($file =~ /$motif/) 0 0 0
445 0 push( @listFile, $file );
446 }
447 } #end of if
448 } #end of if
449 0 $membre = readdir($DIR);
450 } #end of for
451  
452 0 closedir($DIR);
453 0 $key = pop @listRep;
454 } #end of for
455  
456 #close OUT;
457  
458 0 return @listFile;
459 }
460  
461 1 ▶END {
Subroutine END: called CC=1 SCAR=0.0
462 }
463 2 1;
464  
465 =head1 NAME
466  
467 oEdtk::libDev - helpers for running an application in the development environment
468  
469 =head1 SYNOPSIS
470  
471 use oEdtk::libDev;
472  
473 run_Edtk_dev();
474  
475 =head1 DESCRIPTION
476  
477 Development-run helpers: check the C<EDTK_DIR> directory tree, prepare the input
478 data, launch the composition in a development environment, and the small string
479 helpers used along the way (unique identifiers, longest and shortest token, space
480 removal).
481  
482 =head1 FUNCTIONS
483  
484 =head2 $NOK
485  
486 The conventional "not OK" return code, C<-1>.
487  
488 =head2 run_Edtk_dev
489  
490 run_Edtk_dev();
491  
492 Run an application in the development environment: load the configuration, check
493 the directory tree, prepare the data and launch the composition, with the start
494 and stop screens.
495  
496 =head2 IdUniqueSur7
497  
498 IdUniqueSur7(\$id);
499  
500 Make C<$id> unique over seven characters: the first six characters are taken, and
501 on a clash the first four followed by a three-digit counter are used, falling
502 back to the first three characters padded with a letter. The optional second
503 argument is a reference to the counter to seed.
504  
505 =head2 lastLong
506  
507 my $token = lastLong($string);
508  
509 Return the longest token of C<$string>, where tokens are separated by spaces,
510 underscores or hyphens.
511  
512 =head2 lastCourt
513  
514 my $token = lastCourt($string);
515  
516 Return the shortest token of C<$string>, with the same separators as
517 L</lastLong>.
518  
519 =head2 delSp
520  
521 my $count = delSp($string);
522  
523 Remove every space from C<$string>, in place, and return the number of characters
524 removed.
525  
526 =head2 check_EDTK_DIR
527  
528 check_EDTK_DIR();
529  
530 Expand every C<EDTK_DIR> environment variable and create the matching directory
531 tree.
532  
533 =head2 wait_Enter
534  
535 wait_Enter();
536  
537 Print a pause prompt and wait for the enter key.
538  
539 =head2 tree_Directory_Completion
540  
541 tree_Directory_Completion($path);
542  
543 Create, if needed, every directory of C<$path>.
544  
545 =head2 clean_full_dir
546  
547 clean_full_dir($dir, $option);
548  
549 Recursively delete the files under C<$dir>. With C<--dry-run> nothing is removed;
550 with C<--verbose> each deletion is reported.
551  
552 =head2 file_list
553  
554 my @files = file_list($dir, $pattern, $option);
555  
556 Recursively collect the files under C<$dir> whose path matches C<$pattern>.
557  
558 =head2 prep_Edtk_Data
559  
560 my $ok = prep_Edtk_Data($input, $output, $option);
561  
562 Trigger the data-extraction step of the current application; return C<$NOK> on
563 failure.
564  
565 The deprecated C<IdUniqueSur6> sub is kept only for reference and is not part of
566 the public API.
567  
568 =head1 AUTHOR
569  
570 The oEdtk team.
571  
572 =cut
« lib/oEdtk/TexTag.pm ↑ Summary blib/lib/oEdtk/Restitution.pm »