File: example2.pl

package info (click to toggle)
libproc-invokeeditor-perl 1.02-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 88 kB
  • ctags: 13
  • sloc: perl: 216; makefile: 38
file content (23 lines) | stat: -rw-r--r-- 553 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/local/bin/perl -w

use strict;
use Proc::InvokeEditor;

my $editor = new Proc::InvokeEditor(editors => [ '/usr/bin/emacs' ]);
my $e = $editor->first_usable;
print "Usable = " . $e->[0] . "\n";
my @result = $editor->edit("foo\nbar\nbaz\n");

foreach my $line (@result) {
  print "Line: $line\n";
}
sleep 5;

$editor->editors(['/usr/bin/vi']);
$editor->editors_prepend(['/bin/ed']);
$editor->editors_env(['TURNIP']);
my $result = $editor->edit("something\nin\nvi\n");
print $result;

$e = $editor->first_usable;
print "Usable = " . $e->[0] . "\n";