XML-Pastor 1.0.3
Perl 5.12.4 on linux 2.6.32-279.1.1.el6.x86_64 (Centos 6.2).
When using xml_validate() or is_xml_valid() methods against various
schemas and both valid and invalid test xml docs, I consistently receive
the following error:
Can't call method "whiteSpace" on an undefined value at
/usr/local/perl/lib/site_perl/5.12.4/XML/Pastor/SimpleType.pm line 179.
Adding a defined check on $type on line SimpleType.pm line 179 partially
fixes the problem, but occasionally leads to the following error:
Can't locate object method "xml_validate_further" via package
"XML::Pastor::Type" at
/usr/local/perl/lib/site_perl/5.12.4/XML/Pastor/Type.pm line 374.
The xml_validate_further sub in Type.pm is misspelled xml_validate_futher.
A workaround is:
--- SimpleType-1.0.3.pm 2008-08-02 03:59:26.000000000 -0500
+++ SimpleType.pm 2012-08-14 09:39:26.728389453 -0500
@@ -176,7 +176,7 @@
my $value = shift;
my $type = $self->XmlSchemaType();
- if (defined(my $prop = $type->whiteSpace)) {
+ if (defined $type and defined(my $prop = $type->whiteSpace)) {
$prop = (reftype($prop) eq 'ARRAY') ? $prop : [$prop];
foreach my $ws (@$prop) {
if ($ws =~ /^replace$/i) {
--- Type-1.0.3.pm 2008-08-02 03:42:57.000000000 -0500
+++ Type.pm 2012-08-14 09:37:44.852404159 -0500
@@ -377,7 +377,7 @@
}
#----------------------------------------------
-sub xml_validate_futher {
+sub xml_validate_further {
return 1; # to be overriden!
}
Subject: | validate.patch |
--- SimpleType-1.0.3.pm 2008-08-02 03:59:26.000000000 -0500
+++ SimpleType.pm 2012-08-14 09:39:26.728389453 -0500
@@ -176,7 +176,7 @@
my $value = shift;
my $type = $self->XmlSchemaType();
- if (defined(my $prop = $type->whiteSpace)) {
+ if (defined $type and defined(my $prop = $type->whiteSpace)) {
$prop = (reftype($prop) eq 'ARRAY') ? $prop : [$prop];
foreach my $ws (@$prop) {
if ($ws =~ /^replace$/i) {
--- Type-1.0.3.pm 2008-08-02 03:42:57.000000000 -0500
+++ Type.pm 2012-08-14 09:37:44.852404159 -0500
@@ -377,7 +377,7 @@
}
#----------------------------------------------
-sub xml_validate_futher {
+sub xml_validate_further {
return 1; # to be overriden!
}