[Catalyst-commits] r6755 - trunk/Catalyst-View-Mason/lib/Catalyst/View

rafl at dev.catalyst.perl.org rafl at dev.catalyst.perl.org
Tue Aug 28 16:58:42 GMT 2007


Author: rafl
Date: 2007-08-28 16:58:42 +0100 (Tue, 28 Aug 2007)
New Revision: 6755

Modified:
   trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm
Log:
Add a new config option 'use_match' to control if we use $c->req->match or
$c->action to find out what template to use if none was given.


Modified: trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm
===================================================================
--- trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm	2007-08-28 15:58:38 UTC (rev 6754)
+++ trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm	2007-08-28 15:58:42 UTC (rev 6755)
@@ -78,12 +78,17 @@
     my %config = (
         comp_root =>  ( $c->config->{root} . '' ),
         data_dir  => '/tmp',
+        use_match => 1,
+        %{ $self->config },
         %{ $arguments },
     );
 
     $self = $self->NEXT::new($c, { %config });
     $self->{output} = '';
 
+    $self->config({ %config });
+    delete $config{use_match};
+
     $self->template(
         HTML::Mason::Interp->new(
             %config, allow_globals => [qw($c $base $name)],
@@ -110,7 +115,7 @@
 sub process {
     my ( $self, $c ) = @_;
 
-    my $component_path = $c->stash->{template} || $c->req->match;
+    my $component_path = $c->stash->{template} || ($self->config->{use_match} ? $c->request->match : $c->action);
 
     unless ($component_path) {
         $c->log->debug('No Mason component specified for rendering')




More information about the Catalyst-commits mailing list