in reply to Re^3: List EXE_FILES installed by CPAN
in thread List EXE_FILES installed by CPAN
Control|Command + a to select all Control|Command + c to copy selected text In a terminal type: echo Type one space Control|Command + p to paste text Type: | perltidy -st >cpanexe; nano cpanexeHere's a handy blob of code to throw at a terminal that transforms itself into a proper script, saved to disk, opened in an editor. This can make any one liner into a script! Just echo a pasted one-liner to another one-liner via pipe and then pipe that to perltidy which you can direct to save a file and then open it in your favorite text editor:
Result:echo perl -le'chomp(@_=`perldoc -T perllocal`); # List EXE_FILES installed by CPAN $_=join"\n",@_;@_=split/\"Module\"\s/; @_=grep/EXE_FILES:\s[^"]+/,@_;for(@_){@x=split/\n/; @x=grep/EXE|0m/,@x;push@z,@x}s/^\s+\*\s+\"([^\"]+).?/$1/ for@z; @_=grep/EXE_FILES/,@z;@_=map{substr($_,11,length($_))}@_;undef@z; for(@_){if(/\s/){@x=split/\s/;push@z,$_ for@x}else{push@z,$_}} %_=map{s/^\S+\///;$_=>1}@z;print$_ for sort{lc($a)cmp lc($b)}keys%_'| perl -e'@_=<STDIN>;print qq~\#\!/usr/bin/perl\n\nuse strict;~.qq~ use warnings;\n\n@_;~'|perltidy -st >cpanexe;nano cpanexe
I don't see the problem with dense code. It makes sense to me because that's how it gets created at the command line. Perlmonks understand it just as well as their spoken language so i don't understand the criticism or why we're constantly hounded by the cult of whitespace. Learn how to use perltidy and the rest of your operating system to make it do what you want instead of complaining. It's much more productive! ☺#!/usr/bin/perl -w use strict; use warnings; chomp( @_ = `perldoc -T perllocal` ); # List EXE_FILES installed by CPAN $_ = join "\n", @_; @_ = split /\"Module\"\s/; @_ = grep /EXE_FILES:\s[^"]+/, @_; for (@_) { @x = split /\n/; @x = grep /EXE|0m/, @x; push @z, @x; } s/^\s+\*\s+\"([^\"]+).?/$1/ for @z; @_ = grep /EXE_FILES/, @z; @_ = map { substr( $_, 11, length($_) ) } @_; undef @z; for (@_) { if (/\s/) { @x = split /\s/; push @z, $_ for @x } else { push @z, $_ } } %_ = map { s/^\S+\///; $_ => 1 } @z; print $_ for sort { lc($a) cmp lc($b) } keys %_;
chomp join split grep for split grep push s for grep map substr length undef for if split push for else push map s print for sort cmp keys
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: List EXE_FILES installed by CPAN
by stevieb (Canon) on Jun 25, 2018 at 16:23 UTC | |
by usemodperl (Beadle) on Jun 25, 2018 at 19:51 UTC | |
Re^5: List EXE_FILES installed by CPAN
by Anonymous Monk on Jun 24, 2018 at 12:41 UTC | |
by usemodperl (Beadle) on Jun 24, 2018 at 18:32 UTC |