--- trunk/lib/Frey/Mojo/Run.pm 2008/11/05 08:20:45 271 +++ trunk/lib/Frey/Mojo/Run.pm 2008/11/05 08:20:46 272 @@ -8,16 +8,16 @@ use Data::Dump qw/dump/; use Carp qw/confess/; +use Frey::ClassLoader; + +warn "# ",dump( Frey::ClassLoader->new->load_all_classes() ); + + sub markup { my ($self, $c) = @_; warn "# ", dump( $c->match->captures ); - # Response object - my $res = $c->res; - $res->code(200); - $res->headers->content_type('text/html'); - my $params = $c->request->params->to_hash; warn "# params ", dump( $params ); @@ -27,7 +27,35 @@ my $o = $class->new( %$params ); $o->depends if $o->can('depends'); - $res->body( $o->markup ); + my $html; + if ( $o->can('markup') ) { + $html = eval { $o->markup }; + if ( $@ ) { + warn $@; + $html .= qq{$@}; + } + } else { + warn "SKIP: $class can't markup"; + } + + eval { + # FIXME am I paranoid? + package Mock::Web; + use Moose; + extends 'Frey'; + with 'Frey::Web'; + + $html = Mock::Web->new->page( + title => $class, + body => $html, + ); + }; + + # Response objec + my $res = $c->res; + $res->code(200); + $res->headers->content_type('text/html'); + $res->body( $html ); } 1;