[Catalyst-commits] r6822 -
trunk/Catalyst-Engine-Wx/lib/Catalyst/View
eriam at dev.catalyst.perl.org
eriam at dev.catalyst.perl.org
Wed Aug 29 19:53:23 GMT 2007
Author: eriam
Date: 2007-08-29 19:53:22 +0100 (Wed, 29 Aug 2007)
New Revision: 6822
Modified:
trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm
Log:
View can now direct to a method
Modified: trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm 2007-08-28 16:04:52 UTC (rev 6821)
+++ trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm 2007-08-29 18:53:22 UTC (rev 6822)
@@ -41,7 +41,22 @@
if ($c->stash->{'_displayed'} != 1) {
- my $module = $c->stash->{class} || $c->action;
+ my $module;
+ my $method = 'new';
+
+ $module = $c->stash->{class} || $c->action;
+
+ if (ref($module) eq 'ARRAY') {
+ my $tmpmodule = shift(@{$module});
+ $method = shift(@{$module});
+ $module = $tmpmodule;
+ }
+ elsif ($module =~ /->/) {
+ ($module, $method) = split (/->/, $module);
+ }
+
+ print "View is processing: $module -> $method \n";
+#exit;
$module =~ s/\//::/g;
if (defined $self->config->{NAMESPACE}) {
@@ -56,7 +71,7 @@
require Class::Inspector->filename($module);
}
- if (my $code = $module->can('new')) {
+ if (my $code = $module->can($method)) {
eval { $code->($module, @_); };
print $@ if $@;
}
More information about the Catalyst-commits
mailing list