File: Format.pm

package info (click to toggle)
debconf 1.5.91
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,180 kB
  • sloc: perl: 8,500; sh: 262; python: 182; makefile: 144
file content (54 lines) | stat: -rw-r--r-- 1,247 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/perl

=head1 NAME

Debconf::Format - base class for formatting database output

=cut

package Debconf::Format;
use warnings;
use strict;
use base qw(Debconf::Base);

=head1 DESCRIPTION

This is the base of a class of objects that format database output in
various ways, and can read in parse the result.

=head1 METHODS

=head2 read(filehandle)

Read one record from the filehandle, parse it, and return a list with two
elements. The first is the name of the item that was read, and the second
is a structure as required by Debconf::DbDriver::Cache. Note that the
filehandle may contain multiple records, so it must be able to recognize an
end-of-record delimiter of some kind and stop reading after it.

=head2 beginfile(filehandle)

Called at the beginning of each file that is written, before write() is
called.

=head2 write(filehandle, data, itemname)

Format a record and and write it out to the filehandle. Should include an
end-of-record marker of some sort that can be recognized by the parse
function.

data is the same structure read should return.

Returns true on success and false on error.

=head2 endfile(filehandle)

Called at the end of each file that is written.

=head1 AUTHOR

Joey Hess <joeyh@debian.org>

=cut

1