--- trunk/lib/Frey/Server.pm 2008/11/05 08:21:03 292 +++ trunk/lib/Frey/Server.pm 2008/11/18 00:55:23 392 @@ -1,8 +1,9 @@ package Frey::Server; use Moose; - +extends 'Frey'; with 'Frey::Web'; +with 'Frey::Config'; use Continuity; #use Continuity::REPL; @@ -36,7 +37,7 @@ sub run { my ( $self, $port ) = @_; $server = Continuity->new( - port => $port || 16001, + port => $port || $self->config->{port} || 16001, path_session => 1, cookie_session => 'sid', callback => \&main, @@ -79,7 +80,7 @@ my $f; - my $run_regexp = join('|', Frey::Run->execute ); + my $run_regexp = join('|', Frey::Run->runnable ); if ( $path =~ m{/Frey[:-]+ObjectBrowser} @@ -92,17 +93,27 @@ $f = Frey::ObjectDesigner->new( fey_class => $params{class} ); $f->request( $req ); } elsif ( + $path =~ m{/editor(.+?)\+(\d+)} + ) { + my $editor = $ENV{VISUAL} || $ENV{EDITOR} || 'vi'; + # FIXME SECURITY path verification for $1 + my $cmd = "$editor +$2 $1"; + warn "# $path -> system $cmd"; + $req->print( $cmd ); + system( $cmd ); + return; + } elsif ( $path =~ m{/([^/]+)/($run_regexp)} ) { my $class = rest2class $1; warn "# run $class $2\n"; - $f = Frey::Run->new( class => $class, params => \%params ); + $f = Frey::Run->new( class => $class, params => \%params, run => $2, request_url => $req->request->url ); } elsif ( $path =~ m{/([^/]+)/?$} ) { my $class = rest2class $1; warn "# introspect $class"; - $f = Frey::Run->new( class => 'Frey::Introspect', params => { class => $class } ); + $f = Frey::Run->new( class => 'Frey::Introspect', params => { class => $class }, request_url => $req->request->url ); } else { $f = Frey::Run->new( class => 'Frey::ClassBrowser' ); } @@ -120,7 +131,7 @@ if ( $@ ) { warn $@; $req->conn->send_error( 404 ); # FIXME this should probably be 500, but we can't ship page with it - $req->print( qq{
$@
} );
+		$req->print( qq{
$@
} );
 #		Carp::REPL::repl;
 
 	}