[Catalyst-commits] r6763 - in trunk/Catalyst-View-Mason/lib/Catalyst: Helper/View View

rafl at dev.catalyst.perl.org rafl at dev.catalyst.perl.org
Tue Aug 28 16:59:15 GMT 2007


Author: rafl
Date: 2007-08-28 16:59:15 +0100 (Tue, 28 Aug 2007)
New Revision: 6763

Modified:
   trunk/Catalyst-View-Mason/lib/Catalyst/Helper/View/Mason.pm
   trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm
Log:
Some code tidying.


Modified: trunk/Catalyst-View-Mason/lib/Catalyst/Helper/View/Mason.pm
===================================================================
--- trunk/Catalyst-View-Mason/lib/Catalyst/Helper/View/Mason.pm	2007-08-28 15:59:11 UTC (rev 6762)
+++ trunk/Catalyst-View-Mason/lib/Catalyst/Helper/View/Mason.pm	2007-08-28 15:59:15 UTC (rev 6763)
@@ -21,9 +21,9 @@
 =cut
 
 sub mk_compclass {
-    my ( $self, $helper ) = @_;
+    my ($self, $helper) = @_;
     my $file = $helper->{file};
-    $helper->render_file( 'compclass', $file );
+    $helper->render_file('compclass', $file);
 }
 
 =head1 SEE ALSO

Modified: trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm
===================================================================
--- trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm	2007-08-28 15:59:11 UTC (rev 6762)
+++ trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm	2007-08-28 15:59:15 UTC (rev 6763)
@@ -77,7 +77,7 @@
     my ($self, $c, $arguments) = @_;
 
     my %config = (
-        comp_root => ( $c->config->{root} . '' ),
+        comp_root => $c->config->{root}->stringify,
         data_dir  => File::Spec->tmpdir,
         use_match => 1,
         %{ $self->config },
@@ -92,8 +92,9 @@
 
     $self->template(
         HTML::Mason::Interp->new(
-            %config, allow_globals => [qw($c $base $name)],
-            out_method => \$self->{output},
+            %config,
+            allow_globals => [qw($c $base $name)],
+            out_method    => \$self->{output},
         )
     );
 
@@ -114,13 +115,12 @@
 =cut
 
 sub process {
-    my ( $self, $c ) = @_;
+    my ($self, $c) = @_;
 
     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')
-          if $c->debug;
+        $c->log->debug('No Mason component specified for rendering') if $c->debug;
         return 0;
     }
 
@@ -134,11 +134,11 @@
         return 0;
     }
 
-    unless ( $c->response->content_type ) {
+    unless ($c->response->content_type) {
         $c->response->content_type('text/html; charset=utf-8');
     }
 
-    $c->response->body( $output );
+    $c->response->body($output);
 
     return 1;
 }
@@ -150,7 +150,7 @@
 sub render {
     my ($self, $c, $component_path, $args) = @_;
 
-    unless ( $component_path =~ m[^/]o ) {
+    unless ($component_path =~ m[^/]o) {
         $component_path = '/' . $component_path;
     }
 
@@ -158,7 +158,7 @@
 
     # Set the URL base, context and name of the app as global Mason vars
     # $base, $c and $name
-    $self->template->set_global(@$_) foreach (
+    $self->template->set_global(@$_) for (
         [ '$base' => $c->req->base ],
         [ '$c'    => $c ],
         [ '$name' => $c->config->{name} ]




More information about the Catalyst-commits mailing list