/[Frey]/trunk/lib/Frey/Editor.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/Frey/Editor.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 407 - (show annotations)
Tue Nov 18 12:02:57 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 554 byte(s)
platform-specific editor stuff is not in Frey::Editor
1 package Frey::Editor;
2 use Moose;
3
4 =head1 DESCRIPTION
5
6 Support for local editor invocation from web
7
8 <a href="/editor+$path+$line" target="editor">$class</a>
9
10 =head2 url
11
12 $path =~ $editor->url_regex
13
14 =cut
15
16 sub url_regex { qr{/editor\+?(.+?)\+(\d+)} }
17
18 =head2 command
19
20 my $system = $editor->command( $path );
21
22 =cut
23
24 sub command {
25 my ( $self, $url ) = @_;
26 $url =~ url_regex;
27 my $editor = $ENV{VISUAL} || $ENV{EDITOR} || 'vi';
28 # FIXME SECURITY path verification for $1
29 my $cmd = "$editor $1 +$2";
30 warn "# $url -> system $cmd";
31 return $cmd;
32 }
33
34 1;

  ViewVC Help
Powered by ViewVC 1.1.26