10 $PROGRAM_DIR =~ s/[^\/\\]+$//;
11 $PROGRAM_DIR = "./" unless($PROGRAM_DIR);
13 map "$PROGRAM_DIR$_",qw{modules lib
../modules
..lib
};
17 my @OPTIONS = qw
/help|h|? version|ver edit-me manual|man/;
22 require MyPlace
::Usage
;
23 Getopt
::Long
::GetOptions
(\
%OPTS,@OPTIONS);
24 MyPlace
::Usage
::Process
(\
%OPTS,$VERSION);
28 require MyPlace
::Usage
;
29 MyPlace
::Usage
::PrintHelp
();
33 $editor = "notepad++" if($^O
=~ /win/i);
34 my $fname=shift @ARGV;
37 print STDERR
"Usage: $0 [options] filename\n";
42 print STDERR
"$fname exists, openning it...\n";
46 print STDERR
"Creating \"$fname\"...\n";
47 open PIPE
,">:utf8",$fname or die("$!\n");
54 my $oldst = stat($fname);
55 print STDERR
"Opening it in editor...\n";
56 system("$editor","$fname");
57 my $newst = stat($fname);
58 if($oldst->mtime < $newst->mtime) {
59 print STDERR
"$fname modified.\n";
62 print STDERR
"File doesn't be modified, cancel.\n";
63 unlink($fname) or print STDERR
"$!\n";
73 editpipe - Editor helper, creating file from PIPE
77 editpipe [options] filename
79 cat template | editpipe filename
87 Print version infomation.
91 Print a brief help message and exits.
93 =item B<--manual>,B<--man>
95 View application manual
99 Invoke 'editor' against the source
105 Editor helper program, which creates file from
106 PIPE, invokes the editor(r-edit), delete the
107 file if no modifition.
111 2010-08-12 xiaoranzzz <xiaoranzzz@myplace.hell>
117 xiaoranzzz <xiaoranzzz@myplace.hell>