RackMan::Format::Generic - Generate a file from a generic for a given RackObject
on the command line:
rack write -G Generic -t input.tmpl -o %name%.conf device-name
in code:
use RackMan::Format::Generic; $rackman->options->{template} = "path/to/input.tmpl"; $rackman->options->{output} = "path/to/%name%.conf"; RackMan::Format::Generic->write({ rackdev => $rackdev, # a RackMan::Device instance rackman => $rackman, # a RackMan instance });
This module is a generic file generator: it takes a template file as input, processes it and write the result on disk if a path was provided, otherwise on screen. As shown in the synopsis, this allows to use rack(1) as a simple generic templating processor.
Generate the file.
Arguments
Arguments are expected as a hashref with the following keys:
rackdev - (mandatory) a RackMan::Device instance
rackdev
rackman - (mandatory) a RackMan instance
rackman
verbose - (optional) boolean, set to true to be verbose
verbose
See "TEMPLATE PARAMETERS" in RackMan::Template for more details about the available parameters.
This module gets its configuration from the [format:dhcp] section of the main rack.conf, with the following parameters:
[format:dhcp]
path - specify the path of the output file; can be overriden by the --output option
path
--output
template - specify the path of the template; can be overriden by the --template option
template
--template
RackMan::Template
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.