r50705 - in /trunk/libopenoffice-oodoc-perl: Changes INSTALL META.yml OODoc.pm OODoc/File.pm OODoc/File.pod OODoc/XPath.pm OODoc/XPath.pod README build_date debian/changelog

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Mon Jan 11 14:59:03 UTC 2010


Author: jawnsy-guest
Date: Mon Jan 11 14:58:56 2010
New Revision: 50705

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=50705
Log:
New upstream release

Modified:
    trunk/libopenoffice-oodoc-perl/Changes
    trunk/libopenoffice-oodoc-perl/INSTALL
    trunk/libopenoffice-oodoc-perl/META.yml
    trunk/libopenoffice-oodoc-perl/OODoc.pm
    trunk/libopenoffice-oodoc-perl/OODoc/File.pm
    trunk/libopenoffice-oodoc-perl/OODoc/File.pod
    trunk/libopenoffice-oodoc-perl/OODoc/XPath.pm
    trunk/libopenoffice-oodoc-perl/OODoc/XPath.pod
    trunk/libopenoffice-oodoc-perl/README
    trunk/libopenoffice-oodoc-perl/build_date
    trunk/libopenoffice-oodoc-perl/debian/changelog

Modified: trunk/libopenoffice-oodoc-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libopenoffice-oodoc-perl/Changes?rev=50705&op=diff
==============================================================================
--- trunk/libopenoffice-oodoc-perl/Changes (original)
+++ trunk/libopenoffice-oodoc-perl/Changes Mon Jan 11 14:58:56 2010
@@ -1,3 +1,10 @@
+2.111   2010-01-10
+        File.pod, XPath.pod: doc update.
+	File.pm: target file no longer require at creation time.
+        File.pm: fixed bug #53552, real support for filehandles.
+        XPath.pm: changes related to filehandle support and bug #53552.
+        XPath.pm: utf8 becomes the default local character set.
+        INSTALL: doc update.
 2.109   2010-01-05
 	Cosmetic changes in the installation tests; changed the test image.
 	Updated template documents.

Modified: trunk/libopenoffice-oodoc-perl/INSTALL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libopenoffice-oodoc-perl/INSTALL?rev=50705&op=diff
==============================================================================
--- trunk/libopenoffice-oodoc-perl/INSTALL (original)
+++ trunk/libopenoffice-oodoc-perl/INSTALL Mon Jan 11 14:58:56 2010
@@ -1,4 +1,4 @@
-OpenOffice::OODoc installation (2010-01-05)
+OpenOffice::OODoc installation (2010-01-06)
 
 SYSTEM REQUIREMENTS
 
@@ -7,7 +7,6 @@
 	XML::Twig	>= 3.32
 	Time::Local	>= 1.07
 	File::Temp	>= 0.12
-	IO::File	>= 1.14
 
 INSTALLATION FROM THE CPAN DISTRIBUTION
 
@@ -30,15 +29,67 @@
 	knowing that the CPAN Archive::Zip and XML::Twig distributions can
 	indirectly bring a lot of C source code.
 
-	You will be prompted for the following parameters:
-	- the local character set (default = iso-8859-1);
-	- an optional color map file (default = none), if the user needs to
-	use symbolic names instead of RGB values for color attributes in the
-	documents (this file can be the generally available "rgb.txt" file
-	of the X-Window system, or any specific, user-defined file with the same
-	structure);
-	- the working directory for temporary files (by default, the working
-	directory is ".", i.e. the current directory of each application);
+	You will be prompted for the local character set (default = utf8), an
+	optional color map (default = none), the working directory path
+	(default = current directory of each application), and the default
+	file format (OOo 1.0 or ODF, default = ODF). The defaults are convenient
+	is most situations; however the following explanations could prove
+	useful.
+	
+	The default local character set is 'utf8', but it may be anyone of the
+	character sets supported by the Encode Perl module. The standard ODF
+	internal character set is always utf8 but the OpenOffice::OODoc module
+	transparently allows the applications to deal with the text content as
+	if it was natively in their local, possibly non-utf8 character set. The
+	appropriate transcoding is automatically provided, according to the
+	declared local character set.
+	
+	The role of the optional color map file is to allow the programmer to
+	use symbolic names instead of RGB values for color attributes, knowing
+	that OpenOffice::OODoc allows the applications to specify color
+	parameters in some situation (characters, backgrounds, shapes, borders,
+	and so on). Each line of this configuration file, if provided, should
+	have the following structure:
+	
+	        R G B name
+	        
+	where 'R', 'G' and 'B' are integer values in the 0-255 range for red,
+	green and blue, and 'name' is an arbitrary symbolic name for the given
+	RGB combination. Example:
+	
+	        135 206 235     SkyBlue
+	
+	The line above in the color map file allows the application programmer
+	to use "SkyBlue" as a replacement for the [135,206,235] list with a
+	color definition function. Such a file may be created by the user or
+	borrowed to the environment. For example, the standard RGB file that is
+	available in a typical X-Window or Xorg environment may be used as is or
+	customized (this file is often located at /etc/X11/rgb.txt on Unix-like
+	platforms, and it may be downloaded on any non-Unix platform).
+	
+	The choice of the working directory may be a sensitive choice in
+	constrained environments and/or for long-running processes, while it's
+	generally not an issue in a typical office environment. Each time a
+	document is created or updated, OpenOffice::OODoc generates intermediate
+	files which are automatically deleted after use (some of them can remain
+	in case of crash only). The default path is ".", meaning that these
+	intermediate files will be created in the current directory of each
+	application; if needed, it may be replaced by any absolute or relative
+	path. In distributed environments, it's recommended to specify a
+	location in a local filesystem for performance reasons.
+
+        For historical reasons, OpenOffice::OODoc supports both the primary
+        OpenOffice.org 1.0 file format (now deprecated) and the present standard
+        Open Document Format (ODF). By default, ODF is the preferred format,
+        and it's strongly recommended to let this configuration parameter
+        unchanged. The choice of a preferred format doesn't prevent the
+        applications to process documents in the other format; the format that
+        is declared as "preferred" will just be selected to create any new
+        document, but OpenOffice::OODoc will not change the format of an
+        existing document. Be careful: knowing that the legacy OpenOffice.org
+        1.0 format is disappearing, it will not necessarily supported by future 
+        versions of OpenOffice::OODoc. 
+
 	- the preferred file format, to be used when you create a new
 	document from scratch (answer "1" for OpenOffice.org, "2" for OASIS
 	OpenDocument Format, default is "2").
@@ -83,4 +134,7 @@
 	this script displays the version number, the package build date,
 	and the installation path. A more sophisticated script, oodoc_test,
 	is provided as an executable example; this script generates a document
-	which may be checked using an ODF-compatible text processor.
+	which may be checked using an ODF-compatible text processor. Be careful,
+	while both oodoc_version and oodoc_test are provided in the original
+	CPAN distribution, they are not necessarily available in any derived
+	OpenOffice::OODoc package.

Modified: trunk/libopenoffice-oodoc-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libopenoffice-oodoc-perl/META.yml?rev=50705&op=diff
==============================================================================
--- trunk/libopenoffice-oodoc-perl/META.yml (original)
+++ trunk/libopenoffice-oodoc-perl/META.yml Mon Jan 11 14:58:56 2010
@@ -1,19 +1,27 @@
 --- #YAML:1.0
-name:                OpenOffice-OODoc
-version:             2.109
-abstract:            The Perl Open OpenDocument Connector
-license:             LGPL
-author:              
+name:               OpenOffice-OODoc
+version:            2.111
+abstract:           The Perl Open OpenDocument Connector
+author:
     - Jean-Marie Gouarne <jmgdoc at cpan.org>
-generated_by:        ExtUtils::MakeMaker version 6.42
-distribution_type:   module
-requires:     
-    Archive::Zip:                  1.18
-    File::Find:                    1.01
-    File::Temp:                    0.12
-    IO::File:                      1.14
-    Time::Local:                   1.07
-    XML::Twig:                     3.32
+license:            LGPL
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
+requires:
+    Archive::Zip:  1.18
+    File::Find:    1.01
+    File::Temp:    0.12
+    IO::File:      1.14
+    Time::Local:   1.07
+    XML::Twig:     3.32
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.56
 meta-spec:
-    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
-    version: 1.3
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: trunk/libopenoffice-oodoc-perl/OODoc.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libopenoffice-oodoc-perl/OODoc.pm?rev=50705&op=diff
==============================================================================
--- trunk/libopenoffice-oodoc-perl/OODoc.pm (original)
+++ trunk/libopenoffice-oodoc-perl/OODoc.pm Mon Jan 11 14:58:56 2010
@@ -1,6 +1,6 @@
 #-----------------------------------------------------------------------------
 #
-#	$Id : OODoc.pm 2.109 2010-01-05 JMG$
+#	$Id : OODoc.pm 2.111 2010-01-10 JMG$
 #
 #	Created and maintained by Jean-Marie Gouarne
 #	Copyright 2008 by Genicorp, S.A. (www.genicorp.com)
@@ -16,7 +16,7 @@
 
 package	OpenOffice::OODoc;
 use 5.008_000;
-our $VERSION				= 2.109;
+our $VERSION				= 2.111;
 
 require Exporter;
 our @ISA    = qw(Exporter);

Modified: trunk/libopenoffice-oodoc-perl/OODoc/File.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libopenoffice-oodoc-perl/OODoc/File.pm?rev=50705&op=diff
==============================================================================
--- trunk/libopenoffice-oodoc-perl/OODoc/File.pm (original)
+++ trunk/libopenoffice-oodoc-perl/OODoc/File.pm Mon Jan 11 14:58:56 2010
@@ -1,18 +1,17 @@
 #-----------------------------------------------------------------------------
 #
-#	$Id : File.pm 2.201 2009-06-06 JMG$
+#	$Id : File.pm 2.202 2010-01-10 JMG$
 #
 #	Created and maintained by Jean-Marie Gouarne
-#	Copyright 2009 by Genicorp, S.A. (www.genicorp.com)
+#	Copyright 2010 by Genicorp, S.A. (www.genicorp.com)
 #
 #-----------------------------------------------------------------------------
 
 package	OpenOffice::OODoc::File;
 use	5.008_000;
-our	$VERSION	= 2.201;
+our	$VERSION	= 2.202;
 use	Archive::Zip	1.18	qw ( :DEFAULT :CONSTANTS :ERROR_CODES );
 use	File::Temp;
-use	IO::File;
 
 #-----------------------------------------------------------------------------
 # some defaults
@@ -168,6 +167,42 @@
 		}
 	return $archive;
 	}
+
+#-----------------------------------------------------------------------------
+# existing ZIP file container loader
+
+sub     _load_container
+        {
+        my $container   = shift         or return undef;
+        my $source      = shift         or return undef;
+        
+        my $z = Archive::Zip->new;
+        
+        if (UNIVERSAL::isa($source, 'IO::File'))
+                {
+                if ($z->readFromFileHandle($source) != AZ_OK)
+                        {
+                        warn "[" . __PACKAGE__ . "::new] Handle read error\n";
+                        return undef;
+                        }
+                }
+        else
+                {
+		unless	( -e $source && -f $source && -r $source )
+			{
+			warn	"[" . __PACKAGE__ . "::new] "	.
+				"File $source unavailable\n";
+			return undef;
+			}
+		if ($z->read($source) != AZ_OK)
+			{
+			warn "[" . __PACKAGE__ . "::new] File read error\n";
+			return undef;
+			}
+                }
+        $container->{'source_file'} = $source;
+        return $z;
+        }
 
 #-----------------------------------------------------------------------------
 # control & conversion of XML component names of the OO file
@@ -319,7 +354,7 @@
 	}
 
 #-----------------------------------------------------------------------------
-# constructor; requires an existing regular OO file
+# constructor
 
 sub	new
 	{
@@ -358,39 +393,8 @@
 		warn "[" . __PACKAGE__ . "::new] Wrong 'opendocument' option\n";
 		return undef;
 		}
-		
-	if ($sourcefile->isa('IO::Handle'))
-		{
-		$self->{'io_handle'}	= $sourcefile;
-		}
-	else
-		{
-		$self->{'source_file'}	= $sourcefile;
-		}
-	
-	unless	($sourcefile)
-		{
-		warn "[" . __PACKAGE__ . "::new] Missing file name\n";
-		return undef;
-		}
-	
-	unless ($self->{'create'})
-		{
-		unless	( -e $sourcefile && -f $sourcefile && -r $sourcefile )
-			{
-			warn	"[" . __PACKAGE__ . "::new] "	.
-				"File $sourcefile unavailable\n";
-			return undef;
-			}
-		$self->{'archive'} = Archive::Zip->new;
-		if ($self->{'archive'}->read($self->{'source_file'}) != AZ_OK)
-			{
-			delete $self->{'archive'};
-			warn "[" . __PACKAGE__ . "::new] Read error\n";
-			return undef;
-			}
-		}
-	else
+		                                                
+	if ($self->{'create'})                  # new ODF container
 		{
 		$self->{'create'} = 'drawing'
 			if $self->{'create'} eq 'graphics';
@@ -406,8 +410,20 @@
 			warn	"[" . __PACKAGE__ . "::new] "	.
 				"Bad or missing template\n";
 			return undef;
-			}
-		}
+			}
+		$self->{'source_file'} = $sourcefile || "";
+		}
+	elsif   ($sourcefile)                   # existing container
+		{
+		$self->{'archive'}      = _load_container($self, $sourcefile);
+		return undef unless $self->{'archive'};
+		}
+	else
+		{
+		warn "[" . __PACKAGE__ . "::new] Missing source file\n";
+		return undef;
+		}
+	        
 	$self->{'members'} = [ $self->{'archive'}->memberNames ];
 	return bless $self, $class;
 	}
@@ -659,33 +675,33 @@
 
 				# target file check --------------------------
 
-	$targetfile	= $self->{'source_file'}	unless $targetfile;
-	if ( -e $targetfile )
-		{
-		unless ( -f $targetfile )
-			{
-			warn 	"[" . __PACKAGE__ . "::save] "	.
-				"$targetfile is not a regular file\n";
-			return undef;
-			}
-		unless ( -w $targetfile )
-			{
-			warn 	"[" . __PACKAGE__ . "::save "	.
-				"$targetfile is read only\n";
-			return undef;
-			}
+	$targetfile	= $self->{'source_file'}	unless $targetfile;
+	if (UNIVERSAL::isa($targetfile, 'IO::File'))
+	        {
+	        $outfile = $self->new_temp_file_name();
+	        }
+	else
+	        {
+	        if ( -e $targetfile )
+		        {
+		        unless ( -f $targetfile )
+		        	{
+			        warn 	"[" . __PACKAGE__ . "::save] "	.
+				        "$targetfile is not a regular file\n";
+			        return undef;
+			        }
+		        unless ( -w $targetfile )
+			        {
+			        warn 	"[" . __PACKAGE__ . "::save "	.
+				        "$targetfile is read only\n";
+			        return undef;
+			        }
+			}
+		$outfile = ($targetfile eq $self->{'source_file'}) ?
+		        $self->new_temp_file_name()     :
+		        $targetfile;		        
 		}
 		
-				# output to temporary file if target eq source
-
-	if ($targetfile eq $self->{'source_file'})
-		{
-		$outfile = $self->new_temp_file_name;
-		}
-	else
-		{
-		$outfile = $targetfile;
-		}
 
 				# discriminate replaced/added members --------
 
@@ -704,14 +720,17 @@
 			}
 		}
 		
-				# target archive operation -------------------
-
-	$self->{'archive'}->writeToFileNamed($outfile);
-	my $archive	= Archive::Zip->new;
-	my $status	= $archive->read($outfile);
+				# target archive operation -------------------
+				
+				        # output to temporary archive
+        $self->{'archive'}->writeToFileNamed($outfile);
+
+                                        # reload temporary archive
+	my $archive	= Archive::Zip->new;
+	my $status      = $archive->read($outfile);
 	unless ($status == AZ_OK)
 		{
-		warn "[" . __PACKAGE__ . "::save] Archive write error\n";
+		warn "[" . __PACKAGE__ . "::save] Archive I/O error\n";
 		return undef;
 		}
 	
@@ -753,13 +772,21 @@
 
 				# post write control & cleanup ---------------
 	if ($status == AZ_OK)
-		{
+		{
 		unless ($outfile eq $targetfile)
 			{
 			require File::Copy;
-
-			unlink $targetfile;
-			File::Copy::move($outfile, $targetfile);
+
+                        if (UNIVERSAL::isa($targetfile, 'IO::File'))
+                                {
+                                File::Copy::cp($outfile, $targetfile);
+                                unlink $outfile;
+                                }
+                        else
+                                {
+			        unlink $targetfile;
+			        File::Copy::move($outfile, $targetfile);
+			        }
 			}
 		$self->remove_temp_files;
 		return 1;

Modified: trunk/libopenoffice-oodoc-perl/OODoc/File.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libopenoffice-oodoc-perl/OODoc/File.pod?rev=50705&op=diff
==============================================================================
--- trunk/libopenoffice-oodoc-perl/OODoc/File.pod (original)
+++ trunk/libopenoffice-oodoc-perl/OODoc/File.pod Mon Jan 11 14:58:56 2010
@@ -28,18 +28,38 @@
 
 =head2	Methods
 
-=head3	Constructor : OpenOffice::OODoc::File->new(<filename>)
+=head3	Constructor : OpenOffice::OODoc::File->new(filename|handle)
 
         Short Forms (equivalent):
-		odfFile(filename), odfContainer(filename), or odfPackage()
-
-        Returns an instance of OODoc::File if <filename> is a valid zip
-        archive name.
-
-        Example:
-
-            my $archive	=
-            	OpenOffice::OODoc::File->new("my_document.odt");
+		odfFile(), odfContainer(), or odfPackage()
+
+        Returns an instance of OODoc::File if the argument corresponds to a
+        valid and accessible zip archive. The argument may be either a
+        file path/name or an open (in binmode) and seekable IO::File.
+        
+        The file or file handle used here is used in order to initialize the
+        ODF Connector for subsequent processing through the other submodules
+        of the OpenOffice::OODoc API. It becomes the default target file if
+        the data are updated and the changes committed using save().
+        
+        If the OODoc::File object is loaded for update, it's strongly
+        recommended to avoid the use of a single IO::File object to read and
+        write. However, if the source is a file name, the same file name may
+        be safely used as the source and the target (of course and as usual,
+        any sensitive document must be backed up before processing).
+        
+        If the "create" option is set (see below), a file path/name may be
+        provided, but a file handle must be avoided.
+        
+        See the explanations about the save() method below.
+
+        Examples:
+
+            my $container1 = odfContainer("doc1.odt");
+ 
+            my $fh = new IO::File "< doc2.odt";
+            binmode $fh;           
+            my $container2 = odfContainer($fh);
 
         An optional argument can be passed in hash format (key => value),
         after the filename. Like this:
@@ -65,7 +85,15 @@
 	terminology, so it is one of the following values: "text",
 	spreadsheet", "presentation", "drawing". These values are the same
 	as the legal parameters of contentClass() in OpenOffice::OODoc::XPath.
-	For a very advanced use, it's possible to pass an additional option
+	If "create" is provided, the first argument must not be a file handle,
+	knowing that the target (if the data is later saved) can't be an
+	open file, and that there is by definition no source file. Note that,
+	for a creation, the value of the file argument is ignored so it may be
+	undef or an empty string; however a valid path/name may be provided in
+	order to provide a default target for a subsequent save().
+
+	For a very advanced use, it's possible to combine "create" with an
+	additional option
 
 		template_path	=> "path"
 
@@ -79,7 +107,7 @@
 	presently odt, ods, odp, odg, sxw, sxc, sxi, sxd. Of course, some
 	applications don't need all the templates; for example, the
 	"template.sx?" files should be omitted if the user don't want to
-	use the legacy OpenOffice.org format for new documents.
+	use the legacy OpenOffice.org 1.0 format for new documents.
 
 	When the "create" option is used, it's possible to provide an
 	"opendocument" option in order to override the installation-level
@@ -88,7 +116,9 @@
 	OpenDocument format; if it's set to "0", "off" or "false", the new
 	document will be created according to the OpenOffice.org 1.0 format.
 	The "opendocument" option is ignored without the "create" one (this
-	tool is not a format converter for existing documents).
+	tool is not a format converter for existing documents). Remember that
+	the default format is set to OpenDocument in the CPAN distribution
+	and the OpenOffice.org 1.0 format is deprecated.
 
         The returned object of new(), if successful, is a valid File object,
 	whose methods listed below become available.
@@ -242,37 +272,43 @@
         moment of the save() call, even if it had perhaps been modified in the
         meantime (probably not a very useful outcome).
 
-=head3	save([<filename>])
-
-        Saves the content of the archive to a file replacing the content of
-        some or all of the XML members with data supplied by the linked
-        OODoc::XPath object(s). Each updated member must be indicated in the
-        form of a hash element whose key corresponds to a standard XML
-        member of an OpenDocument file, in the same way as for an extract
-        call with the value being the new XML content to be saved.
+=head3	save([filename|handle])
+
+        Commits all the changes made in the members of the archive and makes
+        the resulting content persistent.
 
 	In addition, the external, non-XML resources (i.e. image files) that
 	have previously been targeted by import methods, if any, are
 	physically imported when save() is called (and not before). If these
 	resources are not available at this time, they are ignored and a
-	warning is issued for each missing file. 
+	warning is issued for each missing file.
 
         Example:
 
         	$archive->save("target.odt");
 
-        Please note that File does not check the content, and the save()
+        The target may be a file name (with optional path) or an IO::File
+        object (that must be open, in binmode and writable).
+
+        Without argument, save(), attempts to write the on the file or handle
+        that was specified as the source file at the creation time, if any.
+        However, if the OODoc::File was initialized with a IO::File, the use of
+        the same IO::File for writing the output is presently not recommended;
+        in some situations, bi-directional I/Os against an application-provided
+        open IO::File may result in unpredictable results with the current
+        implementation. Of course, if the OODoc::File object has been
+        initialized with the "create" option and with an undef value or an
+        empty string as file name, save() requires an explicit target (a valid
+        file/path or an open and writable IO::File).
+
+        Please note that OODoc::File does not check the content, and the save()
         method can be used to force through any data which may produce a
         file not compliant with the ODF packaging specification.
 
         The filename argument is optional. If it is omitted, the source file
-        previously supplied by the constructor call is used. In fact in this
-	case a more complex (but hidden) operation is carried out: firstly
-	it writes to a temporary file and if no error occurs, the source file
-	is deleted and replaced by the temporary file. If something goes wrong
-	during the process, the temporary file remains available in the
-	working directory (whose path depends on the installation parameters).
-	OODoc::File never writes directly to the source file.
+        previously supplied by the constructor call (if any) is updated.
+        Without a filename argument, save() if the source document was got
+        through a IO::Handle.
 
         Even though the life of an OODoc::File object does not necessarily
         end with a save, it is recommended that you avoid repeated

Modified: trunk/libopenoffice-oodoc-perl/OODoc/XPath.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libopenoffice-oodoc-perl/OODoc/XPath.pm?rev=50705&op=diff
==============================================================================
--- trunk/libopenoffice-oodoc-perl/OODoc/XPath.pm (original)
+++ trunk/libopenoffice-oodoc-perl/OODoc/XPath.pm Mon Jan 11 14:58:56 2010
@@ -1,15 +1,15 @@
 #-----------------------------------------------------------------------------
 #
-#	$Id : XPath.pm 2.229 2009-05-24 JMG$
+#	$Id : XPath.pm 2.232 2010-01-10 JMG$
 #
 #	Created and maintained by Jean-Marie Gouarne
-#	Copyright 2008 by Genicorp, S.A. (www.genicorp.com)
+#	Copyright 2010 by Genicorp, S.A. (www.genicorp.com)
 #
 #-----------------------------------------------------------------------------
 
 package	OpenOffice::OODoc::XPath;
 use	5.008_000;
-our	$VERSION	= 2.229;
+our	$VERSION	= 2.232;
 use	XML::Twig	3.32;
 use	Encode;
 
@@ -47,7 +47,7 @@
 					# characters to be escaped in XML
 our	$CHARS_TO_ESCAPE	= "\"<>'&";
 					# standard external character set
-our	$LOCAL_CHARSET		= 'iso-8859-1';
+our	$LOCAL_CHARSET		= 'utf8';
 					# standard ODF character set
 our	$OO_CHARSET		= 'utf8';
 
@@ -373,6 +373,31 @@
 
 #------------------------------------------------------------------------------
 
+sub     _get_container      # get a new OODoc::File container
+        {
+        require OpenOffice::OODoc::File;
+        
+        my $doc         = shift;
+                
+	return OpenOffice::OODoc::File->new
+				(
+				$doc->{'file'},
+				create		=> $doc->{'create'},
+				opendocument	=> $doc->{'opendocument'},
+				template_path	=> $doc->{'template_path'}
+				);
+        }
+        
+sub     _get_flat_file          # get flat ODF content
+        {
+        my $doc         = shift;
+        my $source      = $doc->{'file'};
+	$doc->{'xpath'} = UNIVERSAL::isa($source, 'IO::File') ?
+			     $doc->{'twig'}->safe_parse($source)    :
+			     $doc->{'twig'}->safe_parsefile($source);
+        return $doc->{'path'};
+        }
+
 sub	new
 	{
 	my $caller	= shift;
@@ -448,6 +473,14 @@
 			);
 		}
 
+	                                        # other OODoc::Xpath object
+	$self->{'container'} = $self->{'container'}->{'container'}
+	        if      (
+	                ref $container
+	                        &&
+	                $self->{'container'}->isa('OpenOffice::OODoc::XPath')
+                        );
+	
 	if ($self->{'xml'})			# load from XML string
 		{
 		delete $self->{'container'};
@@ -455,54 +488,50 @@
 		$self->{'xpath'} =
 			$self->{'twig'}->safe_parse($self->{'xml'});
 		delete $self->{'xml'};
-		}
-	elsif (ref $self->{'container'})	# load from OOFile container
+		}	
+	
+	elsif (defined $self->{'container'})
 		{
 		delete $self->{'file'};
-	 	my $obj = $self->{'container'};
-		$self->{'container'} = $obj->{'container'}
-			if $obj->isa('OpenOffice::OODoc::XPath');
-		unless ($self->{'container'}->isa('OpenOffice::OODoc::File'))
-			{
-			warn "[" . __PACKAGE__ . "::new] Invalid container\n";
-			return undef;
-			}
-		my $xml = $self->{'container'}->link($self);
-		$self->{'xpath'} = $self->{'twig'}->safe_parse($xml);
-		}
-	else					# load from file
-		{
-		$self->{'file'} = $self->{'container'};
-		delete $self->{'container'};
-		if	(
-			$self->{'flat_xml'}
+	 	                                # existing OODoc::File object
+	 	if 
+	 	        (
+	 	        UNIVERSAL::isa($self->{'container'},
+	 	        'OpenOffice::OODoc::File')
+	 	        )
+	 	        {
+	 	        my $xml = $self->{'container'}->link($self);
+	 	        $self->{'xpath'} = $self->{'twig'}->safe_parse($xml);
+	 	        }
+	 	                                # source file or filehandle
+	 	else
+	 	        {
+	 	        $self->{'file'} = $self->{'container'};
+	 	        delete $self->{'container'};
+	 	        if	(
+	 	                $self->{'flat_xml'}
 					||
-			(lc $self->{'file'}) =~ /\.xml$/
-			)
-			{			# load from XML flat file
-			$self->{'xpath'} =
-			    $self->{'twig'}->safe_parsefile($self->{'file'});
-			}
-		else
-			{			# load from ODF archive
-			require OpenOffice::OODoc::File;
-
-			$self->{'container'} = OpenOffice::OODoc::File->new
-				(
-				$self->{'file'},
-				create		=> $self->{'create'},
-				opendocument	=> $self->{'opendocument'},
-				template_path	=> $self->{'template_path'}
-				);
-			return undef unless $self->{'container'};
-			delete $self->{'file'};
-			my $xml = $self->{'container'}->link($self);
-			$self->{'xpath'} = $self->{'twig'}->safe_parse($xml);
-			}	
-		}
+			        (lc $self->{'file'}) =~ /\.xml$/
+			        )
+			        		# XML flat file
+			        {
+			        $self->{'xpath'} = _get_flat_file($self);
+			        }
+		        else
+			        {		# new OODoc::File object
+			        $self->{'container'} = _get_container($self);
+			        return undef unless $self->{'container'};
+			        delete $self->{'file'};
+			        my $xml = $self->{'container'}->link($self);
+			        $self->{'xpath'} =
+			                $self->{'twig'}->safe_parse($xml);
+			        }	
+	 	        }				
+		}
+
 	unless ($self->{'xpath'})
 		{
-		warn "[" . __PACKAGE__ . "::new] No well formed content\n";
+		warn "[" . __PACKAGE__ . "::new] No ODF content\n";
 		return undef;
 		}
 						# XML content loaded & parsed

Modified: trunk/libopenoffice-oodoc-perl/OODoc/XPath.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libopenoffice-oodoc-perl/OODoc/XPath.pod?rev=50705&op=diff
==============================================================================
--- trunk/libopenoffice-oodoc-perl/OODoc/XPath.pod (original)
+++ trunk/libopenoffice-oodoc-perl/OODoc/XPath.pod Mon Jan 11 14:58:56 2010
@@ -162,6 +162,14 @@
 	flat XML (available as a string in memory, or loaded from a file).
 	In addition, this constructor is able to create a new document
 	from scratch.
+
+        The value of the 'file' option may be an open IO::File object,
+        that allows the application to use an application-provided file
+        handle. However, you should prefer file paths/names when possible,
+        and read the explanations about the constructor and the save() method
+        in the OpenOffice::OODoc::File manual page before using open file
+        handles. Remember that, as soon as the given file or handle is
+        an ODF container, OODoc::XPath uses OODoc::File.
 
         Parameters are named (hash key => value). The constructor must get
         at least one parameter giving a means of obtaining the XML document
@@ -1434,11 +1442,21 @@
 	Resets the search context to its default value, which is the root of
 	the document. See currentContext().
 
-=head3	save([filename])
+=head3	save([filename|filehandle])
 
 	Saves the content of the current document through a physical
-	output.
-	
+	output, that is either a regular file specified by path/name, or
+	an open, application-provided IO::Handle. If no argument is
+	provided, the document which had been used as the source (if any)
+	is used as the default target.
+	
+	Technically, as soon as the document container is a regular ODF
+	file, this method is a stub for the save() method of the associated
+	OpenOffice::OODoc::File object, so all the related explanations and
+	recommendations given in the OpenOffice::OODoc::File manual chapter
+	apply. So, for example, be careful if the target is an open IO::Handle
+	instead of a file path/name.
+
 	The behaviour of this method depends on the way the current
 	OpenOffice::OODoc::XPath object has been created.
 	
@@ -1485,11 +1503,6 @@
 	above, if, say, the $meta object is created (through odfXPath())
 	with a "read_only" option set to "true", only $content and $styles
 	are really saved by the last instruction.
-
-	Note: OpenOffice::OODoc::XPath doesn't really know anything about
-	the physical archive file; here save() is only a stub method and
-	the real job is done by the save() method of the associated container,
-	which is an OpenOffice::OODoc::File object.
 			
 	If the document is not associated with a regular OpenDocument
 	compressed file (used through an OODoc::File object), it's saved
@@ -2033,7 +2046,7 @@
 
 Contact: jmgdoc at cpan.org
 
-Copyright 2004-2008 by Genicorp, S.A. L<http://www.genicorp.com>
+Copyright 2004-2010 by Genicorp, S.A. L<http://www.genicorp.com>
 
 Initial English version of the reference manual by Graeme A. Hunter
 (graeme.hunter at zen.co.uk).

Modified: trunk/libopenoffice-oodoc-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libopenoffice-oodoc-perl/README?rev=50705&op=diff
==============================================================================
--- trunk/libopenoffice-oodoc-perl/README (original)
+++ trunk/libopenoffice-oodoc-perl/README Mon Jan 11 14:58:56 2010
@@ -35,6 +35,7 @@
 Comments are welcome. They should be posted through the public forum
 (http://www.cpanforum.com/dist/OpenOffice-OODoc).
 
-Bug reports should be registered through the CPAN Request Tracker (http://rt.cpan.org/Public/Dist/Display.html?Name=OpenOffice-OODoc)
+Bug reports should be registered through the CPAN Request Tracker
+(http://rt.cpan.org/Public/Dist/Display.html?Name=OpenOffice-OODoc)
 
 -------------------------------------------------------------------------

Modified: trunk/libopenoffice-oodoc-perl/build_date
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libopenoffice-oodoc-perl/build_date?rev=50705&op=diff
==============================================================================
--- trunk/libopenoffice-oodoc-perl/build_date (original)
+++ trunk/libopenoffice-oodoc-perl/build_date Mon Jan 11 14:58:56 2010
@@ -1,1 +1,1 @@
-2010-01-05T19:34:46
+2010-01-10T22:23:27

Modified: trunk/libopenoffice-oodoc-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libopenoffice-oodoc-perl/debian/changelog?rev=50705&op=diff
==============================================================================
--- trunk/libopenoffice-oodoc-perl/debian/changelog (original)
+++ trunk/libopenoffice-oodoc-perl/debian/changelog Mon Jan 11 14:58:56 2010
@@ -1,3 +1,9 @@
+libopenoffice-oodoc-perl (2.111-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Jonathan Yu <jawnsy at cpan.org>  Mon, 11 Jan 2010 10:00:15 -0500
+
 libopenoffice-oodoc-perl (2.109-1) unstable; urgency=low
 
   [ Jonathan Yu ]




More information about the Pkg-perl-cvs-commits mailing list