From: Devops Date: Tue, 11 Jul 2017 14:25:18 +0000 (+0100) Subject: etc/vim/templates/perl.tt X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=4ec456cac2e3c200270d7e4329183c470da4ea3a;p=nb.git etc/vim/templates/perl.tt --- diff --git a/etc/vim/templates/perl.tt b/etc/vim/templates/perl.tt index 09908a34..991c31d2 100755 --- a/etc/vim/templates/perl.tt +++ b/etc/vim/templates/perl.tt @@ -66,17 +66,12 @@ sub help { $main::_DATA_ =~ s/([@\$][A-Z_a-z\{\}]+)/pod_env($1)/eg; - # Create tmp - my $in_file = (-e '/dev/shm' ? '/dev/shm' : '/tmp')."/$NAME.$$"; my $in; - open($in,">$in_file") or die "$NAME: Can't write into $in_file: $!"; - print $in $main::_DATA_; - close $in; + open($in,'<',\$main::_DATA_); - # Output open(STDOUT,"|perl -pe 's/\.$$//g'".(($ENV{PAGER}||'') eq 'less' ? "|less -FRi" : "")); my $opts = { - -input => $in_file, + -input => $in, -ouput => \*STDOUT, -exitval => 'noexit', -sections => [qw(SYNOPSIS DESCRIPTION OPTIONS)], @@ -84,8 +79,8 @@ sub help { }; Pod::Usage::pod2usage($opts); + close $in; close STDOUT; - unlink $in_file if $in_file and -e $in_file; exit 0; } @@ -104,14 +99,11 @@ sub get_options { my @Opt; - $main::HELP_SPRINTF = 0; sub pod_opt { local $_; my $o = shift; $o =~ s/(=.|[\+\-\!]$)//; $o = join(", ",map{"-$_"} split(/[\|,:;]/,$o)); - #return sprintf('%-20s',"$o"); - $main::HELP_SPRINTF = length($o) if length($o) > $main::HELP_SPRINTF; return "$o"; }