NAME

RackMan::Format::Generic - Generate a file from a generic for a given RackObject

SYNOPSIS

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
});

DESCRIPTION

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.

METHODS

write

Generate the file.

Arguments

Arguments are expected as a hashref with the following keys:

  • rackdev - (mandatory) a RackMan::Device instance

  • rackman - (mandatory) a RackMan instance

  • verbose - (optional) boolean, set to true to be verbose

TEMPLATE PARAMETERS

See "TEMPLATE PARAMETERS" in RackMan::Template for more details about the available parameters.

CONFIGURATION

This module gets its configuration from the [format:dhcp] section of the main rack.conf, with the following parameters:

  • path - specify the path of the output file; can be overriden by the --output option

  • template - specify the path of the template; can be overriden by the --template option

SEE ALSO

RackMan::Template

AUTHOR

Sebastien Aperghis-Tramoni