NAME

oEdtk::Main - core helpers for the oEdtk document pipeline

SYNOPSIS

use oEdtk::Main;

oe_simple_job(@ARGV);            # options, input and output files
oe_rec_motif($key, $pattern);    # describe a record
oe_process_ref_rec($off, $len, \$line);

DESCRIPTION

The central module of the toolkit. It provides the record template engine (describe a record, match it in a line, unpack and process it), the address, text, date and number helpers, the input/output file handling, the document-batch id generation, and the job run lifecycle (option parsing, FIFO/LaTeX composition, dissemination). The exported globals *IN, *OUT, @DATATAB and the %motifs, %ouTags, %evalSsTrt hashes carry the run state.

FUNCTIONS

date2time

date2time($date);

Deprecated: turn a YYYYMMDD date into an epoch time through gmtime.

prodEdtk_Current_Rec

my $key = prodEdtk_Current_Rec();

Return the current record identifier.

prodEdtk_Previous_Rec

my $key = prodEdtk_Previous_Rec();

Return the previous record identifier.

prodEtk_rec_cdata_join

prodEtk_rec_cdata_join($text);

Append $text to the pending push value.

recEdtk_erase

recEdtk_erase($key);

Remove every piece of processing registered for the record $key.

recEdtk_join_tmplte

recEdtk_join_tmplte($key, $pattern, $output);

Register a record's unpack pattern and output format together.

recEdtk_post_process

recEdtk_post_process($key, $code);

Attach the post-reformat processing $code for the record $key.

recEdtk_redefine

recEdtk_redefine($key, $pattern);

Reset and redefine the unpack pattern of the record $key.

oe_app_usage

oe_app_usage();

Print the application usage and exit.

oe_backgrounds_apps

my $set = oe_backgrounds_apps($section);

Look up the application's background set from EDTK_APPS_BACKGROUNDS.

oe_CAP_sans_accents

oe_CAP_sans_accents(\$string);

Strip the accents from $string and uppercase it, in place.

oe_char_xlate

my $out = oe_char_xlate($string);

Apply the character-translation dictionary to $string.

oe_clean_addr

oe_clean_addr(\$string);

A stricter address cleanup (extra trims and \W removal), in place.

oe_clean_addr_line

oe_clean_addr_line(\$string);

Clean a 38-character address line (trim, translate, EDTK_DICO_POST), in place.

oe_close_fo

oe_close_fo($fh);

Close the output file handle.

oe_compo_link(@options);

Close the files, run (or wait for) LaTeX, and run the post-composition step.

oe_corporation_get

my $corp = oe_corporation_get();

Return the current corporation.

oe_corporation_set

oe_corporation_set($value);

Translate and set the corporation from $value.

oe_corporation_tag

my $tag = oe_corporation_tag();

Return the corporation tag.

oe_data_build

oe_data_build($name, $value);

Emit a document tag string for $name and $value.

oe_date_biggest

my $date = oe_date_biggest($d1, $d2);

Return the later of two DD/MM/YYYY dates.

oe_date_smallest

my $date = oe_date_smallest($d1, $d2);

Return the earlier of two DD/MM/YYYY dates.

oe_define_TeX_output

oe_define_TeX_output();

Set the output tag delimiters (default backslash, empty, percent).

oe_env_var_completion

oe_env_var_completion(\$path);

Expand $ENV references inside the path $path, in place.

oe_fmt_date

my $date = oe_fmt_date($date);

Normalise a DD/MM/YY or DD/MM/YYYY date.

oe_get_handle_to_input_file

my $fh = oe_get_handle_to_input_file();

Return the input file handle, croaking when it is not open.

oe_ID_LDOC

my $id = oe_ID_LDOC($force);

Return the memoised document-batch id, optionally forcing a value.

oe_is_IDLDOC

my $ok = oe_is_IDLDOC($value);

Return true when $value is a valid document-batch id.

oe_iso_country

my $label = oe_iso_country($country);

Translate a country through the ISO dictionary.

oe_list_encodings

oe_list_encodings();

Print the encodings available from Encode.

oe_new_ID_LDOC

my $id = oe_new_ID_LDOC();

Generate a fresh document-batch id (a UUID).

oe_new_job

oe_new_job();

Legacy job bootstrap: parse the options, open the input, create the output and emit the header tags.

oe_new_job_input_file

oe_new_job_input_file();

Open the input file using the run parameters.

oe_now_time

my $stamp = oe_now_time();

Deprecated: return a YYYYMMDDHHMMSS timestamp.

oe_num_sign_x

my $value = oe_num_sign_x(\$amount, $decimals);

Decode an alphanumeric signed amount (a trailing p..y letter), in place.

oe_num2txt_us

oe_num2txt_us(\$amount);

Normalise a display-formatted amount (comma to dot), in place.

oe_open_fi_IN

oe_open_fi_IN($file, $encoding);

Open the input file (IN), optionally with a given encoding.

oe_open_fo_OUT

oe_open_fo_OUT($file, $encoding);

Open the output file (OUT), optionally with a given encoding.

oe_options

my ($params, $cfg) = oe_options(@args);

Parse the command-line options into the run parameters and return them along with the configuration.

oe_params

my $params = oe_params($params);

Get, or set, the run parameters.

oe_print_to_output_file

oe_print_to_output_file($text);

Print $text to the output file.

oe_process_ref_rec

oe_process_ref_rec($key_off, $key_len, \$line, $rec_off, $rec_len);

Match a record key in $line and process the referenced record.

oe_rec_motif

oe_rec_motif($key, $pattern);

Register the unpack pattern of the record $key.

oe_rec_output

oe_rec_output($key, $format);

Register the sprintf output format of the record $key.

oe_rec_pre_process

oe_rec_pre_process($key, $code);

Attach the pre-processing $code for the record $key.

oe_rec_process

oe_rec_process($key, $code);

Attach the post-load processing $code for the record $key.

oe_round

my $value = oe_round($value, $multiple);

Round $value to a multiple, inferring the decimals.

oe_set_sys_date

oe_set_sys_date($date);

Set the system date, remembering the original for restoration at exit.

oe_simple_job

my ($params, $cfg) = oe_simple_job(@args);

Convenience bootstrap: options, then the input and output files.

oe_to_date

oe_to_date(\$date);

Rewrite a YYYYMMDD date as DD/MM/YYYY, in place.

oe_trimp_space

oe_trimp_space(\$string);

Collapse consecutive spaces in $string, in place.

oe_trt_ref_rec

oe_trt_ref_rec($id, \$line, $rec_off, $rec_len);

The core record processor: pre-process, unpack, process, reformat and post-process the referenced record.

oe_uc_sans_accents

oe_uc_sans_accents(\$string);

Strip the accents from $string and uppercase it, in place.

oe_unique_data_name

my $name = oe_unique_data_name($n, $id, $counter);

Generate a unique name of $n characters.

EXPORTED VARIABLES

*IN

The input file handle.

*OUT

The output file handle.

@DATATAB

The array into which the records are distributed.

$LAST_ENR

The last processed record marker.

%motifs

The record-to-unpack-pattern table.

%ouTags

The record-to-output-tag table.

%evalSsTrt

The record-to-post-processing table.

AUTHOR

The oEdtk team.