6 |
|
|
7 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
8 |
|
|
9 |
|
#use Carp::REPL; # 'nodie'; |
10 |
|
|
11 |
|
use lib 'lib'; |
12 |
use Frey::Run; |
use Frey::Run; |
13 |
|
|
14 |
has 'port' => ( |
has 'port' => ( |
35 |
This is simple dispatcher for our server. Currently it's in flux and |
This is simple dispatcher for our server. Currently it's in flux and |
36 |
documented only in source code. |
documented only in source code. |
37 |
|
|
38 |
|
my $content_type = $self->request( $url, $params ); |
39 |
|
|
40 |
=cut |
=cut |
41 |
|
|
42 |
sub print { |
sub print { |
55 |
} |
} |
56 |
|
|
57 |
my $path = $url->path; |
my $path = $url->path; |
58 |
|
my $content_type = 'text/plain'; |
59 |
|
|
60 |
eval { |
eval { |
|
# { |
|
61 |
|
|
62 |
if ( $path =~ m{/reload(.*)} ) { |
if ( $path =~ m{/reload(.*)} ) { |
63 |
|
|
128 |
$run->{class} ||= $class; |
$run->{class} ||= $class; |
129 |
$f = Frey::Run->new( class => 'Frey::Introspect', params => $run ); |
$f = Frey::Run->new( class => 'Frey::Introspect', params => $run ); |
130 |
} else { |
} else { |
131 |
$f = Frey::Run->new( class => 'Frey::ClassBrowser', params => $run ); |
$f = Frey::Run->new( class => 'Frey::Class::Browser', params => $run ); |
132 |
} |
} |
133 |
|
|
134 |
if ( $f ) { |
if ( $f ) { |
145 |
confess "# can't call request on nothing!"; |
confess "# can't call request on nothing!"; |
146 |
} |
} |
147 |
|
|
148 |
|
$content_type = $f->content_type; |
149 |
}; |
}; |
150 |
|
|
151 |
if ( $@ ) { |
if ( $@ ) { |
152 |
warn "SERVER ERROR: $@"; |
warn "SERVER ERROR: $@"; |
153 |
# $req->conn->send_error( 404 ); # FIXME this should probably be 500, but we can't ship page with it |
# $req->conn->send_error( 404 ); # FIXME this should probably be 500, but we can't ship page with it |
154 |
|
$content_type = 'text/html'; |
155 |
$self->print( qq{<pre class="frey-error">$@<pre>\r\n\r\n} ); |
$self->print( qq{<pre class="frey-error">$@<pre>\r\n\r\n} ); |
156 |
# Carp::REPL::repl; |
# Carp::REPL::repl; |
157 |
} |
} |
158 |
|
|
159 |
|
return $content_type; |
160 |
} |
} |
161 |
|
|
162 |
sub refresh { |
sub refresh { |