From: Mark Addison Date: Tue, 21 Oct 2003 14:53:08 +0000 (+0000) Subject: When using attrib_values the attribs are now written in alphabetical order X-Git-Tag: v0.04~36 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=446dfcbd3a58ad65602cd45c25155bc91d7e25a4;p=dbsrgits%2FSQL-Translator.git When using attrib_values the attribs are now written in alphabetical order rather than hash order. Should ensure the test passes for different versions of perl. --- diff --git a/lib/SQL/Translator/Producer/XML/SQLFairy.pm b/lib/SQL/Translator/Producer/XML/SQLFairy.pm index 2f98873..de96e08 100644 --- a/lib/SQL/Translator/Producer/XML/SQLFairy.pm +++ b/lib/SQL/Translator/Producer/XML/SQLFairy.pm @@ -1,7 +1,7 @@ package SQL::Translator::Producer::XML::SQLFairy; # ------------------------------------------------------------------- -# $Id: SQLFairy.pm,v 1.7 2003-10-20 13:15:23 grommit Exp $ +# $Id: SQLFairy.pm,v 1.8 2003-10-21 14:53:08 grommit Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # darren chamberlain , @@ -78,7 +78,7 @@ Creates XML output of a schema. use strict; use vars qw[ $VERSION @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.8 $ =~ /(\d+)\.(\d+)/; use Exporter; use base qw(Exporter); @@ -227,8 +227,11 @@ sub xml_obj { ($_ => ref($val) eq 'ARRAY' ? join(', ', @$val) : $val); } @meths; foreach ( keys %attr ) { delete $attr{$_} unless defined $attr{$_}; } - $empty_tag ? $xml->emptyTag( [ $Namespace => $tag ], %attr ) - : $xml->startTag( [ $Namespace => $tag ], %attr ); + # Convert to array to ensure consistant (ie not hash) ordering of + # attribs + my @attr = map { ($_ => $attr{$_}) } sort keys %attr; + $empty_tag ? $xml->emptyTag( [ $Namespace => $tag ], @attr ) + : $xml->startTag( [ $Namespace => $tag ], @attr ); } else { $xml->startTag( [ $Namespace => $tag ] ); diff --git a/t/17sqlfxml-producer.t b/t/17sqlfxml-producer.t index 27b824d..21722a7 100644 --- a/t/17sqlfxml-producer.t +++ b/t/17sqlfxml-producer.t @@ -284,19 +284,19 @@ my ($obj,$ans,$xml); $ans = < - + - - - - + + + + - + - - + +