236
236
available at that very moment. A raw_import method can be called
237
237
before the imported file is available (no check of availability is
238
238
made). An error will be caused if the file is absent at the time of
239
the save call. If several raw_import statements are run against the
239
the save() call. If several raw_import statements are run against the
240
240
same filename, there will actually be a corresponding number of
241
241
copies of the file in its final state which are imported at the
242
moment of the save, even if it had perhaps been modified in the
242
moment of the save() call, even if it had perhaps been modified in the
243
243
meantime (probably not a very useful outcome).
245
245
=head3 save([<filename>])
248
248
some or all of the XML members with data supplied by the linked
249
249
OODoc::XPath object(s). Each updated member must be indicated in the
250
250
form of a hash element whose key corresponds to a standard XML
251
member of an OpenOffice.org file, in the same way as for an extract
251
member of an OpenDocument file, in the same way as for an extract
252
252
call with the value being the new XML content to be saved.
254
In addition, the external, non-XML resources (i.e. image files) that
255
have previously been targeted by import methods, if any, are
256
physically imported when save() is called (and not before). If these
257
resources are not available at this time, they are ignored and a
258
warning is issued for each missing file.
256
262
$archive->save("target.odt");
258
Please note that File does not check the content, and the save
264
Please note that File does not check the content, and the save()
259
265
method can be used to force through any data which may produce a
260
file unusable by StarOffice/OpenOffice.org. Normally, supplied data
261
should have been produced by an XPath object or other application
262
producing OpenOffice.org XML.
266
file not compliant with the ODF packaging specification.
264
268
The filename argument is optional. If it is omitted, the source file
265
269
previously supplied by the constructor call is used. In fact in this
266
270
case a more complex (but hidden) operation is carried out: firstly
267
271
it writes to a temporary file and if no error occurs, the source file
268
is deleted and its name given to the temporary file. OODoc::File never
269
writes directly to the source file.
272
is deleted and replaced by the temporary file. If something goes wrong
273
during the process, the temporary file remains available in the
274
working directory (whose path depends on the installation parameters).
275
OODoc::File never writes directly to the source file.
271
277
Even though the life of an OODoc::File object does not necessarily
272
278
end with a save, it is recommended that you avoid repeated