File: dpkg-parser.pl

package info (click to toggle)
libconfig-model-dpkg-perl 3.014
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,200 kB
  • sloc: perl: 8,255; python: 242; makefile: 77; javascript: 16; sh: 1
file content (32 lines) | stat: -rw-r--r-- 614 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package MyParser ;

use strict;
use warnings;

use 5.20.1;

# DpkgSyntax uses Log4perl, so we must initialise this module
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($WARN);

# load role
use Mouse ;
with 'Config::Model::Backend::DpkgSyntax';

package main ;
use Path::Tiny;
use YAML::PP;

# load control file
my $file = path('dpkg-test');

# create your parser
my $parser = MyParser->new() ;

# convert control file data in a Perl data structure
# documented in Config::Model::Backend::DpkgSyntax
my $data = $parser->parse_dpkg_file($file, 'yes', 1);

# print this data in YAML format
print Dump $data;