--- trunk/lib/Frey/Server.pm 2008/11/05 20:18:33 314 +++ trunk/lib/Frey/Server.pm 2008/11/17 22:57:51 387 @@ -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, @@ -92,11 +93,21 @@ $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 ); } elsif ( $path =~ m{/([^/]+)/?$} ) { @@ -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;
 
 	}