[Catalyst-commits] r8637 - trunk/Catalyst-View-XSLT/lib/Catalyst/View

janus at dev.catalyst.perl.org janus at dev.catalyst.perl.org
Sun Nov 23 21:22:45 GMT 2008


Author: janus
Date: 2008-11-23 21:22:45 +0000 (Sun, 23 Nov 2008)
New Revision: 8637

Modified:
   trunk/Catalyst-View-XSLT/lib/Catalyst/View/XSLT.pm
Log:
don't error out on windows as it just works as it should

Modified: trunk/Catalyst-View-XSLT/lib/Catalyst/View/XSLT.pm
===================================================================
--- trunk/Catalyst-View-XSLT/lib/Catalyst/View/XSLT.pm	2008-11-23 21:13:59 UTC (rev 8636)
+++ trunk/Catalyst-View-XSLT/lib/Catalyst/View/XSLT.pm	2008-11-23 21:22:45 UTC (rev 8637)
@@ -219,8 +219,6 @@
 sub render {
     my ( $self, $c, $template, $args ) = @_;
 
-    my $output;
-
     unless ( -e $template) {
         my ($tmplFullPath, $error) = $self->_searchInIncPath($c, $template);
 		
@@ -258,56 +256,45 @@
 
     $c->log->debug( qq{Rendering template "$template"} ) if $c->debug;
 
-    if ($isMS) {
-        my $error = 'XSLT View for MS Windows is not yet implemented.';
-        $c->log->error($error);
-        $c->error($error);
+    # add runtime register_function(s) from stash
+    if (exists $vars->{additional_register_function} &&
+      ref($vars->{additional_register_function}) eq 'ARRAY' ) {
+        my @additional_subrefs = @{ $vars->{additional_register_function} };
+        delete $vars->{additional_register_function};
 
-        return undef;
-    }
-    # elsif ($^O eq 'linux') {
-    else {
-
-        # add runtime register_function(s) from stash
-        if (exists $vars->{additional_register_function} &&
-          ref($vars->{additional_register_function}) eq 'ARRAY' ) {
-            my @additional_subrefs = @{ $vars->{additional_register_function} };
-            delete $vars->{additional_register_function};
-
-            unless (ref($self->{CONFIG}->{LibXSLT}->{register_function}) eq 'ARRAY') {
-                $self->{CONFIG}->{LibXSLT}->{register_function} = [];
-            }
-			
-            unshift(
-              @{ $self->{CONFIG}->{LibXSLT}->{register_function} }, 
-              @additional_subrefs
-            );
+        unless (ref($self->{CONFIG}->{LibXSLT}->{register_function}) eq 'ARRAY') {
+            $self->{CONFIG}->{LibXSLT}->{register_function} = [];
         }
 
-        my $processor = undef;
-        eval {
-            $processor = $self->_getProcessor()->new($c, $self->{CONFIG}->{LibXSLT});		
-        };
+        unshift(
+          @{ $self->{CONFIG}->{LibXSLT}->{register_function} }, 
+          @additional_subrefs
+        );
+    }
 
-        if ($@ && (! defined $processor)) {
-            $c->error("Could not instanciate XSLT processor: $@");
-            return undef;
-        } elsif (scalar @{$c->error}) {
-            return undef;
-        }
+    my $processor = undef;
+    eval {
+        $processor = $self->_getProcessor()->new($c, $self->{CONFIG}->{LibXSLT});		
+    };
 
-        $c->log->debug("Processing...") if $c->debug;
-        my ($output, $error) = $processor->process($template, $vars);
+    if ($@ && (! defined $processor)) {
+        $c->error("Could not instanciate XSLT processor: $@");
+        return undef;
+    } elsif (scalar @{$c->error}) {
+        return undef;
+    }
 
-        if ($error) {
-            chomp $error;
-            $error = qq{Couldn't render template "$template". Error: "$error"};
-            $c->error($error);
-            return undef;
-        } 
-        else {
-            return $output;
-        }
+    $c->log->debug("Processing...") if $c->debug;
+    my ($output, $error) = $processor->process($template, $vars);
+
+    if ($error) {
+        chomp $error;
+        $error = qq{Couldn't render template "$template". Error: "$error"};
+        $c->error($error);
+        return undef;
+    } 
+    else {
+        return $output;
     }
 }
 




More information about the Catalyst-commits mailing list