logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

DPKG::Parse - Parse various dpkg files into Perl Objects

Author

       Adam Jacob, "holoway@cpan.org"

Description

       DPKG::Parse contains utilities to parse the various files created by dpkg and turn them into helpful Perl
       objects.  Current files understood by various DPKG::Parse modules:

         /var/lib/dpkg/status    - DPKG::Parse::Status
         /var/lib/dpkg/available - DPKG::Parse::Available
         Packages.gz             - DPKG::Parse::Packages

       See each module's documentation for particulars - You should not be calling DPKG::Parse directly.

License

       This  library  is  free  software.  You can redistribute it and/or modify it under the same terms as perl
       itself.

perl v5.34.0                                       2022-06-13                                   DPKG::Parse(3pm)

Methods

       filename($filename)
           A simple accessor for the file currently being parsed.

       entryarray
           Access to the raw array of entries in a given file.

       entryhash
           Access  to  the raw hash of entries.  The key is determined by the module, but is usually the Package
           name.

       new('filename' => '/var/lib/dpkg/status');
           A generic new function; takes a filename and calls the filename() accessor with it.   Should  not  be
           called directly, but through on of the children of this package.

       parse
           A default parse function; simply calls parse_package_format.

       parse_package_format
           Takes a file in a format similar to the dpkg "available" file, and creates DPKG::Parse::Entry objects
           from each entry.

       get_package('name' => 'postfix', 'hash' => 'entryhash');
           The  value  of  a  hash,  if  it  exists.   By default, it uses the value returned by the "entryhash"
           accessor, but that can be overridden with the "hash" parameter.  Usually returns a DPKG::Parse::Entry
           object.

       next_package
           Shifts the next value off the array stored in the entryarray() accessor.  If you want to  access  the
           raw values, do not use this function!  It shifts!

Name

       DPKG::Parse - Parse various dpkg files into Perl Objects

See Also

       DPKG::Parse::Status, DPKG::Parse::Available, DPKG::Parse::Packages, DPKG::Parse::Entry

Synopsis

           use DPKG::Parse::Status;
           my $status = DPKG::Parse::Status->new;
           while (my $entry = $status->next_package) {
               print $entry->package . " " . $entry->version . "\n";
           }

           use DPKG::Parse::Available;
           my $available = DPKG::Parse::Available->new;
           while (my $entry = $available->next_package) {
               print $entry->package . " " . $entry->version . "\n";
           }

See Also