/[Frey]/trunk/lib/Frey/Mojo/Run.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/Frey/Mojo/Run.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 272 - (show annotations)
Wed Nov 5 08:20:46 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 1060 byte(s)
 r3092@llin (orig r238):  dpavlin | 2008-11-01 17:44:32 +0100
 somewhat working class browser

1 package Frey::Mojo::Run;
2
3 use strict;
4 use warnings;
5
6 use base 'Mojolicious::Controller';
7
8 use Data::Dump qw/dump/;
9 use Carp qw/confess/;
10
11 use Frey::ClassLoader;
12
13 warn "# ",dump( Frey::ClassLoader->new->load_all_classes() );
14
15
16 sub markup {
17 my ($self, $c) = @_;
18
19 warn "# ", dump( $c->match->captures );
20
21 my $params = $c->request->params->to_hash;
22 warn "# params ", dump( $params );
23
24 my $class = $c->match->captures->{class} || 'Frey::ClassBrowser';
25 $class =~ s{[/-]}{::}g;
26
27 my $o = $class->new( %$params );
28 $o->depends if $o->can('depends');
29
30 my $html;
31 if ( $o->can('markup') ) {
32 $html = eval { $o->markup };
33 if ( $@ ) {
34 warn $@;
35 $html .= qq{<code>$@</code>};
36 }
37 } else {
38 warn "SKIP: $class can't markup";
39 }
40
41 eval {
42 # FIXME am I paranoid?
43 package Mock::Web;
44 use Moose;
45 extends 'Frey';
46 with 'Frey::Web';
47
48 $html = Mock::Web->new->page(
49 title => $class,
50 body => $html,
51 );
52 };
53
54 # Response objec
55 my $res = $c->res;
56 $res->code(200);
57 $res->headers->content_type('text/html');
58 $res->body( $html );
59 }
60
61 1;

  ViewVC Help
Powered by ViewVC 1.1.26