/[Frey]/trunk/lib/Frey/Mojo.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

Diff of /trunk/lib/Frey/Mojo.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 636 by dpavlin, Sun Nov 30 14:42:43 2008 UTC revision 803 by dpavlin, Wed Dec 10 22:44:52 2008 UTC
# Line 7  use base 'Mojo'; Line 7  use base 'Mojo';
7    
8  use MojoX::Dispatcher::Static;  use MojoX::Dispatcher::Static;
9    
10    use lib 'lib';
11  use Frey::Server;  use Frey::Server;
12    
13  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
# Line 32  sub new { Line 33  sub new {
33      return $self;      return $self;
34  }  }
35    
36    
37  sub handler {  sub handler {
38          my ($self, $tx) = @_;          my ($self, $tx) = @_;
39    
40            # XXX fake app so static dispatcher won't die on us
41            {
42                    package Fake::App;
43                    use base 'Mojo::Transaction';
44                    sub app {
45                            my $self = shift;
46                            warn "## $self app ", @_;
47                            $self;
48                    }
49                    sub log {
50                            my $self = shift;
51                            warn "## $self log ",@_;
52                            return $self;
53                    }
54                    sub debug {
55                            my $self = shift;
56                            warn "## $self debug ",@_;
57                            return $self;
58                    }
59            }
60            bless $tx, 'Fake::App';
61    
62          if ( $self->static->dispatch($tx) ) {          if ( $self->static->dispatch($tx) ) {
63  #               warn "# static ",dump( $tx );  #               warn "# static ",dump( $tx );
64                  return $tx;                  return $tx;
# Line 52  sub handler { Line 76  sub handler {
76    
77          warn "# url $url params ",dump($params);          warn "# url $url params ",dump($params);
78    
79          $server->request( $url, $params ); # fetch body          my $content_type = $server->request( $url, $params ); # fetch body
80    
81  =for developer  =for developer
82    
# Line 67  sub handler { Line 91  sub handler {
91  =cut  =cut
92    
93          $tx->res->code(200);          $tx->res->code(200);
94          $tx->res->headers->content_type('text/html');          $tx->res->headers->content_type( $content_type );
95          $tx->res->body( $body );          $tx->res->body( $body );
96    
97          warn dump( $tx->res->headers );          warn dump( $tx->res->headers );

Legend:
Removed from v.636  
changed lines
  Added in v.803

  ViewVC Help
Powered by ViewVC 1.1.26