[Catalyst-commits] r6357 - in trunk/Catalyst-Engine-Wx: .
lib/Catalyst/View
eriam at dev.catalyst.perl.org
eriam at dev.catalyst.perl.org
Wed May 2 15:57:05 GMT 2007
Author: eriam
Date: 2007-05-02 15:57:04 +0100 (Wed, 02 May 2007)
New Revision: 6357
Modified:
trunk/Catalyst-Engine-Wx/Makefile.PL
trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm
Log:
Added Class::Inspector to replace eval and use can to replace eval.
Modified: trunk/Catalyst-Engine-Wx/Makefile.PL
===================================================================
--- trunk/Catalyst-Engine-Wx/Makefile.PL 2007-05-02 13:06:31 UTC (rev 6356)
+++ trunk/Catalyst-Engine-Wx/Makefile.PL 2007-05-02 14:57:04 UTC (rev 6357)
@@ -8,15 +8,16 @@
abstract_from 'lib/Catalyst/Engine/Wx.pm';
# Build the prerequisite list
-requires 'HTTP::Date' => 0;
-requires 'Carp' => 0;
-requires 'Sys::Hostname' => 0;
-requires 'POE' => '0.38';
-requires 'Storable' => 0;
-requires 'Socket' => 0;
-requires 'HTTP::Request' => 0;
-requires 'HTTP::Response' => 0;
-requires 'Wx' => 0;
+requires 'HTTP::Date' => 0;
+requires 'Carp' => 0;
+requires 'Sys::Hostname' => 0;
+requires 'POE' => '0.38';
+requires 'Storable' => 0;
+requires 'Socket' => 0;
+requires 'HTTP::Request' => 0;
+requires 'HTTP::Response' => 0;
+requires 'Wx' => 0;
+requires 'Class::Inspector' => 0;
WriteAll();
Modified: trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm
===================================================================
--- trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm 2007-05-02 13:06:31 UTC (rev 6356)
+++ trunk/Catalyst-Engine-Wx/lib/Catalyst/View/Wx.pm 2007-05-02 14:57:04 UTC (rev 6357)
@@ -1,14 +1,16 @@
package Catalyst::View::Wx;
+use warnings;
use strict;
use base qw/Catalyst::View/;
+
use NEXT;
+use Class::Inspector;
+use Data::Dumper;
our $VERSION = '0.1';
-
-use Data::Dumper;
=head1 NAME
Catalyst::View::Wx - Wx View Class
@@ -22,7 +24,7 @@
my $config = {
%{ $class->config },
- %{$arguments},
+ %{ $arguments },
};
$self->config($config);
@@ -36,13 +38,16 @@
my $module = $c->action;
$module =~ s/\//::/g;
- eval "use ".$self->config->{NAMESPACE}."::".$module.";";
+ if (defined $self->config->{NAMESPACE}) {
+ $module = $self->config->{NAMESPACE}.'::'.$module;
+ }
- my $view;
- eval '$view = '.$self->config->{NAMESPACE}."::".$module."->new();";
+ unless (Class::Inspector->loaded($module)) {
+ require Class::Inspector->filename($module);
+ }
- if (defined $view) {
- $view->display($c);
+ if (my $code = $module->can('new') ) {
+ $code->(@_);
}
$c->stash->{_displayed} = 1;
More information about the Catalyst-commits
mailing list