[Catalyst-commits] r8902 - in trunk/Catalyst-Engine-Wx: demo/lib/SampleAppWx lib/Catalyst/View

eriam at dev.catalyst.perl.org eriam at dev.catalyst.perl.org
Wed Dec 17 18:45:17 GMT 2008


Author: eriam
Date: 2008-12-17 18:45:17 +0000 (Wed, 17 Dec 2008)
New Revision: 8902

Removed:
   trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/display.pm
Modified:
   trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/default.pm
   trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm
Log:
Process work more like expected.

Modified: trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/default.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/default.pm	2008-12-17 18:20:19 UTC (rev 8901)
+++ trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/default.pm	2008-12-17 18:45:17 UTC (rev 8902)
@@ -14,7 +14,7 @@
 use base 'Wx::Frame';
 
 sub new {
-   my ($class, $catalyst, $c ) = @_;
+   my ($class, $c ) = @_;
 
    my $self = $class->SUPER::new( undef, -1, 'Books', [0, 0], [475,300] );
 
@@ -58,7 +58,7 @@
 
 
 sub display {
-   my ($self, $catalyst, $c ) = @_;
+   my ($self, $c ) = @_;
 
    print " method display of $self !! \n";
 

Deleted: trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/display.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/display.pm	2008-12-17 18:20:19 UTC (rev 8901)
+++ trunk/Catalyst-Engine-Wx/demo/lib/SampleAppWx/display.pm	2008-12-17 18:45:17 UTC (rev 8902)
@@ -1,17 +0,0 @@
-package # Hide from pause
-   SampleAppWx::display;
-
-use strict;
-use warnings;
-
-#use Wx ':everything';
-
-sub new {
-   my ($class, $catalyst, $c ) = @_;
-
-   Wx::MessageBox('Hello world', 'Hello' );
-}
-
-
-
-1;

Modified: trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm	2008-12-17 18:20:19 UTC (rev 8901)
+++ trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm	2008-12-17 18:45:17 UTC (rev 8902)
@@ -36,90 +36,85 @@
 
 sub process {
    my ($self, $c) = @_;
+
+   my $module  = $c->stash->{class}
+                  || $c->request->uri
+                  || $c->action;
+   my $method  = 'new';
+   my $code;
+
+   $module =~ s/\//::/g if $module =~ /\//;
+
+   if (!$c->stash->{'_parent'}) {
       
-   $c->stash->{'_displayed'} ||= 0;
+      if (ref($module) eq 'ARRAY') {
+         my $tmpmodule = shift(@{$module});
+         $method = shift(@{$module});
+         $module = $tmpmodule;
+      }
+      elsif ($module =~ /->/) {
+         ($module, $method) = split (/->/, $module);
+      }
+      elsif ($module =~ /::/) {
+         my (@module_name) = split (/::/, $module);
+      }
    
-   if ($c->stash->{'_displayed'} != 1) {
+      if (defined $self->config->{NAMESPACE}) {
+         $module = $self->config->{NAMESPACE}.'::'.$module;
+      }
       
-      my $module  = $c->stash->{class}
-                     || $c->stash->{template}
-                     || $c->action;
-      my $method  = 'new';
-      my $code;
+      if ($self->config->{DEBUG}) {
+         Module::Reload->check;
+      }
       
-      $module =~ s/\//::/g if $module =~ /\//;
-         
-      if ($c->stash->{class}) {
-         
-         if (ref($module) eq 'ARRAY') {
-            my $tmpmodule = shift(@{$module});
-            $method = shift(@{$module});
-            $module = $tmpmodule;
-         }
-         elsif ($module =~ /->/) {
-            ($module, $method) = split (/->/, $module);
-         }
-         elsif ($module =~ /::/) {
-            my (@module_name) = split (/::/, $module);
-         }
-      
-         if (defined $self->config->{NAMESPACE}) {
-            $module = $self->config->{NAMESPACE}.'::'.$module;
-         }
-         
-         if ($self->config->{DEBUG}) {
-            Module::Reload->check;
-         }
-         
-         unless (Class::Inspector->loaded($module)) {
-            require Class::Inspector->filename($module);
-         }
+      unless (Class::Inspector->loaded($module)) {
+         require Class::Inspector->filename($module);
+      }
 
-         if ($code = $module->can($method)) {
-            eval { $code->($module, @_); };
-            $c->log->debug($@) if $@;
-            print $@ if $@;
-         }
-         else {
-            $c->log->debug($module." does not implement ".$method);
-         }      
-        
+      if ($code = $module->can($method)) {
+         eval { $code->($module, $c); };
+         $c->log->debug($@) if $@;
+         print $@ if $@;
+         
       }
-      elsif ($c->stash->{'_parent'}) {
+      else {
+         $c->log->debug($module." does not implement ".$method);
+      }      
+     
+   }
+   elsif ($c->stash->{'_parent'}) {
+   
+      if (ref($module) eq 'ARRAY') {
+         my $tmpmodule = shift(@{$module});
+         $method = shift(@{$module});
+         $module = $tmpmodule;
+      }
+      elsif ($module =~ /->/) {
+         ($module, $method) = split (/->/, $module);
+      }
+      elsif ($module =~ /::/) {
+         my (@module_name) = split (/::/, $module);
+         $method = pop @module_name;
+         $module = join ('::', @module_name);
+      }
       
-         if (ref($module) eq 'ARRAY') {
-            my $tmpmodule = shift(@{$module});
-            $method = shift(@{$module});
-            $module = $tmpmodule;
-         }
-         elsif ($module =~ /->/) {
-            ($module, $method) = split (/->/, $module);
-         }
-         elsif ($module =~ /::/) {
-            my (@module_name) = split (/::/, $module);
-            $method = pop @module_name;
-            $module = join ('::', @module_name);
-         }
-         
-         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');
-         }      
-      
+      if ($code = $c->stash->{'_parent'}->can($module)) {
+         eval { $code->($c->stash->{'_parent'}, $c); };
+         $c->log->debug($@) if $@;
+         print $@ if $@;
       }
-
-      $c->stash->{'_displayed'} = 1;
+      elsif ($code = $c->stash->{'_parent'}->can($method)) {
+         eval { $code->($c->stash->{'_parent'}, $c); };
+         $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');
+      }      
+   
    }
+
    return; 
 }
 




More information about the Catalyst-commits mailing list