]> git.nbdom.net Git - nb.git/commitdiff
etc/vim/templates/perl.tt
authorDevops <sys@15gifts.com>
Tue, 11 Jul 2017 14:25:18 +0000 (15:25 +0100)
committerDevops <sys@15gifts.com>
Tue, 11 Jul 2017 14:25:18 +0000 (15:25 +0100)
etc/vim/templates/perl.tt

index 09908a34e65e64fddb62f533593f4b3824c1589c..991c31d2fd803a07afead8cff1f32156c48a01d9 100755 (executable)
@@ -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";
        }