Config::Model::Backend::Debian::DpkgSyntax(3pm)

NAME
Config::Model::Backend::Debian::DpkgSyntax - Role to read and write files with Dpkg syntax

SYNOPSIS
  # in Dpkg dedicated backend class

DESCRIPTION
This module is a Moose role to add capacity to read and write dpkg control files to Config::Model backend classes.

  parse_dpkg_file ( file_handle )
Read a control file from the file_handle and returns a nested list (or a list ref) containing data from the file.

The returned list is of the form :

 [
   # section 1
   [ keyword1 => value1, # for text or simple values
     keyword2 => value2, # etc
   ],
   # section 2
   [ ... ]
   # etc ...
 ]

  write_dpkg_file ( io_handle, list_ref, list_sep )
Munge the passed list ref into a string compatible with control files and write it in the passed file handle.

The input is a list of list in a form similar to the one generated by parse_dpkg_file:

 [ section [ keyword => value | value_list ] ]

Except that the value may be a SCALAR or a list ref. In case, of a list ref, the list items will be joined with the value "list_sep" before being written.

For instance the following code :

 my $ref = [ [ Foo => 'foo value' , Bar => [ qw/v1 v2/ ] ];
 write_dpkg_file ( $ioh, $ref, ', ' )

will yield:

 Foo: foo value
 Bar: v1, v2

AUTHOR
Dominique Dumont, (ddumont at cpan dot org)

SEE ALSO
Config::Model, Config::Model::AutoRead, Config::Model::Backend::Any,