1 |
package Frey::Editor; |
package Frey::Editor; |
2 |
use Moose; |
use Moose; |
3 |
|
|
4 |
|
extends 'Frey::ClassLoader'; |
5 |
|
|
6 |
=head1 DESCRIPTION |
=head1 DESCRIPTION |
7 |
|
|
8 |
Support for local editor invocation from web |
Support for local editor invocation from web |
26 |
sub command { |
sub command { |
27 |
my ( $self, $url ) = @_; |
my ( $self, $url ) = @_; |
28 |
$url =~ url_regex; |
$url =~ url_regex; |
29 |
|
my ( $path, $line ) = ( $1, $2 ); |
30 |
|
# FIXME SECURITY path verification for $path |
31 |
my $editor = $ENV{VISUAL} || $ENV{EDITOR} || 'vi'; |
my $editor = $ENV{VISUAL} || $ENV{EDITOR} || 'vi'; |
32 |
# FIXME SECURITY path verification for $1 |
$path = $self->class_path( $path ) || $path if ! -e $path; |
33 |
my $cmd = "$editor $1 +$2"; |
my $cmd = "$editor $path +$line"; |
34 |
warn "# $url -> system $cmd"; |
warn "# $url -> system $cmd"; |
35 |
return $cmd; |
return $cmd; |
36 |
} |
} |