Skip Menu |

This queue is for tickets about the Catalyst-View-XSLT CPAN distribution.

Report information
The Basics
Id: 86108
Status: new
Priority: 0/
Queue: Catalyst-View-XSLT

People
Owner: Nobody in particular
Requestors: jozef [...] kutej.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.09
Fixed in: (no value)



Subject: template as XML::LibXML::Document object [patch]
Dear Simon, attached is similar patch to the last one, but now concerning xslt template. This patch allows template to be directly XML::LibXML::Document. There is also one typo correction in lib/Catalyst/View/XSLT.pm Thank you very much! Best regards Jozef
Subject: template-as-document.patch
diff --git a/Changes b/Changes index 864aefb..8de538c 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,7 @@ +0.10 Thu Jun 13 12:18:23 CET 2013 + - prevent stringified template object errors with + a patch from Jozef Kutej + 0.09 Thu Feb 7 20:44:55 CET 2013 - prevent stringified document object errors (RT#80428) with a patch from Jozef Kutej diff --git a/lib/Catalyst/View/XSLT.pm b/lib/Catalyst/View/XSLT.pm index b905730..2f43896 100644 --- a/lib/Catalyst/View/XSLT.pm +++ b/lib/Catalyst/View/XSLT.pm @@ -7,7 +7,7 @@ use Catalyst::View::XSLT::XML::LibXSLT; use Data::Dumper; use File::Spec; -our $VERSION = '0.09'; +our $VERSION = '0.10'; # check if this is a MS Windows my $isMS = $^O eq 'MSWin32'; @@ -256,7 +256,7 @@ sub render { # if xml is not string (therefore is a file (what about file descriptors ?!)) # and is not existsting in the file system - unless ( $xml =~ m/\</ || (ref($template) && $xml->isa('GLOB')) || -e $xml || + unless ( $xml =~ m/\</ || (ref($xml) && $xml->isa('GLOB')) || -e $xml || ( ref($xml) && !$xml->isa('Path::Class::File') ) ) { my ($incPath, $error) = $self->_searchInIncPath($c, $xml); diff --git a/lib/Catalyst/View/XSLT/XML/LibXSLT.pm b/lib/Catalyst/View/XSLT/XML/LibXSLT.pm index c0c59a0..3976e20 100644 --- a/lib/Catalyst/View/XSLT/XML/LibXSLT.pm +++ b/lib/Catalyst/View/XSLT/XML/LibXSLT.pm @@ -3,7 +3,7 @@ package Catalyst::View::XSLT::XML::LibXSLT; use strict; use warnings; -our $VERSION = '0.09'; +our $VERSION = '0.10'; =head1 NAME @@ -94,12 +94,12 @@ sub process { $xmlDocument = $xmlParser->parse_file($xml); } - if ($template =~ m/\</) { - $xsltStylesheet = $xmlParser->parse_string($template, $base); + if (ref($template) && $template->isa('XML::LibXML::Document')) { + $xsltStylesheet = $template; } elsif (ref($template) && $template->isa('GLOB')) { $xsltStylesheet = $xmlParser->parse_fh($template, $base); - } elsif (ref($template) && $template->isa('XML::LibXML::Document')) { - $xsltStylesheet = $template; + } elsif ($template =~ m/\</) { + $xsltStylesheet = $xmlParser->parse_string($template, $base); } else { $xsltStylesheet = $xmlParser->parse_file($template); }
Dear Simon, can you please have a look at this patch and release a new version if possible? Thank you. Best regards Jozef On Thu Jun 13 06:36:14 2013, JKUTEJ wrote: Show quoted text
> Dear Simon, > > attached is similar patch to the last one, but now concerning xslt > template. This patch allows template to be directly > XML::LibXML::Document. > > There is also one typo correction in lib/Catalyst/View/XSLT.pm > > Thank you very much! > > Best regards > Jozef