RackMan::Template - Simple templating module for RackMan
use RackMan::Template; my $tmpl = RackMan::Template->new(filename => "dhcp.tmpl"); $tmpl->param(dhcp_server => "192.168.0.13"); 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)
HTML::Template
Create and return a new object.
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.
Rackman::Device
RackMan
my $tmpl = RackMan::Template->new(filename => $tmpl_path); $tmpl->populate_from($rackdev, $rackman);
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:
populate_from()
RackMan::Device
Rackman
dns_server_1, dns_server_2, dns_server_3 - DNS servers
dns_server_1
dns_server_2
dns_server_3
gateway - IPv4 address of the default gateway
gateway
fqdn - FQDN of the host
fqdn
name - common name of the host
name
if0_ip - IPv4 address of the first regular network interface
if0_ip
if0_mac - MAC address of the first regular network interface
if0_mac
if0_name - name of the first regular network interface
if0_name
netmask - IPv4 network mask
netmask
network - IPv4 network address
network
type - RackObject type
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.
alias
alive_check
contact_person
cpu
dram
flash_memory
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
To install RackMan, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RackMan
CPAN shell
perl -MCPAN -e shell install RackMan
For more information on module installation, please visit the detailed CPAN module installation guide.