OpenOffice::OODoc is The Perl Open OpenDocument Connector.
# get global access to the content of an OOo file
my $document = ooDocument(file => "MyFile.odt");
# select a text element containing a given string
my $place = $document->selectElementByContent("my search string");
# insert a new text element before the selected one
my $newparagraph = $document->insertParagraph
position => 'before',
text => 'A new paragraph to be inserted',
style => 'Text body'
# define a new graphic style, to display images
# with 20% extra luminance and color inversion
'draw:luminance' => '20%',
'draw:color-inversion' => 'true'
# import an image from an external file, attach it
# to the newly inserted paragraph, to be displayed
# using the newly created style
style => "NewImageStyle",
attachment => $newparagraph,
import => "D:ImagesLandscape.jpg"
# save the modified document
This toolbox is an extensible Perl interface allowing direct read/write operations on OASIS OpenDocument Format (ISO/IEC 26300) or OpenOffice.org files.
It provides a high-level, document-oriented language, and isolates the programmer from the details of the file format. It can process different document classes (texts, spreadsheets, presentations, and drawings). It can retrieve or update styles and images, document metadata, as well as text content.
OpenOffice::OODoc is designed for data retrieval and update in existing documents, as well as full document generation.
See the OpenOffice::OODoc::Intro manual page to have a look at the main features.