[Catalyst-commits] r7630 -
trunk/Catalyst-Engine-Wx/lib/Catalyst/View
eriam at dev.catalyst.perl.org
eriam at dev.catalyst.perl.org
Thu Apr 24 20:05:33 BST 2008
Author: eriam
Date: 2008-04-24 20:05:32 +0100 (Thu, 24 Apr 2008)
New Revision: 7630
Modified:
trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm
Log:
change the way view works
Modified: trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm 2008-04-23 16:23:21 UTC (rev 7629)
+++ trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm 2008-04-24 19:05:32 UTC (rev 7630)
@@ -41,41 +41,92 @@
if ($c->stash->{'_displayed'} != 1) {
- my $module;
- my $method = 'new';
-
- $module = $c->stash->{class} || $c->action;
+ my $module = $c->stash->{class} || $c->action;
+ my $method = 'new';
+ my $code;
+ $module =~ s/\//::/g if $module =~ /\//;
+
if (ref($module) eq 'ARRAY') {
my $tmpmodule = shift(@{$module});
$method = shift(@{$module});
- $module = $tmpmodule;
+ $module = $tmpmodule;
}
elsif ($module =~ /->/) {
- ($module, $method) = split (/->/, $module);
+ ($module, $method) = split (/->/, $module);
}
+ elsif ($module =~ /::/) {
+ my (@module_name) = split (/::/, $module);
+ $method = pop @module_name;
+ $module = join ('::', @module_name);
+ }
- $c->log->info("View is processing: $module -> $method");
+ if ($c->stash->{'_parent'}) {
+
+ $c->log->info(" _parent ".$c->stash->{'_parent'} );
- $module =~ s/\//::/g;
+ print "trying to run method $module of parent \n";
+
+ 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 (defined $self->config->{NAMESPACE}) {
- $module = $self->config->{NAMESPACE}.'::'.$module;
}
+ else {
+
+
+
+ print ("View is processing: $module -> $method \n");
+ $c->log->info("View is processing: $module -> $method");
+
- if ($self->config->{DEBUG}) {
- Module::Reload->check;
+ 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);
+ }
+
+ if ($code = $module->can($method)) {
+ eval { $code->($module, @_); };
+ $c->log->debug($@) if $@;
+ print $@ if $@;
+ }
+ else {
+ $c->log->debug($module." does not implement ".$method);
+ }
+
}
- unless (Class::Inspector->loaded($module)) {
- require Class::Inspector->filename($module);
- }
- if (my $code = $module->can($method)) {
- eval { $code->($module, @_); };
- $c->log->debug($@) if $@;
- }
-
+#
+# 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