ePages 6.17.43 - DE_EPAGES/GLS/API/ShippingLabel/TemplateRoot.pm

Package DE_EPAGES::GLS::API::ShippingLabel::TemplateRoot

The root template for all the variants of ShippingLabels templates All the templates have to derive from this in order to include the ShippingLabel generator engine. This class implements all the logical to parse the HTML/CSS templates used to render the ShippingLabels in a PDF file A good point to start is to take a look to the test Template/ShippingLabel: API/ShippingLabel/TemplateTest.pm The class derived from TemplateRoot which show how to expand the basic functionality. Public/BO/GLS/ShippingLabelTemplates/TestLabel Templates for the Test ShippingLabel. The main template is the 'Main.tmpl'

Functions

addCssList
get
new
render

addCssList

Add or Merge CSS templates to the existing CssList of this Template ( see above for CssList details )

Syntax
$Template->addCssList( $NewCssList, $Overwrite )
Input
$NewCssList (href.Array)
A list of CSS templates to set in the Template CssList
$Overwrite (boolean)
It indicates how to add the CssList provided:
  • 0/undef : The CSSs are added/merged to the existing CssList
  • 1 : The CSSs provided substitute (!) the existing CssList

get

Accessor to the attributes of the object.

Syntax
$Template->get( $AttributeName )
Input
$AttributeName (string)
The name for the attribute to query
Return
$Value (string)
The value for the attribute requested

new

Contructor for the root template

Syntax
$Handler = DE_EPAGES::GLS::API::ShippingLabel::TemplateRoot->new($Owner, $hData, $hOptions);
Input
$Owner (object)
The object where the resources ( img, html, pdf ) will be stored
$hData (ref.hash)
A hash with the data to map in the template
$hOptions (ref.hash)
A hash with options
Availabe options:
  • testing - If set ( 1 ) it means the execution has been launched by command line. The log
    information will send ( also ) to the standard output.
  • cleanup_off - If set ( 1 ) all the temporary files created will be keep it in the same
    folder where the final ShippingLabel document is saved
  • save_data - If set ( 1 ) a copy of the Input data ( hashs ) will be saved in the
    output folder
  • verbose - Level of verbosity. Valid values are:

    • 0 : Be silent ( default )
    • 1 : Only basic information ( OUTPUT: error.log & console )
    • 2 : Dump Input Data Render => { Tag = Value } ( OUTPUT: console )
    • 3 : Parse info ( OUTPUT: console )

Return
$Handler (object)
blessed object

render

This method is the entry point to the engine to generate the ShippingLabel in PDF format.

Syntax
$Template->render