ODF::lpOD::Common - Common utilities provided by the Perl lpOD library
This manual page describes miscellaneous functions and auxiliary features of the lpOD Perl implementation that are not directly linked to the lpOD functional specification.
The utilities introduced in this section are implemented as exported functions. They may be used without package or object reference.
Returns TRUE if the given value may be regarded as true (in the Perl lpOD implementation). The usual Perl true values are interpreted as TRUE, with the a few exceptions. The strings 'false', 'no', and 'off', like 0, undef, and the empty string, are regarded as FALSE.
The common constants TRUE and FALSE (corresponding to 1 and 0) may be used by the applications.
Returns TRUE if the given value is undef, zero, an empty string, 'false', 'no', 'off'. Returns FALSE otherwise.
Translates in an ODF-compliant boolean value (i.e. 'true' or 'false') a Perl/lpOD boolean value. The result may be used as the value of any ODF boolean attribute.
Returns TRUE if the given argument is the name of a valid ODF data type for table cells or variable fields, FALSE otherwise. For example, the first instruction below returns TRUE and the second one returns FALSE:
$check1 = is_odf_datatype('float');
$check2 = is_odf_datatype('complexType');
Converts the given value according to the given type (which must be a regular ODF datatype), and checks it if the value is already in ODF format.
The following example formats the current system date so the result may be used as the value of a date field in a document:
$odf_date = odf_value(time(), 'date');
This function returns undef if the given value is not compatible with the given type.
Note: this function doesn't work for any type in the present developement version.
Translates a numeric time into an ISO-8601, ODF-compliant date.
Translates an ISO-8601 date, coming from an ODF document, into a Perl computable time value.
Some methods are provided by the lpod pseudo-object in order to get or set some configuration parameters.
The info method returns some informations about the current lpOD installation, as a string in scalar context, or as a hash in array context.
say scalar lpod->info;
The installation_path method returns the path of the ODF::lpOD module installation in the user's filesystem.
All the text/attribute oriented methods of the odf_element may automatically convert the processed content from or to the local encoding of the user. The local encoding is utf8 by default. It may be get or set using the common get_local_encoding or set_local_encoding. The latter must be called with an encoding name that is supported by the Perl Encode module (an alert is issued and nothing is changed if the given encoding is not supported).
my $old_encoding = $lpod->get_local_encoding;
The debug method, when called with TRUE as argument, specifies that the lpOD-issued warnings must display the call stack.
Copyright (c) 2010 Ars Aperta, Itaapy, Pierlis, Talend.
This work was sponsored by the Agence Nationale de la Recherche (http://www.agence-nationale-recherche.fr).
lpOD is free software; you can redistribute it and/or modify it under the terms of either:
a) the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. lpOD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with lpOD. If not, see http://www.gnu.org/licenses/.
b) the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
To install ODF::lpOD, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.