[Catalyst-commits] r7944 - trunk/Catalyst-Engine-Wx/lib/Catalyst/View

eriam at dev.catalyst.perl.org eriam at dev.catalyst.perl.org
Mon Jun 23 20:56:50 BST 2008


Author: eriam
Date: 2008-06-23 20:56:50 +0100 (Mon, 23 Jun 2008)
New Revision: 7944

Modified:
   trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm
Log:
Views now can be method calls or constructor calls depending on the context

Modified: trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm	2008-06-23 19:53:28 UTC (rev 7943)
+++ trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm	2008-06-23 19:56:50 UTC (rev 7944)
@@ -11,7 +11,7 @@
 use Module::Reload; 
 use Data::Dumper;
 
-our $VERSION = "0.02_05";
+our $VERSION = "0.02_06";
 
 =head1 NAME
 
@@ -41,7 +41,9 @@
    
    if ($c->stash->{'_displayed'} != 1) {
       
-      my $module  = $c->stash->{class} || $c->action;
+      my $module  = $c->stash->{class}
+                     || $c->stash->{template}
+                     || $c->action;
       my $method  = 'new';
       my $code;
       
@@ -60,37 +62,9 @@
          $method = pop @module_name;
          $module = join ('::', @module_name);
       }
-
-      if ($c->stash->{'_parent'}) {
       
-         $c->log->info(" _parent ".$c->stash->{'_parent'} );
-
-         print "trying to run method $module of parent \n";
+      if ($c->stash->{class}) {
          
-         if ($code = $c->stash->{'_parent'}->can($module)) {
-            eval { $code->($c->stash->{'_parent'}, @_); };
-            $c->log->debug($@) if $@;
-            print $@ if $@;
-         }
-         elsif ($code = $c->stash->{'_parent'}->can($method)) {
-            eval { $code->($c->stash->{'_parent'}, @_); };
-            $c->log->debug($@) if $@;
-            print $@ if $@;
-         }
-         else {
-            $c->log->debug(ref($c->stash->{'_parent'})." does not implement ".$module);
-            Wx::MessageBox("The package ".ref($c->stash->{'_parent'})." does not \nimplement the method '".$module."' !", 'Error');
-         }      
-      
-      }
-      else {
-         
-
-   
-         print ("View is processing: $module -> $method \n");
-         $c->log->info("View is processing: $module -> $method");
-   
-      
          if (defined $self->config->{NAMESPACE}) {
             $module = $self->config->{NAMESPACE}.'::'.$module;
          }
@@ -113,20 +87,25 @@
          }      
         
       }
+      elsif ($c->stash->{'_parent'}) {
       
+         if ($code = $c->stash->{'_parent'}->can($module)) {
+            eval { $code->($c->stash->{'_parent'}, @_); };
+            $c->log->debug($@) if $@;
+            print $@ if $@;
+         }
+         elsif ($code = $c->stash->{'_parent'}->can($method)) {
+            eval { $code->($c->stash->{'_parent'}, @_); };
+            $c->log->debug($@) if $@;
+            print $@ if $@;
+         }
+         else {
+            $c->log->debug(ref($c->stash->{'_parent'})." does not implement ".$module);
+            Wx::MessageBox("The package ".ref($c->stash->{'_parent'})." does not \nimplement the method '".$module."' !", 'Error');
+         }      
       
-#
-#      use Data::Dumper;
-#      #print Dumper($c->stash);
-#
-##      $c->log->info( Class::Inspector->filename($module) );
-#      $c->log->info($module." does not implement ".$method);
-#      #print($module." does not implement ".$method);
-#
-#            print "parent ".$c->stash->{'_parent'}." \n";
-#            print "ref parent ".ref($c->stash->{'_parent'})."\n";
+      }
 
-      
       $c->stash->{'_displayed'} = 1;
    }
    return; 




More information about the Catalyst-commits mailing list