35 |
|
|
36 |
=cut |
=cut |
37 |
|
|
38 |
|
our $editor = Frey::Editor->new; |
39 |
|
|
40 |
sub run { |
sub run { |
41 |
my ( $self, $port ) = @_; |
my ( $self, $port ) = @_; |
42 |
$server = Continuity->new( |
$server = Continuity->new( |
51 |
); |
); |
52 |
$Module::Reload::Debug = 1; # auto if debug_level > 1 |
$Module::Reload::Debug = 1; # auto if debug_level > 1 |
53 |
Frey::ClassLoader->new->load_all_classes(); |
Frey::ClassLoader->new->load_all_classes(); |
54 |
|
$editor->switch_screen if $ENV{FREY_SWITCH_SCREEN}; |
55 |
$server->loop; |
$server->loop; |
56 |
} |
} |
57 |
|
|
114 |
|
|
115 |
my $f; |
my $f; |
116 |
|
|
|
my $editor = Frey::Editor->new; |
|
|
|
|
117 |
# shared run params |
# shared run params |
118 |
my $run = { |
my $run = { |
119 |
request_url => $req->request->url, |
request_url => $req->request->url, |
132 |
$f->request( $req ); |
$f->request( $req ); |
133 |
} elsif ( $path =~ $editor->url_regex ) { |
} elsif ( $path =~ $editor->url_regex ) { |
134 |
$req->print( $editor->command( $path ) ); |
$req->print( $editor->command( $path ) ); |
|
system( $editor->command( $path ) ); |
|
135 |
return; |
return; |
136 |
} elsif ( |
} elsif ( |
137 |
$path =~ m{/([^/]+)/(\w*as_\w+)/?([^/]+)?} |
$path =~ m{/([^/]+)/(\w*as_\w+)/?([^/]+)?} |
160 |
warn "## html ",length($html)," bytes"; |
warn "## html ",length($html)," bytes"; |
161 |
$req->print( $html ); |
$req->print( $html ); |
162 |
} else { |
} else { |
163 |
$req->print( qq|<pre class="frey-error">no output from $f</pre>\r\n\r\n| ); |
confess "no output from $f"; |
164 |
} |
} |
165 |
} else { |
} else { |
166 |
warn "# can't call request on nothing!"; |
confess "# can't call request on nothing!"; |
167 |
} |
} |
168 |
|
|
169 |
}; |
}; |
186 |
} |
} |
187 |
|
|
188 |
if ( $req->conn ) { |
if ( $req->conn ) { |
189 |
|
$req->print( "\r\n" ); # flush |
190 |
$req->conn->close; |
$req->conn->close; |
191 |
warn "## close connection: $@"; |
warn "## close connection: $@"; |
192 |
} |
} |