.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Debian::L10n::Db 3pm" .TH Debian::L10n::Db 3pm "2021-01-05" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Debian::L10n::Db \- handle database of debian l10n stuff .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 6 \& use Debian::L10n::Db; \& my $l10n_db = Debian::L10n::Db\->new(); \& $l10n_db\->read("../data/unstable"); \& foreach ($l10n_db\->list_packages()) { \& print "Package $_ ".$l10n_db\->version($_)."\en"; \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is an interface to the database files used in several places of the debian localisation infrastructure, such as the webpages under \&\f(CW\*(C`webwml//internaltional/l10n/\*(C'\fR. .SH "METHODS" .IX Header "METHODS" .IP "new" 4 .IX Item "new" This is the constructor, it only performs some initialization. .Sp .Vb 1 \& my $l10n_db = Debian::L10n::Db\->new(); .Ve .IP "read" 4 .IX Item "read" Read database from a given file. Returns 1 on success and otherwise 0. .Sp .Vb 1 \& $l10n_db\->read("foo"); .Ve .IP "write" 4 .IX Item "write" Write database into file. .Sp .Vb 1 \& $l10n_db\->write("foo"); .Ve .IP "list_packages" 4 .IX Item "list_packages" Returns an array with the list of package names .IP "clear_pkg" 4 .IX Item "clear_pkg" Reset info for a given package .Sp .Vb 1 \& $l10n_db\->clear_pkg("foo"); .Ve .IP "set_status" 4 .IX Item "set_status" Change the status for the category specified as second argument. .IP "del_status" 4 .IX Item "del_status" If a reference to a statusline is provided, it removes the first found It should remove the right line (pkg, type, and file) from the \s-1DB,\s0 and empty the package if nothing else is left. .IP "get_header" 4 .IX Item "get_header" Returns the value of the specified header .IP "set_header" 4 .IX Item "set_header" Sets the specified header to the specified value .IP "get_date" 4 .IX Item "get_date" Returns date of generation .IP "set_date" 4 .IX Item "set_date" Sets the date of generation .IP "clean-db" 4 .IX Item "clean-db" clean_db cleans the database by removing data for a document whose status is \&'done' for more than three days. .SS "\s-1DATA MANIPULATION\s0" .IX Subsection "DATA MANIPULATION" Data about packages can be classified within scalar values (\f(CW\*(C`package\*(C'\fR, \&\f(CW\*(C`version\*(C'\fR, \f(CW\*(C`section\*(C'\fR, \f(CW\*(C`priority\*(C'\fR, \f(CW\*(C`maintainer\*(C'\fR, \f(CW\*(C`pooldir\*(C'\fR, \f(CW\*(C`type\*(C'\fR, \&\f(CW\*(C`upstream\*(C'\fR), arrays (\f(CW\*(C`errors\*(C'\fR, \f(CW\*(C`catgets\*(C'\fR, \f(CW\*(C`gettext\*(C'\fR), and arrays of arrays (\f(CW\*(C`nls\*(C'\fR, \f(CW\*(C`po\*(C'\fR, \f(CW\*(C`po4a\*(C'\fR, \f(CW\*(C`templates\*(C'\fR, \f(CW\*(C`podebconf\*(C'\fR, \f(CW\*(C`man\*(C'\fR, \f(CW\*(C`menu\*(C'\fR and \f(CW\*(C`desktop\*(C'\fR). Each field has a method with the same name to get and set it, e.g. .PP .Vb 2 \& $section = $l10n_db\->section($pkg); \& $l10n_db\->section($pkg, "libs"); .Ve .PP The first line get the section associated with the package in \f(CW$pkg\fR, whereas the second set it to \f(CW\*(C`libs\*(C'\fR. .PP Two other methods are also defined to access those data, by prefixing field name by \f(CW\*(C`has_\*(C'\fR and \f(CW\*(C`add_\*(C'\fR. The former is used to ask whether this field is defined in database, and the latter appends values for arrays or arrays of arrays. .PP .Vb 4 \& if ($l10n_db\->has_templates($pkg)) { \& print "Package $pkg has Debconf templates\en"; \& } \& $l10n_db\->add_po($pkg, \*(Aqpo/fr.po\*(Aq, \*(Aqfr\*(Aq, \*(Aq42t0f0u\*(Aq, \*(Aqpo/adduser_3.42_po_fr.po\*(Aq); .Ve .SH "AUTHOR" .IX Header "AUTHOR" Copyright (C) 2001\-2004 Denis Barbier Copyright (C) 2004 Martin Quinson .PP This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.