| 1 |
#!/usr/bin/perl |
| 2 |
|
| 3 |
=head1 NAME |
| 4 |
|
| 5 |
Debconf::Format - base class for formatting database output |
| 6 |
|
| 7 |
=cut |
| 8 |
|
| 9 |
package Debconf::Format; |
| 10 |
use warnings; |
| 11 |
use strict; |
| 12 |
use base qw(Debconf::Base); |
| 13 |
|
| 14 |
=head1 DESCRIPTION |
| 15 |
|
| 16 |
This is the base of a class of objects that format database output in |
| 17 |
various ways, and can read in parse the result. |
| 18 |
|
| 19 |
=head1 METHODS |
| 20 |
|
| 21 |
=head2 read(filehandle) |
| 22 |
|
| 23 |
Read one record from the filehandle, parse it, and return a list with two |
| 24 |
elements. The first is the name of the item that was read, and the second |
| 25 |
is a structure as required by Debconf::DbDriver::Cache. Note that the |
| 26 |
filehandle may contain multiple records, so it must be able to recognize an |
| 27 |
end-of-record delimiter of some kind and stop reading after it. |
| 28 |
|
| 29 |
=head2 beginfile(filehandle) |
| 30 |
|
| 31 |
Called at the beginning of each file that is written, before write() is |
| 32 |
called. |
| 33 |
|
| 34 |
=head2 write(filehandle, data, itemname) |
| 35 |
|
| 36 |
Format a record and and write it out to the filehandle. Should include an |
| 37 |
end-of-record marker of some sort that can be recognized by the parse |
| 38 |
function. |
| 39 |
|
| 40 |
data is the same structure read should return. |
| 41 |
|
| 42 |
Returns true on success and false on error. |
| 43 |
|
| 44 |
=head2 endfile(filehandle) |
| 45 |
|
| 46 |
Called at the end of each file that is written. |
| 47 |
|
| 48 |
=head1 AUTHOR |
| 49 |
|
| 50 |
Joey Hess <[email protected]> |
| 51 |
|
| 52 |
=cut |
| 53 |
|
| 54 |
1 |