S├ębastien Aperghis-Tramoni
and 1 contributors


RackMan::Template - Simple templating module for RackMan


    use RackMan::Template;

    my $tmpl = RackMan::Template->new(filename => "dhcp.tmpl");
    $tmpl->param(dhcp_server => "");
    print $tmpl->output;


This module is a simple Moose-based templating class, based on HTML::Template and HTML::Template::Filter::TT2. Please read the documentation of these modules for more details on the syntax.



(delegated to HTML::Template)

Create and return a new object.


(delegated to HTML::Template)

Pass parameters to the template.


Add to the template the parameters documented in "TEMPLATE PARAMETERS" from the Rackman::Device and RackMan objects given in argument.

    my $tmpl = RackMan::Template->new(filename => $tmpl_path);
    $tmpl->populate_from($rackdev, $rackman);


(delegated to HTML::Template)

Generate and return the output from the template and the given parameters.


When the method populate_from() is called with valid RackMan::Device and Rackman objects given in arguments, it populates the template object with the following parameters:

  • dns_server_1, dns_server_2, dns_server_3 - DNS servers

  • gateway - IPv4 address of the default gateway

  • fqdn - FQDN of the host

  • name - common name of the host

  • if0_ip - IPv4 address of the first regular network interface

  • if0_mac - MAC address of the first regular network interface

  • if0_name - name of the first regular network interface

  • netmask - IPv4 network mask

  • network - IPv4 network address

  • type - RackObject type

The corresponding RackObject attributes are also available, with their names mogrified to be valid identifiers: units are removed, some punctuation characters (dot (.), comma (,)) are removed, the alphabetical characters are lowercased and the rest of non word characters are collapsed and converted to underscores (_).

Here is a non authoritative list of known attributes: alias, alive_check, contact_person, cpu, dram flash_memory, fqdn, has_jumbo_frames, hw_type, hw_warranty_expiration, hypervisor, max_power, max_current, oem_sn_1, oem_sn_2, sw_type, sw_version, sw_warranty_expiration, use, uuid.


HTML::Template, HTML::Template::Filter::TT2


Sebastien Aperghis-Tramoni