You can subscribe to this list here.
2002 |
Jan
(8) |
Feb
(22) |
Mar
(3) |
Apr
(13) |
May
(1) |
Jun
(4) |
Jul
|
Aug
(5) |
Sep
(9) |
Oct
(36) |
Nov
(7) |
Dec
(15) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(4) |
Feb
(1) |
Mar
(55) |
Apr
(25) |
May
(25) |
Jun
(4) |
Jul
(2) |
Aug
|
Sep
(12) |
Oct
(6) |
Nov
(14) |
Dec
(1) |
2004 |
Jan
(1) |
Feb
(8) |
Mar
(6) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(3) |
Nov
(11) |
Dec
|
2005 |
Jan
(14) |
Feb
(3) |
Mar
(4) |
Apr
(14) |
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(2) |
Nov
(2) |
Dec
(1) |
2006 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(19) |
Nov
(5) |
Dec
|
2007 |
Jan
(5) |
Feb
(1) |
Mar
|
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Joe J. <jj...@us...> - 2002-03-26 17:54:38
|
Update of /cvsroot/perl-xml/Frontier-RPC/lib/Frontier In directory usw-pr-cvs1:/tmp/cvs-serv32158 Modified Files: Responder.pm Log Message: Added better POD Index: Responder.pm =================================================================== RCS file: /cvsroot/perl-xml/Frontier-RPC/lib/Frontier/Responder.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Responder.pm 9 Nov 2000 04:00:49 -0000 1.1 +++ Responder.pm 26 Mar 2002 17:54:35 -0000 1.2 @@ -1,20 +1,32 @@ +# File: Repsonder.pm +# based heavily on Ken MacLeod's Frontier::Daemon +# Author: Joe Johnston 7/2000 +# Revisions: +# 11/2000 - Cleaned/Add POD. Took out 'use CGI'. +# +# Meant to be called from a CGI process to answer client +# requests and emit the appropriate reponses. See POD for details. # -# Copyright (C) 2000 Joe Johnston -# Responder.pm is free software; you can redistribute it -# and/or modify it under the same terms as Perl itself. -# -# $Id$ +# LICENSE: This code is released under the same licensing +# as Perl itself. # -# Meant to be called from a CGI process to answer client -# requests and emit the appropriate reponses. - -use strict; +# Use the code where ever you want, but due credit is appreciated. package Frontier::Responder; +use strict; +use vars qw/@ISA/; + use Frontier::RPC2; -use CGI qw{:all}; +my $snappy_answer = "Hey, I need to return true, don't I?"; + +# Class constructor. +# Input: (expects parameters to be passed in as a hash) +# methods => hashref, keys are API procedure names, values are +# subroutine references +# +# Output: blessed reference sub new { my $class = shift; my %args = @_; @@ -30,6 +42,8 @@ # Grabs input from CGI "stream", makes request # if possible, packs up the response in purddy # XML +# Input: None +# Output: A XML string suitable for printing from a CGI process sub answer{ my $self = shift; @@ -52,6 +66,7 @@ } +# private function. No need to advertise this. # Remember, this is just XML. # CGI.pm doesn't grok this. sub get_cgi_request{ @@ -68,38 +83,88 @@ return $in; } -1; - -__END__ +=pod =head1 NAME -Frontier::Responder - CGI responder for XML-RPC +Frontier::Responder - Create XML-RPC listeners for normal CGI processes =head1 SYNOPSIS - use Frontier::Responder; - + use Frontier::Responder; my $res = Frontier::Responder->new( methods => { - add => sub{ $_[0] + $_[1] }, - cat => sub{ $_[0] . $_[1] }, } ); - + add => sub{ $_[0] + $_[1] }, + cat => sub{ $_[0] . $_[1] }, + }, + ); print $res->answer; =head1 DESCRIPTION -Meant to be called from a CGI process to answer client requests and -emit the appropriate reponses. +Use I<Frontier::Responder> whenever you need to create an XML-RPC listener +using a standard CGI interface. To be effective, a script using this class +will often have to be put a directory from which a web server is authorized +to execute CGI programs. An XML-RPC listener using this library will be +implementing the API of a particular XML-RPC application. Each remote +procedure listed in the API of the user defined application will correspond +to a hash key that is defined in the C<new> method of a I<Frontier::Responder> +object. This is exactly the way I<Frontier::Daemon> works as well. +In order to process the request and get the response, the C<answer> method +is needed. Its return value is XML ready for printing. -[NEED MORE USAGE INFO -- Help please, I don't know CGI.pm well, this -is contributed code and I'm not familiar with how it should be used.] +For those new to XML-RPC, here is a brief description of this protocol. +XML-RPC is a way to execute functions on a different +machine. Both the client's request and listeners response are wrapped +up in XML and sent over HTTP. Because the XML-RPC conversation is in +XML, the implementation languages of the server (here called a I<listener>), +and the client can be different. This can be a powerful and simple way +to have very different platforms work together without acrimony. Implicit +in the use of XML-RPC is a contract or API that an XML-RPC listener +implements and an XML-RPC client calls. The API needs to list not only +the various procedures that can be called, but also the XML-RPC datatypes +expected for input and output. Remember that although Perl is permissive +about datatyping, other languages are not. Unforuntately, the XML-RPC spec +doesn't say how to document the API. It is recomended that the author +of a Perl XML-RPC listener should at least use POD to explain the API. +This allows for the programmatic generation of a clean web page. -=head1 AUTHOR +=head1 METHODS -Joe Johnston E<lt>jj...@or...E<gt> +=over 4 + +=item new( I<OPTIONS> ) + +This is the class constructor. As is traditional, it returns +a blessed reference to a I<Frontier::Responder> object. It expects +arguments to be given like a hash (Perl's named parameter mechanism). +To be effective, populate the C<methods> parameter with a hashref +that has API procedure names as keys and subroutine references as +values. See the SYNOPSIS for a sample usage. + + +=item answer() + +In order to parse the request and execute the procedure, this method +must be called. It returns a XML string that contains the procedure's +response. In a typical CGI program, this string will simply be printed +to STDOUT. + + +=back =head1 SEE ALSO -perl(1), Frontier::RPC2(3). +perl(1), Frontier::RPC2(3) + +<http://www.scripting.com/frontier5/xml/code/rpc.html> + +=head1 AUTHOR + +Ken MacLeod <ke...@bi...> wrote the underlying +RPC library. + +Joe Johnston <jj...@cs...> wrote an adaptation +of the Frontier::Daemon class to create this CGI XML-RPC +listener class. =cut |
From: Joe J. <jj...@us...> - 2002-03-26 17:52:23
|
Update of /cvsroot/perl-xml/CVSROOT In directory usw-pr-cvs1:/tmp/cvs-serv31729 Modified Files: modules Log Message: Added an alias for Frontier-RPC Index: modules =================================================================== RCS file: /cvsroot/perl-xml/CVSROOT/modules,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- modules 11 Jun 2001 22:10:47 -0000 1.1 +++ modules 26 Mar 2002 17:52:19 -0000 1.2 @@ -24,3 +24,9 @@ # character to interpose another module into the current module. This # can be useful for creating a module that consists of many directories # spread out over the entire source repository. + +# Create an alias for Frontier +# cvs co -c shows all the currently defined alias +# For a project like this, being able to get at only certain +# branches is a Good Thing (tm) -- jj...@cs... 3/2002 +Frontier Frontier-RPC |
From: Grant M. <gr...@us...> - 2002-02-14 21:37:10
|
Update of /cvsroot/perl-xml/xml-simple/t In directory usw-pr-cvs1:/tmp/cvs-serv658/t Modified Files: 1_XMLin.t Log Message: Updated for release 1.08_01 Index: 1_XMLin.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/1_XMLin.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- 1_XMLin.t 5 Feb 2002 22:28:31 -0000 1.3 +++ 1_XMLin.t 14 Feb 2002 21:37:05 -0000 1.4 @@ -109,8 +109,8 @@ eval "use XML::Simple;"; ok(1, !$@); # Module compiled OK -unless($XML::Simple::VERSION eq '1.07b') { - print STDERR "Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 1.07b)..."; +unless($XML::Simple::VERSION eq '1.08_01') { + print STDERR "Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 1.08_01)..."; } |
From: Grant M. <gr...@us...> - 2002-02-14 21:37:09
|
Update of /cvsroot/perl-xml/xml-simple In directory usw-pr-cvs1:/tmp/cvs-serv658 Modified Files: Changes README Log Message: Updated for release 1.08_01 Index: Changes =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Changes,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Changes 5 Feb 2002 22:25:16 -0000 1.3 +++ Changes 14 Feb 2002 21:37:04 -0000 1.4 @@ -1,5 +1,15 @@ Revision history for Perl module XML::Simple +1.08_01 Feb 14 2002 - beta release for testing SAX support + - fixed errors with default namespace handling + - minor POD updates + +1.08 Feb 09 2002 + - re-release of 1.06 (stable) with minor updates ... + - searchpath option now defaults to current directory if not set + - fix to Storable test routine for test failures on Win32 + - removed obselete 'convert' script from distribution + 1.07b Feb 05 2002 - beta release for testing SAX support - added SAX support including: + using SAX parsers Index: README =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/README,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- README 5 Feb 2002 22:25:16 -0000 1.3 +++ README 14 Feb 2002 21:37:04 -0000 1.4 @@ -5,11 +5,11 @@ ******* WARNING ******* WARNING ******* WARNING ******* WARNING ******* - This release (1.07b) is a beta release to allow the new SAX code to + This release (1.08_01) is a beta release to allow the new SAX code to be tested on as many platforms as possible. Please try it out if you can and report success/failure to the author. - For production systems, please use the latest stable release (1.06) + For production systems, please use the latest stable release (1.08) ******* WARNING ******* WARNING ******* WARNING ******* WARNING ******* @@ -44,18 +44,24 @@ STATUS - This version (1.07b) is a beta release - to allow testing of the new + This version (1.08_01) is a beta release - to allow testing of the new SAX code. If you encounter any problems installing or running this release, please email the author the complete output of 'make test' (even if your problem does not occur at this point). - The current stable release is version 1.06. This version is + The current stable release is version 1.08. This version is believed to be thread-safe. Please send any feedback to the author: gr...@cp... NEW IN THIS RELEASE + + - fixed errors with default namespace handling + - minor POD updates + + The following additional changes have been made since the last + stable release: - added SAX support including: + using SAX parsers |
From: Grant M. <gr...@us...> - 2002-02-14 21:35:39
|
Update of /cvsroot/perl-xml/xml-simple In directory usw-pr-cvs1:/tmp/cvs-serv32657 Modified Files: maketest Log Message: - removed XML::Parser dependencies Index: maketest =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/maketest,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- maketest 2 Dec 2001 15:51:20 -0000 1.1.1.1 +++ maketest 14 Feb 2002 21:35:35 -0000 1.2 @@ -12,23 +12,6 @@ $verbose = 0; -############################################################################# -# Confirm prerequisite modules are present -# - -eval { require File::Basename }; -die $@ if($@); - -eval { require XML::Parser }; -die $@ if($@); - -unless($INC{'File/Spec'}) { # Should already be loaded by XML::Parser - eval { require File::Spec }; - die $@ if($@); -} - -print "Prerequisite modules are present\n"; - ############################################################################# # Are we in the right directory? If not, the pathname component of $0 |
From: Grant M. <gr...@us...> - 2002-02-14 21:34:43
|
Update of /cvsroot/perl-xml/xml-simple/t In directory usw-pr-cvs1:/tmp/cvs-serv32363/t Modified Files: 8_Namespaces.t Log Message: - fixed broken tests for default namespace declarations Index: 8_Namespaces.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/8_Namespaces.t,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- 8_Namespaces.t 5 Feb 2002 22:13:12 -0000 1.1 +++ 8_Namespaces.t 14 Feb 2002 21:34:34 -0000 1.2 @@ -237,7 +237,7 @@ ); $expected = { - '{http://www.w3.org/2000/xmlns/}' => 'http://www.orgsoc.org/', + 'xmlns' => 'http://www.orgsoc.org/', '{http://www.orgsoc.org/}list' => { '{http://www.orgsoc.org/}member' => [ 'Tom', 'Dick', 'Larry' ] } @@ -267,7 +267,7 @@ # Check that the autogeneration of namespaces works as we expect $opt = { - '{http://www.w3.org/2000/xmlns/}' => 'http://www.orgsoc.org/', + 'xmlns' => 'http://www.orgsoc.org/', '{http://www.orgsoc.org/}list' => { '{http://www.orgsoc.org/}member' => [ 'Tom', 'Dick', 'Larry' ], '{http://www.phantom.com/}director' => [ 'Bill', 'Ben' ], |
From: Grant M. <gr...@us...> - 2002-02-14 21:33:52
|
Update of /cvsroot/perl-xml/xml-simple/t In directory usw-pr-cvs1:/tmp/cvs-serv32178/t Modified Files: 3_Storable.t 5_MemCopy.t Log Message: - changes to workaround test timing issues Index: 3_Storable.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/3_Storable.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- 3_Storable.t 5 Feb 2002 22:28:31 -0000 1.3 +++ 3_Storable.t 14 Feb 2002 21:33:44 -0000 1.4 @@ -206,6 +206,7 @@ open(FILE, ">$XMLFile"); # Re-create it (empty) close(FILE); PassTime((stat($XMLFile))[9]); # But ensure cache file is newer +unlink($CacheFile); # Seems to be rqd for test on Win32 Storable::nstore($Expected, $CacheFile); $opt = XMLin($XMLFile, cache => 'storable'); ok(12, DataCompare($opt, $Expected)); # Got what we expected from the cache Index: 5_MemCopy.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/5_MemCopy.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- 5_MemCopy.t 5 Feb 2002 22:28:31 -0000 1.2 +++ 5_MemCopy.t 14 Feb 2002 21:33:44 -0000 1.3 @@ -201,6 +201,8 @@ open(FILE, ">$XMLFile"); # Write some new data to the XML file print FILE qq(<opt one="1" two="2"></opt>\n); close(FILE); +PassTime(time()); # Ensure current time later than file time + # Parse again with caching enabled $opt = XMLin($XMLFile, cache => 'memcopy'); |
From: Grant M. <gr...@us...> - 2002-02-14 21:32:49
|
Update of /cvsroot/perl-xml/xml-simple In directory usw-pr-cvs1:/tmp/cvs-serv31822 Modified Files: Simple.pm Log Message: fixed broken namespace code which appeared to work with libxml and nothing else - updated POD for searchpath option Index: Simple.pm =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Simple.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Simple.pm 5 Feb 2002 22:23:58 -0000 1.3 +++ Simple.pm 14 Feb 2002 21:32:44 -0000 1.4 @@ -46,7 +46,7 @@ @ISA = qw(Exporter); @EXPORT = qw(XMLin XMLout); -$VERSION = '1.07b'; +$VERSION = '1.08_01'; $PREFERRED_PARSER = undef; my %CacheScheme = ( @@ -68,7 +68,7 @@ my $DefXmlDecl = qq(<?xml version='1.0' standalone='yes'?>); my $xmlns_ns = 'http://www.w3.org/2000/xmlns/'; -my $def_ns_jcn = '{' . $xmlns_ns . '}'; +my $bad_def_ns_jcn = '{' . $xmlns_ns . '}'; # LibXML::SAX workaround ############################################################################## @@ -297,6 +297,10 @@ croak "XMLin() requires either XML::SAX or XML::Parser"; } + if($self->{opt}->{nsexpand}) { + carp "'nsexpand' option requires XML::SAX"; + } + my $xp = new XML::Parser(Style => 'Tree', @{$self->{opt}->{parseropts}}); my($tree); if($filename) { @@ -1026,10 +1030,10 @@ # Look for default namespace declaration first - if(exists($ref->{$def_ns_jcn})) { - $self->{nsup}->declare_prefix('', $ref->{$def_ns_jcn}); - $nsdecls .= qq( xmlns="$ref->{$def_ns_jcn}"); - delete($ref->{$def_ns_jcn}); + if(exists($ref->{xmlns})) { + $self->{nsup}->declare_prefix('', $ref->{xmlns}); + $nsdecls .= qq( xmlns="$ref->{xmlns}"); + delete($ref->{xmlns}); } $default_ns_uri = $self->{nsup}->get_uri(''); @@ -1243,17 +1247,24 @@ my $name = $element->{Name}; if($self->{opt}->{nsexpand}) { $name = $element->{LocalName} || ''; - if(defined($element->{NamespaceURI})) { - $name = "{$element->{NamespaceURI}}$name"; + if($element->{NamespaceURI}) { + $name = '{' . $element->{NamespaceURI} . '}' . $name; } } my $attributes = {}; - while(my($jcname, $attr) = each(%{$element->{Attributes}})) { - if($self->{opt}->{nsexpand}) { - $attributes->{$jcname} = $attr->{Value}; - } - else { - $attributes->{$attr->{Name}} = $attr->{Value}; + if($element->{Attributes}) { # Might be undef + foreach my $attr (values %{$element->{Attributes}}) { + if($self->{opt}->{nsexpand}) { + my $name = $attr->{LocalName} || ''; + if($attr->{NamespaceURI}) { + $name = '{' . $attr->{NamespaceURI} . '}' . $name + } + $name = 'xmlns' if($name eq $bad_def_ns_jcn); + $attributes->{$name} = $attr->{Value}; + } + else { + $attributes->{$attr->{Name}} = $attr->{Value}; + } } } my $newlist = [ $attributes ]; @@ -1430,7 +1441,8 @@ =item A filename If the filename contains no directory components C<XMLin()> will look for the -file in each directory in the searchpath (see L<"OPTIONS"> below). eg: +file in each directory in the searchpath (see L<"OPTIONS"> below) or in the +current directory if the searchpath option is not defined. eg: $ref = XMLin('/etc/params.xml'); @@ -1647,16 +1659,18 @@ =item searchpath => [ list ] (B<in>) -Where the XML is being read from a file, and no path to the file is specified, -this attribute allows you to specify which directories should be searched. +If you pass C<XMLin()> a filename, but the filename include no directory +component, you can use this option to specify which directories should be +searched to locate the file. You might use this option to search first in the +user's home directory, then in a global directory such as /etc. + +If a filename is provided to C<XMLin()> but searchpath is not defined, the +file is assumed to be in the current directory. If the first parameter to C<XMLin()> is undefined, the default searchpath will contain only the directory in which the script itself is located. Otherwise the default searchpath will be empty. -Note: the current directory ('.') is B<not> searched unless it is the directory -containing the script. - =item forcearray => 1 (B<in>) This option should be set to '1' to force nested elements to be represented @@ -1953,8 +1967,8 @@ =head1 SAX SUPPORT -From version 1.07, B<XML::Simple> includes support for SAX (the Simple API for -XML) - specifically SAX2. +From version 1.08_01, B<XML::Simple> includes support for SAX (the Simple API +for XML) - specifically SAX2. In a typical SAX application, an XML Parser (or SAX 'driver') module generates SAX events (start of element, character data, end of element, etc) as it parses @@ -2269,8 +2283,8 @@ =head1 STATUS -This version (1.07b) is a beta (development) release. The current stable -version is 1.06. +This version (1.08_01) is a beta (development) release. The current stable +version is 1.08. =head1 SEE ALSO |
From: Grant M. <gr...@us...> - 2002-02-09 22:38:47
|
Update of /cvsroot/perl-xml/xml-simple/t In directory usw-pr-cvs1:/tmp/cvs-serv27272/t Modified Files: Tag: Release-1_06-maint 5_MemCopy.t Log Message: - added missing pause to cache test code Index: 5_MemCopy.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/5_MemCopy.t,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- 5_MemCopy.t 2 Dec 2001 15:51:38 -0000 1.1.1.1 +++ 5_MemCopy.t 9 Feb 2002 22:38:44 -0000 1.1.1.1.2.1 @@ -199,6 +199,7 @@ open(FILE, ">$XMLFile"); # Write some new data to the XML file print FILE qq(<opt one="1" two="2"></opt>\n); close(FILE); +PassTime(time()); # Ensure current time later than file time # Parse again with caching enabled $opt = XMLin($XMLFile, cache => 'memcopy'); |
From: Grant M. <gr...@us...> - 2002-02-09 22:13:38
|
Update of /cvsroot/perl-xml/xml-simple In directory usw-pr-cvs1:/tmp/cvs-serv20602 Modified Files: Tag: Release-1_06-maint Changes MANIFEST README Simple.pm Removed Files: Tag: Release-1_06-maint convert Log Message: Release 1.08: - release of 1.06 (no SAX code) with minor fixes ... - searchpath defaults to current directory - fix to Storable test routine for test failures on Win32 - removed obselete 'convert' script from distribution Index: Changes =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Changes,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- Changes 2 Dec 2001 15:50:35 -0000 1.1.1.1 +++ Changes 9 Feb 2002 22:13:34 -0000 1.1.1.1.2.1 @@ -1,5 +1,13 @@ Revision history for Perl module XML::Simple +1.08 Feb 09 2002 + - re-release of 1.06 (stable) with minor updates ... + - searchpath option now defaults to current directory if not set + - fix to Storable test routine for test failures on Win32 + - removed obselete 'convert' script from distribution + +1.07b Feb 05 2002 - beta release for testing SAX support + 1.06 Nov 19 2001 - fixed version number in default xmldecl (thanks to Matt Sergeant for bug report and patch) Index: MANIFEST =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/MANIFEST,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- MANIFEST 2 Dec 2001 15:50:35 -0000 1.1.1.1 +++ MANIFEST 9 Feb 2002 22:13:34 -0000 1.1.1.1.2.1 @@ -3,7 +3,6 @@ Makefile.PL README Simple.pm -convert maketest t/1_XMLin.t t/1_XMLin.xml Index: README =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/README,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- README 2 Dec 2001 15:50:35 -0000 1.1.1.1 +++ README 9 Feb 2002 22:13:34 -0000 1.1.1.1.2.1 @@ -30,7 +30,7 @@ STATUS - This version (1.06) is the current stable release. This version is + This version (1.08) is the current stable release. This version is believed to be thread-safe. Please send any feedback to the author: gr...@cp... @@ -38,15 +38,17 @@ NEW IN THIS RELEASE - - minor change to fix version number in default xmldecl (from '1' to '1.0') - - updated contact email address for author + This is a re-release of 1.06 (stable) with minor updates: + - searchpath option now defaults to current directory if not set + - fix to Storable test routine for test failures on Win32 + - removed obselete 'convert' script from distribution See 'Changes' for a detailed history. COPYRIGHT - Copyright 1999-2001 Grant McLean <gr...@cp...> + Copyright 1999-2002 Grant McLean <gr...@cp...> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Index: Simple.pm =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Simple.pm,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.1.1.1.2.2 diff -u -d -r1.1.1.1.2.1 -r1.1.1.1.2.2 --- Simple.pm 7 Feb 2002 22:47:55 -0000 1.1.1.1.2.1 +++ Simple.pm 9 Feb 2002 22:13:34 -0000 1.1.1.1.2.2 @@ -1,3 +1,5 @@ +# $Id$ + package XML::Simple; =head1 NAME @@ -1908,7 +1910,7 @@ =head1 STATUS -This version (1.06) is the current stable version. +This version (1.08) is the current stable version. =head1 SEE ALSO --- convert DELETED --- |
From: Grant M. <gr...@us...> - 2002-02-09 22:13:37
|
Update of /cvsroot/perl-xml/xml-simple/t In directory usw-pr-cvs1:/tmp/cvs-serv20602/t Modified Files: Tag: Release-1_06-maint 3_Storable.t Log Message: Release 1.08: - release of 1.06 (no SAX code) with minor fixes ... - searchpath defaults to current directory - fix to Storable test routine for test failures on Win32 - removed obselete 'convert' script from distribution Index: 3_Storable.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/3_Storable.t,v retrieving revision 1.1.1.1.2.1 retrieving revision 1.1.1.1.2.2 diff -u -d -r1.1.1.1.2.1 -r1.1.1.1.2.2 --- 3_Storable.t 7 Feb 2002 22:48:38 -0000 1.1.1.1.2.1 +++ 3_Storable.t 9 Feb 2002 22:13:34 -0000 1.1.1.1.2.2 @@ -206,6 +206,7 @@ open(FILE, ">$XMLFile"); # Re-create it (empty) close(FILE); PassTime((stat($XMLFile))[9]); # But ensure cache file is newer +unlink($CacheFile); # Seems to be rqd for test on Win32 Storable::nstore($Expected, $CacheFile); $opt = XMLin($XMLFile, cache => 'storable'); ok(12, DataCompare($opt, $Expected)); # Got what we expected from the cache |
From: Grant M. <gr...@us...> - 2002-02-07 22:48:42
|
Update of /cvsroot/perl-xml/xml-simple/t In directory usw-pr-cvs1:/tmp/cvs-serv11170/t Modified Files: Tag: Release-1_06-maint 1_XMLin.t 3_Storable.t Log Message: Test updates Index: 1_XMLin.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/1_XMLin.t,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- 1_XMLin.t 2 Dec 2001 15:51:25 -0000 1.1.1.1 +++ 1_XMLin.t 7 Feb 2002 22:48:38 -0000 1.1.1.1.2.1 @@ -107,8 +107,8 @@ eval "use XML::Simple;"; ok(1, !$@); # Module compiled OK -unless($XML::Simple::VERSION eq '1.06') { - print STDERR "Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 1.06)..."; +unless($XML::Simple::VERSION eq '1.08') { + print STDERR "Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 1.08)..."; } Index: 3_Storable.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/3_Storable.t,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- 3_Storable.t 2 Dec 2001 15:51:35 -0000 1.1.1.1 +++ 3_Storable.t 7 Feb 2002 22:48:38 -0000 1.1.1.1.2.1 @@ -1,3 +1,5 @@ +# $Id$ + use strict; use File::Spec; @@ -203,25 +205,19 @@ ok(11, ! -e $XMLFile); # Original XML file is gone open(FILE, ">$XMLFile"); # Re-create it (empty) close(FILE); -utime($t1, $t1, $XMLFile); # but wind back the clock -$t0 = (stat($XMLFile))[9]; # Skip these tests if that didn't work -if($t0 == $t1) { - $opt = XMLin($XMLFile, cache => 'storable'); - ok(12, DataCompare($opt, $Expected)); # Got what we expected from the cache - ok(13, ! -s $XMLFile); # even though the XML file is empty -} -else { - print STDERR "no utime - skipping test 12..."; - ok(12, 1); - ok(13, 1); -} - +PassTime((stat($XMLFile))[9]); # But ensure cache file is newer +Storable::nstore($Expected, $CacheFile); +$opt = XMLin($XMLFile, cache => 'storable'); +ok(12, DataCompare($opt, $Expected)); # Got what we expected from the cache +ok(13, ! -s $XMLFile); # even though the XML file is empty +$t2 = (stat($CacheFile))[9]; PassTime($t2); -open(FILE, ">$XMLFile"); # Write some new data to the XML file +open(FILE, ">$XMLFile") || # Write some new data to the XML file + die "open(>$XMLFile): $!\n"; print FILE qq(<opt one="1" two="2"></opt>\n); close(FILE); -$opt = XMLin($XMLFile); # Parse with no caching +$opt = XMLin($XMLFile); # Parse with no caching ok(14, DataCompare($opt, { one => 1, two => 2})); # Got what we expected $t0 = (stat($CacheFile))[9]; # And timestamp on cache file my $s0 = (-s $CacheFile); |
From: Grant M. <gr...@us...> - 2002-02-07 22:47:59
|
Update of /cvsroot/perl-xml/xml-simple In directory usw-pr-cvs1:/tmp/cvs-serv10996 Modified Files: Tag: Release-1_06-maint Simple.pm Log Message: Maintenance branch based on 1.06 release - changed version to 1.08 - integrated change to searchpath option Index: Simple.pm =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Simple.pm,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- Simple.pm 2 Dec 2001 15:51:18 -0000 1.1.1.1 +++ Simple.pm 7 Feb 2002 22:47:55 -0000 1.1.1.1.2.1 @@ -42,7 +42,7 @@ @ISA = qw(Exporter); @EXPORT = qw(XMLin XMLout); -$VERSION = '1.06'; +$VERSION = '1.08'; my %CacheScheme = ( storable => [ \&StorableSave, \&StorableRestore ], @@ -645,6 +645,15 @@ my $fullpath = File::Spec->catfile($path, $file); return($fullpath) if(-e $fullpath); } + } + + # If user did not supply a search path, default to current directory + + if(!@search_path) { + if(-e $file) { + return($file); + } + croak "File does not exist: $file"; } croak "Could not find $file in ", join(':', @search_path); |
From: Grant M. <gr...@us...> - 2002-02-05 22:28:34
|
Update of /cvsroot/perl-xml/xml-simple/t In directory usw-pr-cvs1:/tmp/cvs-serv7252/t Modified Files: 0_Config.t 1_XMLin.t 2_XMLout.t 3_Storable.t 4_MemShare.t 5_MemCopy.t 6_ObjIntf.t Log Message: - added CVS Id Index: 0_Config.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/0_Config.t,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- 0_Config.t 2002/01/19 22:15:12 1.1 +++ 0_Config.t 2002/02/05 22:28:31 1.2 @@ -1,3 +1,5 @@ +# $Id$ + BEGIN { print "1..1\n"; } use strict; Index: 1_XMLin.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/1_XMLin.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- 1_XMLin.t 2002/01/19 22:12:49 1.2 +++ 1_XMLin.t 2002/02/05 22:28:31 1.3 @@ -1,3 +1,5 @@ +# $Id$ + use strict; use IO::File; use File::Spec; Index: 2_XMLout.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/2_XMLout.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- 2_XMLout.t 2002/01/19 22:16:50 1.2 +++ 2_XMLout.t 2002/02/05 22:28:31 1.3 @@ -1,3 +1,5 @@ +# $Id$ + use strict; use IO::File; Index: 3_Storable.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/3_Storable.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- 3_Storable.t 2002/01/19 22:17:41 1.2 +++ 3_Storable.t 2002/02/05 22:28:31 1.3 @@ -1,3 +1,5 @@ +# $Id$ + use strict; use File::Spec; Index: 4_MemShare.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/4_MemShare.t,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- 4_MemShare.t 2001/12/02 15:51:37 1.1.1.1 +++ 4_MemShare.t 2002/02/05 22:28:31 1.2 @@ -1,3 +1,5 @@ +# $Id$ + use strict; use File::Spec; Index: 5_MemCopy.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/5_MemCopy.t,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- 5_MemCopy.t 2001/12/02 15:51:38 1.1.1.1 +++ 5_MemCopy.t 2002/02/05 22:28:31 1.2 @@ -1,3 +1,5 @@ +# $Id$ + use strict; use File::Spec; Index: 6_ObjIntf.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/6_ObjIntf.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- 6_ObjIntf.t 2002/01/19 22:18:25 1.2 +++ 6_ObjIntf.t 2002/02/05 22:28:31 1.3 @@ -1,3 +1,5 @@ +# $Id$ + use strict; ############################################################################## |
From: Grant M. <gr...@us...> - 2002-02-05 22:25:19
|
Update of /cvsroot/perl-xml/xml-simple In directory usw-pr-cvs1:/tmp/cvs-serv6595 Modified Files: Changes README Log Message: - updated change log for new release - notice re beta status Index: Changes =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Changes,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Changes 2002/01/19 22:04:17 1.2 +++ Changes 2002/02/05 22:25:16 1.3 @@ -1,6 +1,6 @@ Revision history for Perl module XML::Simple -1.07b Jan ?? 2002 - limited distribution beta +1.07b Feb 05 2002 - beta release for testing SAX support - added SAX support including: + using SAX parsers + acting as a SAX handler Index: README =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/README,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- README 2002/01/19 22:09:36 1.2 +++ README 2002/02/05 22:25:16 1.3 @@ -3,6 +3,17 @@ XML::Simple - Easy API to read/write XML (esp config files) + ******* WARNING ******* WARNING ******* WARNING ******* WARNING ******* + + This release (1.07b) is a beta release to allow the new SAX code to + be tested on as many platforms as possible. Please try it out if you + can and report success/failure to the author. + + For production systems, please use the latest stable release (1.06) + + ******* WARNING ******* WARNING ******* WARNING ******* WARNING ******* + + PREREQUISITES XML::Simple requires a module capable of parsing XML - either XML::SAX or @@ -33,9 +44,10 @@ STATUS - This version (1.07b) is a limited distribution beta release - the first - version to support SAX. If you encounter any problems installing or - running this release, please contact the author. + This version (1.07b) is a beta release - to allow testing of the new + SAX code. If you encounter any problems installing or running this + release, please email the author the complete output of 'make test' + (even if your problem does not occur at this point). The current stable release is version 1.06. This version is believed to be thread-safe. |
From: Grant M. <gr...@us...> - 2002-02-05 22:24:01
|
Update of /cvsroot/perl-xml/xml-simple In directory usw-pr-cvs1:/tmp/cvs-serv6199 Modified Files: Simple.pm Log Message: added warning re parseropts being deprecated - added missing support for default namespaces on output - added code to workaround outstanding issues in NamespaceSupport::declare_prefix() - removed redundant code to translate Clarkian names other than when they are hash keys - added CVS Id Index: Simple.pm =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Simple.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Simple.pm 2002/01/19 22:30:05 1.2 +++ Simple.pm 2002/02/05 22:23:58 1.3 @@ -68,6 +68,7 @@ my $DefXmlDecl = qq(<?xml version='1.0' standalone='yes'?>); my $xmlns_ns = 'http://www.w3.org/2000/xmlns/'; +my $def_ns_jcn = '{' . $xmlns_ns . '}'; ############################################################################## @@ -462,6 +463,7 @@ if($self->{opt}->{nsexpand}) { require XML::NamespaceSupport; $self->{nsup} = XML::NamespaceSupport->new(); + $self->{ns_prefix} = 'aaa'; } @@ -628,7 +630,13 @@ $opt->{cache} = [ $opt->{cache} ]; } - unless(exists($opt->{parseropts})) { + if(exists($opt->{parseropts})) { + if($^W) { + carp "Warning: " . + "'parseropts' is deprecated, contact the author if you need it"; + } + } + else { $opt->{parseropts} = [ ]; } @@ -969,17 +977,6 @@ my $nl = "\n"; - # Translate Clarkian names back to prefix:name form - - if($self->{nsup}) { - my($uri, $lname) = $self->{nsup}->parse_jclark_notation($name); - if($uri) { - my $prefix = $self->{nsup}->get_prefix($uri); - $name = "$prefix:$lname"; - } - } - - # Convert to XML if(ref($ref)) { @@ -1022,10 +1019,23 @@ # Scan for namespace declaration attributes my $nsdecls = ''; + my $default_ns_uri; if($self->{nsup}) { $ref = { %$ref }; # Make a copy before we mess with it $self->{nsup}->push_context(); + # Look for default namespace declaration first + + if(exists($ref->{$def_ns_jcn})) { + $self->{nsup}->declare_prefix('', $ref->{$def_ns_jcn}); + $nsdecls .= qq( xmlns="$ref->{$def_ns_jcn}"); + delete($ref->{$def_ns_jcn}); + } + $default_ns_uri = $self->{nsup}->get_uri(''); + + + # Then check all the other keys + foreach my $qname (keys(%$ref)) { my($uri, $lname) = $self->{nsup}->parse_jclark_notation($qname); if($uri) { @@ -1042,12 +1052,22 @@ foreach my $qname (keys(%$ref)) { my($uri, $lname) = $self->{nsup}->parse_jclark_notation($qname); if($uri) { - my $prefix = $self->{nsup}->get_prefix($uri); - unless($prefix) { - $prefix = $self->{nsup}->declare_prefix(undef, $uri); + if($default_ns_uri and $uri eq $default_ns_uri) { + $ref->{$lname} = $ref->{$qname}; + delete($ref->{$qname}); } - $ref->{"$prefix:$lname"} = $ref->{$qname}; - delete($ref->{$qname}); + else { + my $prefix = $self->{nsup}->get_prefix($uri); + unless($prefix) { + # $self->{nsup}->declare_prefix(undef, $uri); + # $prefix = $self->{nsup}->get_prefix($uri); + $prefix = $self->{ns_prefix}++; + $self->{nsup}->declare_prefix($prefix, $uri); + $nsdecls .= qq( xmlns:$prefix="$uri"); + } + $ref->{"$prefix:$lname"} = $ref->{$qname}; + delete($ref->{$qname}); + } } } } |
From: Grant M. <gr...@us...> - 2002-02-05 22:19:21
|
Update of /cvsroot/perl-xml/xml-simple In directory usw-pr-cvs1:/tmp/cvs-serv4992 Modified Files: Makefile.PL Log Message: - removed superfluous BEGIN block - added check for specific version of XML::NamespaceSupport Index: Makefile.PL =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Makefile.PL,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.PL 2002/01/19 22:07:52 1.2 +++ Makefile.PL 2002/02/05 22:19:18 1.3 @@ -1,48 +1,62 @@ +# $Id$ + use ExtUtils::MakeMaker; -BEGIN { - my $parser_count = 0; - print "Checking for required modules ...\n"; +my $parser_count = 0; +my $fatal = 0; - eval { require XML::SAX }; +print "Checking for required modules ...\n"; + +eval { require XML::SAX }; +if($@) { + print "XML::SAX is not installed\n"; +} +else { + print "XML::SAX is installed ... good\n"; + $parser_count++; + + eval { require XML::NamespaceSupport }; if($@) { - print "XML::SAX is not installed\n"; + print "XML::NamespaceSupport is not installed ... this is required only for generating XML with namespace declarations\n"; } else { - print "XML::SAX is installed ... good\n"; - $parser_count++; - - eval { require XML::NamespaceSupport }; - if($@) { - print "XML::NamespaceSupport is not installed ... this is required only for generating XML with namespace declarations\n"; + if($XML::NamespaceSupport::VERSION < 1.04) { + print "You must upgrade XML::NamespaceSupport to version 1.04 or better\n"; + $fatal++; } else { print "XML::NamespaceSupport is installed ... good\n"; } - } - eval { require XML::Parser }; - if($@) { - print "XML::Parser is not installed\n"; - } - else { - print "XML::Parser is installed ... good\n"; - $parser_count++; - } +} - eval { require Storable }; - if($@) { - print "Storable is not installed ... caching functions will not be available\n"; - } - else { - print "Storable is installed ... good\n"; - } +eval { require XML::Parser }; +if($@) { + print "XML::Parser is not installed\n"; +} +else { + print "XML::Parser is installed ... good\n"; + $parser_count++; +} +eval { require Storable }; +if($@) { + print "Storable is not installed ... caching functions will not be available\n"; +} +else { + print "Storable is installed ... good\n"; +} - unless($parser_count) { - die "You must install either XML::SAX or XML::Parser before XML::Simple"; - } + +unless($parser_count) { + print "You must install either XML::SAX or XML::Parser before XML::Simple\n"; + $fatal++; +} + +if($fatal) { + print "You must correct the above problems before XML::Simple can be installed\n"; + exit(1); } WriteMakefile( |
From: Grant M. <gr...@us...> - 2002-02-05 22:16:56
|
Update of /cvsroot/perl-xml/xml-simple In directory usw-pr-cvs1:/tmp/cvs-serv4386 Modified Files: MANIFEST Log Message: added test scripts and support modules Index: MANIFEST =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/MANIFEST,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- MANIFEST 2002/01/19 22:05:59 1.2 +++ MANIFEST 2002/02/05 22:16:53 1.3 @@ -12,7 +12,10 @@ t/4_MemShare.t t/5_MemCopy.t t/6_ObjIntf.t +t/7_SaxStuff.t +t/8_Namespaces.t t/desertnet.src +t/lib/TagsToUpper.pm t/subdir/test2.xml t/srt.xml t/test1.xml |
From: Grant M. <gr...@us...> - 2002-02-05 22:15:16
|
Update of /cvsroot/perl-xml/xml-simple/t/lib In directory usw-pr-cvs1:/tmp/cvs-serv3949/t/lib Added Files: TagsToUpper.pm Log Message: Silly SAX filter module to support t/7_SaxStuff.t --- NEW FILE: TagsToUpper.pm --- package TagsToUpper; use XML::SAX::Base; use vars qw(@ISA); @ISA = ('XML::SAX::Base'); sub start_element { my $self = shift; my $element = shift; # print Data::Dumper->Dump([$element], ['element']); to_upper($element); foreach (values(%{$element->{Attributes}})) { to_upper($_); } $self->SUPER::start_element($element); } sub end_element { my $self = shift; my $element = shift; to_upper($element); $self->SUPER::end_element($element); } sub to_upper { my $ref = shift; $ref->{LocalName} = uc($ref->{LocalName}) if($ref->{LocalName}); $ref->{Name} = uc($ref->{Name}) if($ref->{LocalName}); $ref->{Prefix} = uc($ref->{Prefix}) if($ref->{LocalName}); } 1; |
From: Grant M. <gr...@us...> - 2002-02-05 22:13:16
|
Update of /cvsroot/perl-xml/xml-simple/t In directory usw-pr-cvs1:/tmp/cvs-serv3361/t Added Files: 8_Namespaces.t Log Message: New test script for namespace handling under SAX --- NEW FILE: 8_Namespaces.t --- # $Id: 8_Namespaces.t,v 1.1 2002/02/05 22:13:12 grantm Exp $ use strict; use File::Spec; use IO::File; eval { require XML::SAX; }; if($@) { print STDERR "no XML::SAX..."; print "1..0\n"; exit 0; } eval { require XML::NamespaceSupport; }; if($@) { print STDERR "no XML::NamespaceSupport..."; print "1..0\n"; exit 0; } if($XML::NamespaceSupport::VERSION < 1.04) { print STDERR "XML::NamespaceSupport is too old (upgrade to 1.04 or better)..."; print "1..0\n"; exit 0; } print "1..7\n"; my $t = 1; ############################################################################## # S U P P O R T R O U T I N E S ############################################################################## ############################################################################## # Print out 'n ok' or 'n not ok' as expected by test harness. # First arg is test number (n). If only one following arg, it is interpreted # as true/false value. If two args, equality = true. # sub ok { my($n, $x, $y) = @_; die "Sequence error got $n expected $t" if($n != $t); $x = 0 if(@_ > 2 and $x ne $y); print(($x ? '' : 'not '), 'ok ', $t++, "\n"); } ############################################################################## # Take two scalar values (may be references) and compare them (recursively # if necessary) returning 1 if same, 0 if different. # sub DataCompare { my($x, $y) = @_; my($i); if(!ref($x)) { return(1) if($x eq $y); print STDERR "$t:DataCompare: $x != $y\n"; return(0); } if(ref($x) eq 'ARRAY') { unless(ref($y) eq 'ARRAY') { print STDERR "$t:DataCompare: expected arrayref, got: $y\n"; return(0); } if(scalar(@$x) != scalar(@$y)) { print STDERR "$t:DataCompare: expected ", scalar(@$x), " element(s), got: ", scalar(@$y), "\n"; return(0); } for($i = 0; $i < scalar(@$x); $i++) { DataCompare($x->[$i], $y->[$i]) || return(0); } return(1); } if(ref($x) eq 'HASH') { unless(ref($y) eq 'HASH') { print STDERR "$t:DataCompare: expected hashref, got: $y\n"; return(0); } if(scalar(keys(%$x)) != scalar(keys(%$y))) { print STDERR "$t:DataCompare: expected ", scalar(keys(%$x)), " key(s) (", join(', ', keys(%$x)), "), got: ", scalar(keys(%$y)), " (", join(', ', keys(%$y)), ")\n"; return(0); } foreach $i (keys(%$x)) { unless(exists($y->{$i})) { print STDERR "$t:DataCompare: missing hash key - {$i}\n"; return(0); } DataCompare($x->{$i}, $y->{$i}) || return(0); } return(1); } print STDERR "Don't know how to compare: " . ref($x) . "\n"; return(0); } ############################################################################## # Copy a file # sub CopyFile { my($Src, $Dst) = @_; open(IN, $Src) || return(undef); local($/) = undef; my $Data = <IN>; close(IN); open(OUT, ">$Dst") || return(undef); print OUT $Data; close(OUT); return(1); } ############################################################################## # T E S T R O U T I N E S ############################################################################## use XML::Simple; # Force default behaviour of using SAX parser if it is available (which it # is or we wouldn't be here). $XML::Simple::PREFERRED_PARSER = ''; # Confirm that by default qnames are not expanded on input my $xml = q(<config xmlns:perl="http://www.perl.com/"> <perl:list count="3" perl:type="array"> <item>one</item> <item>two</item> <item>three</item> <test xmlns:perl="http://www.microsoft.com" perl:tm="trademark" /> </perl:list> </config>); my $expected = { 'perl:list' => { 'count' => '3', 'item' => [ 'one', 'two', 'three' ], 'perl:type' => 'array', 'test' => { 'xmlns:perl' => 'http://www.microsoft.com', 'perl:tm' => 'trademark', } }, 'xmlns:perl' => 'http://www.perl.com/' }; my $opt = XMLin($xml); ok(1, DataCompare($opt, $expected)); # Got what we expected # Try again with nsexpand option set $expected = { '{http://www.perl.com/}list' => { 'count' => '3', 'item' => [ 'one', 'two', 'three' ], '{http://www.perl.com/}type' => 'array', 'test' => { '{http://www.microsoft.com}tm' => 'trademark', '{http://www.w3.org/2000/xmlns/}perl' => 'http://www.microsoft.com' } }, '{http://www.w3.org/2000/xmlns/}perl' => 'http://www.perl.com/' }; $opt = XMLin($xml, nsexpand => 1); ok(2, DataCompare($opt, $expected)); # Got what we expected # Confirm that output expansion does not occur by default $opt = { '{http://www.w3.org/2000/xmlns/}perl' => 'http://www.perl.com/', '{http://www.perl.com/}attr' => 'value', '{http://www.perl.com/}element' => [ 'data' ], }; $xml = XMLout($opt); ok(3, $xml =~ m{ ^\s*<opt \s+{http://www.w3.org/2000/xmlns/}perl="http://www.perl.com/" \s+{http://www.perl.com/}attr="value" \s*> \s*<{http://www.perl.com/}element\s*>data</{http://www.perl.com/}element\s*> \s*</opt> \s*$ }sx); # Confirm nsexpand option works on output $xml = XMLout($opt, nsexpand => 1); ok(4, $xml =~ m{ ^\s*<opt \s+xmlns:perl="http://www.perl.com/" \s+perl:attr="value" \s*> \s*<perl:element\s*>data</perl:element\s*> \s*</opt> \s*$ }sx); # Check that default namespace is correctly read in ... $xml = q(<opt xmlns="http://www.orgsoc.org/"> <list> <member>Tom</member> <member>Dick</member> <member>Larry</member> </list> </opt> ); $expected = { '{http://www.w3.org/2000/xmlns/}' => 'http://www.orgsoc.org/', '{http://www.orgsoc.org/}list' => { '{http://www.orgsoc.org/}member' => [ 'Tom', 'Dick', 'Larry' ] } }; $opt = XMLin($xml, nsexpand => 1); ok(5, DataCompare($opt, $expected)); # ... and written out $xml = XMLout($opt, nsexpand => 1); ok(6, $xml =~ m{ ^\s*<opt \s+xmlns="http://www.orgsoc.org/" \s*> \s*<list> \s*<member>Tom</member> \s*<member>Dick</member> \s*<member>Larry</member> \s*</list> \s*</opt> \s*$ }sx); # Check that the autogeneration of namespaces works as we expect $opt = { '{http://www.w3.org/2000/xmlns/}' => 'http://www.orgsoc.org/', '{http://www.orgsoc.org/}list' => { '{http://www.orgsoc.org/}member' => [ 'Tom', 'Dick', 'Larry' ], '{http://www.phantom.com/}director' => [ 'Bill', 'Ben' ], } }; $xml = XMLout($opt, nsexpand => 1); ok(7, $xml =~ m{ ^\s*<opt \s+xmlns="http://www.orgsoc.org/" \s*> \s*<list\s+xmlns:(\w+)="http://www.phantom.com/"\s*> \s*<member>Tom</member> \s*<member>Dick</member> \s*<member>Larry</member> \s*<\1:director>Bill</\1:director> \s*<\1:director>Ben</\1:director> \s*</list> \s*</opt> \s*$ }sx); exit(0); |
From: Grant M. <gr...@us...> - 2002-02-05 22:12:10
|
Update of /cvsroot/perl-xml/xml-simple/t In directory usw-pr-cvs1:/tmp/cvs-serv2952/t Added Files: 7_SaxStuff.t Log Message: New test script for SAX handling, driving and 'filtering' --- NEW FILE: 7_SaxStuff.t --- # $Id: 7_SaxStuff.t,v 1.1 2002/02/05 22:12:05 grantm Exp $ use strict; use File::Spec; use IO::File; BEGIN { unshift @INC, File::Spec->catfile('t', 'lib'); eval { require XML::SAX; }; if($@) { print STDERR "no XML::SAX..."; print "1..0\n"; exit 0; } } use TagsToUpper; # Initialise filenames and check they're there my $SrcFile = File::Spec->catfile('t', 'desertnet.src'); my $XMLFile = File::Spec->catfile('t', 'desertnet.xml'); my $CacheFile = File::Spec->catfile('t', 'desertnet.stor'); unless(-e $SrcFile) { print STDERR "test data missing..."; print "1..0\n"; exit 0; } print "1..13\n"; my $t = 1; ############################################################################## # S U P P O R T R O U T I N E S ############################################################################## ############################################################################## # Print out 'n ok' or 'n not ok' as expected by test harness. # First arg is test number (n). If only one following arg, it is interpreted # as true/false value. If two args, equality = true. # sub ok { my($n, $x, $y) = @_; die "Sequence error got $n expected $t" if($n != $t); $x = 0 if(@_ > 2 and $x ne $y); print(($x ? '' : 'not '), 'ok ', $t++, "\n"); } ############################################################################## # Take two scalar values (may be references) and compare them (recursively # if necessary) returning 1 if same, 0 if different. # sub DataCompare { my($x, $y) = @_; my($i); if(!ref($x)) { return(1) if($x eq $y); print STDERR "$t:DataCompare: $x != $y\n"; return(0); } if(ref($x) eq 'ARRAY') { unless(ref($y) eq 'ARRAY') { print STDERR "$t:DataCompare: expected arrayref, got: $y\n"; return(0); } if(scalar(@$x) != scalar(@$y)) { print STDERR "$t:DataCompare: expected ", scalar(@$x), " element(s), got: ", scalar(@$y), "\n"; return(0); } for($i = 0; $i < scalar(@$x); $i++) { DataCompare($x->[$i], $y->[$i]) || return(0); } return(1); } if(ref($x) eq 'HASH') { unless(ref($y) eq 'HASH') { print STDERR "$t:DataCompare: expected hashref, got: $y\n"; return(0); } if(scalar(keys(%$x)) != scalar(keys(%$y))) { print STDERR "$t:DataCompare: expected ", scalar(keys(%$x)), " key(s) (", join(', ', keys(%$x)), "), got: ", scalar(keys(%$y)), " (", join(', ', keys(%$y)), ")\n"; return(0); } foreach $i (keys(%$x)) { unless(exists($y->{$i})) { print STDERR "$t:DataCompare: missing hash key - {$i}\n"; return(0); } DataCompare($x->{$i}, $y->{$i}) || return(0); } return(1); } print STDERR "Don't know how to compare: " . ref($x) . "\n"; return(0); } ############################################################################## # Copy a file # sub CopyFile { my($Src, $Dst) = @_; open(IN, $Src) || return(undef); local($/) = undef; my $Data = <IN>; close(IN); open(OUT, ">$Dst") || return(undef); print OUT $Data; close(OUT); return(1); } ############################################################################## # T E S T R O U T I N E S ############################################################################## use XML::Simple; # Initialise test data my $Expected = { 'server' => { 'sahara' => { 'osversion' => '2.6', 'osname' => 'solaris', 'address' => [ '10.0.0.101', '10.0.1.101' ] }, 'gobi' => { 'osversion' => '6.5', 'osname' => 'irix', 'address' => '10.0.0.102' }, 'kalahari' => { 'osversion' => '2.0.34', 'osname' => 'linux', 'address' => [ '10.0.0.103', '10.0.1.103' ] } } }; my $xml = ''; # Force default behaviour of using SAX parser if it is available (which it # is or we wouldn't be here). $XML::Simple::PREFERRED_PARSER = ''; ok(1, CopyFile($SrcFile, $XMLFile)); # Start with known source file unlink($CacheFile); # Ensure there are ... ok(2, ! -e $CacheFile); # ... no cache files lying around # Pass in a filename to check parse_uri() my $opt = XMLin($XMLFile); ok(3, DataCompare($opt, $Expected)); # Got what we expected # Pass in an IO::File object to test parse_file() my $fh = IO::File->new("<$XMLFile"); ok(4, ref($fh)); $opt = XMLin($fh); ok(5, DataCompare($opt, $Expected)); # Got what we expected $fh->close(); # Pass in a string to test parse_string() if(open(XMLFILE, "<$XMLFile")) { local($/) = undef; $xml = <XMLFILE>; close(XMLFILE); } $opt = XMLin($xml); ok(6, DataCompare($opt, $Expected)); # Got what we expected # Pass in '-' for STDIN open(OLDSTDIN, "<&STDIN"); close(STDIN); open(STDIN, "<$XMLFile"); $opt = XMLin('-'); ok(7, DataCompare($opt, $Expected)); # Got what we expected open(STDIN, "<&OLDSTDIN"); close(OLDSTDIN); # Try using XML:Simple object as a SAX handler my $simple = XML::Simple->new(); my $parser = XML::SAX::ParserFactory->parser(Handler => $simple); $opt = $parser->parse_uri($XMLFile); ok(8, DataCompare($opt, $Expected)); # Got what we expected # Try again but make sure options from the constructor are being used $simple = XML::Simple->new( keyattr => { server => 'osname' }, forcearray => ['address'], ); $parser = XML::SAX::ParserFactory->parser(Handler => $simple); $opt = $parser->parse_uri($XMLFile); my $Expected2 = { 'server' => { 'irix' => { 'address' => [ '10.0.0.102' ], 'osversion' => '6.5', 'name' => 'gobi' }, 'solaris' => { 'address' => [ '10.0.0.101', '10.0.1.101' ], 'osversion' => '2.6', 'name' => 'sahara' }, 'linux' => { 'address' => [ '10.0.0.103', '10.0.1.103' ], 'osversion' => '2.0.34', 'name' => 'kalahari' } } }; ok(9, DataCompare($opt, $Expected2)); # Got what we expected # Try using XML::Simple to drive a SAX pipeline my $Expected3 = { 'SERVER' => { 'sahara' => { 'OSVERSION' => '2.6', 'OSNAME' => 'solaris', 'ADDRESS' => [ '10.0.0.101', '10.0.1.101' ] }, 'gobi' => { 'OSVERSION' => '6.5', 'OSNAME' => 'irix', 'ADDRESS' => '10.0.0.102' }, 'kalahari' => { 'OSVERSION' => '2.0.34', 'OSNAME' => 'linux', 'ADDRESS' => [ '10.0.0.103', '10.0.1.103' ] } } }; my $simple2 = XML::Simple->new(keyattr => [qw(NAME)]); my $filter = TagsToUpper->new(Handler => $simple2); my $opt2 = XMLout($opt, keyattr => { server => 'osname' }, Handler => $filter, ); ok(10, DataCompare($opt2, $Expected3)); # Got what we expected # Confirm that 'handler' is a synonym for 'Handler' $simple2 = XML::Simple->new(keyattr => [qw(NAME)]); $filter = TagsToUpper->new(Handler => $simple2); $opt2 = XMLout($opt, keyattr => { server => 'osname' }, handler => $filter, ); ok(11, DataCompare($opt2, $Expected3)); # Got what we expected # Confirm that DataHandler routine gets called $xml = q(<opt><anon>one</anon><anon>two</anon><anon>three</anon></opt>); $simple = XML::Simple->new( DataHandler => sub { my $xs = shift; my $data = shift; return(join(',', @$data)); } ); $parser = XML::SAX::ParserFactory->parser(Handler => $simple); my $result = $parser->parse_string($xml); ok(12, $result, 'one,two,three'); # Confirm that 'datahandler' is a synonym for 'DataHandler' $simple = XML::Simple->new( datahandler => sub { my $xs = shift; my $data = shift; return(join(',', reverse(@$data))); } ); $parser = XML::SAX::ParserFactory->parser(Handler => $simple); $result = $parser->parse_string($xml); ok(13, $result, 'three,two,one'); # Clean up and go unlink($CacheFile); unlink($XMLFile); exit(0); |
From: Grant M. <gr...@us...> - 2002-02-05 22:10:25
|
Update of /cvsroot/perl-xml/xml-simple/t/lib In directory usw-pr-cvs1:/tmp/cvs-serv2495/t/lib Log Message: Directory /cvsroot/perl-xml/xml-simple/t/lib added to the repository |
From: Ilya S. <is...@us...> - 2002-02-03 18:13:36
|
Update of /cvsroot/perl-xml/XML-SAXDriver-CSV In directory usw-pr-cvs1:/tmp/cvs-serv19912 Log Message: Import version 0.05 Status: Vendor Tag: yoyo Release Tags: start N XML-SAXDriver-CSV/Changes N XML-SAXDriver-CSV/CSV.pm N XML-SAXDriver-CSV/Data1.csv N XML-SAXDriver-CSV/Makefile.PL N XML-SAXDriver-CSV/MANIFEST N XML-SAXDriver-CSV/README N XML-SAXDriver-CSV/samples/cust_handler.pl N XML-SAXDriver-CSV/t/00basic.t No conflicts created by this import ***** Bogus filespec: - Imported sources |
From: Ilya S. <is...@us...> - 2002-02-03 18:03:26
|
Update of /cvsroot/perl-xml/XML-SAXDriver-Excel In directory usw-pr-cvs1:/tmp/cvs-serv18851 Log Message: Import version 0.05 Status: Vendor Tag: yoyo Release Tags: start N XML-SAXDriver-Excel/Changes N XML-SAXDriver-Excel/Data1.xls N XML-SAXDriver-Excel/Excel.pm N XML-SAXDriver-Excel/Makefile.PL N XML-SAXDriver-Excel/MANIFEST N XML-SAXDriver-Excel/README N XML-SAXDriver-Excel/samples/cust_handler.pl N XML-SAXDriver-Excel/samples/Test.xls N XML-SAXDriver-Excel/t/00basic.t No conflicts created by this import ***** Bogus filespec: - Imported sources |
From: Ilya S. <is...@us...> - 2002-01-29 16:57:18
|
Update of /cvsroot/perl-xml/xml-perl-org/sax In directory usw-pr-cvs1:/tmp/cvs-serv30540 Added Files: module_listing.html Log Message: PerlSAX module listing. --- NEW FILE: module_listing.html --- |