Subject: | XML::Pastor::Type xml_validate passes @_ after shifting away all values |
Date: | Mon, 5 Dec 2016 20:23:34 +0000 |
To: | "bug-XML-Pastor [...] rt.cpan.org" <bug-XML-Pastor [...] rt.cpan.org> |
From: | Mark Solinski <mark.solinski [...] gpsinsight.com> |
Most error messages returned from inside xml_validate cannot identify the correct $path (always empty) because of the last lines of the subroutine:
return ( $self->xml_validate_value(@_) &&
$self->xml_validate_further(@_) &&
$self->xml_validate_ancestors(@_));
are called after the $path is shifted off of @_. If the @_ is replaced with $path like this:
return ( $self->xml_validate_value($path) &&
$self->xml_validate_further($path) &&
$self->xml_validate_ancestors($path));
Then the correct behavior is observed.
For example, in a nested XML schema, I was receiving an error message like this:
Pastor : Validate : : Length must be maximum '4' for value 'ABCDE' at C:/Strawberry/perl/site/lib/XML/Pastor/SimpleType.pm line 52.
After making the change, I am now receiving the expected error message:
Pastor : Validate : RemoteObdCollection/Payloads/Payload/VendorID : Length must be maximum '4' for value 'ABCDE' at C:/Strawberry/perl/site/lib/XML/Pastor/SimpleType.pm line 52.