View on
Jay Bonci > Parse-DebControl > Parse::DebControl



Annotate this POD


New  1
Open  0
View/Report Bugs
Module Version: 2.005   Source  


Parse::DebControl - Easy OO parsing of debian control-like files


        use Parse::DebControl

        $parser = new Parse::DebControl;

        $data = $parser->parse_mem($control_data, $options);
        $data = $parser->parse_file('./debian/control', $options);
        $data = $parser->parse_web($url, $options);

        $writer = new Parse::DebControl;

        $string = $writer->write_mem($singlestanza);
        $string = $writer->write_mem([$stanza1, $stanza2]);

        $writer->write_file($filename, $singlestanza, $options);
        $writer->write_file($filename, [$stanza1, $stanza2], $options);

        $writer->write_file($handle, $singlestanza, $options);
        $writer->write_file($handle, [$stanza1, $stanza2], $options);



        Parse::DebControl is an easy OO way to parse debian control files and 
        other colon separated key-value pairs. It's specifically designed
        to handle the format used in Debian control files, template files, and
        the cache files used by dpkg.

        For basic format information see:

        This module does not actually do any intelligence with the file content
        (because there are a lot of files in this format), but merely handles
        the format. It can handle simple control files, or files hundreds of lines 
        long efficiently and easily.

Class Methods


Version 2.005 - January 13th, 2004

Version 2.004 - January 12th, 2004

Version 2.003 - January 6th, 2004

Version 2.002 - October 7th, 2003

Version 2.001 - September 11th, 2003

Version 2.0 - September 5th, 2003

Version 1.10b - September 2nd, 2003

Version 1.10 - September 2nd, 2003

Version 1.9 - July 24th, 2003

Version 1.8 - July 11th, 2003

Version 1.7 - June 25th, 2003

Version 1.6.1 - June 9th, 2003

Version 1.6 - June 2nd, 2003

Version 1.5 - May 8th, 2003

Version 1.4 - April 30th, 2003

Version 1.3 - April 28th, 2003

Version 1.2b - April 25th, 2003


Version 1.2 - April 24th, 2003


Version 1.1 - April 23rd, 2003


Version 1.0 - April 23rd, 2003


The module will let you parse otherwise illegal key-value pairs and pairs with spaces. Badly formed stanzas will do things like overwrite duplicate keys, etc. This is your problem.

As of 1.10, the module uses advanced regexp's to figure out about comments. If the tests fail, then stripComments won't work on your earlier perl version (should be fine on 5.6.0+)


Change the name over to the Debian:: namespace, probably as Debian::ControlFormat. This will happen as soon as the project that uses this module reaches stability, and we can do some minor tweaks.


Parse::DebControl is copyright 2003,2004 Jay Bonci <>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: