Would this be of interest to anybody? If so, I will make it freely available.
Of course yes, people might learn, the tool might spawn discussions which probably will generate further enlightenment. I guess the appropriate place to publish such a thing would be Cool Uses for Perl.
How do I start a new script? Well, depends. If it is a straight forward task, I start with a blank page and type along. If the thing at hand requires new modules I'm not familiar with, I usually fire up my own enhanced version of perlsh included in Term::ReadLine::Gnu which writes a history file, fool around with that upon the modules in question until the bits are in place, and then I'll copy the good parts from the history into my new script editors buffer. No, not cut&paste. Two terminals aligned side by side, the left one holding the new script in vi, the right one paging the perlsh history with line numbers (less -N on Linux/Cygwin). Copying from right to left is done with
:r ! l 42-64,96,14 .perlsh_history
and $HOME/bin/l reads as follows:
#!/usr/bin/perl -n BEGIN { $spec=shift; @l=split/,/,$spec; for(@l){ ($s,$e)=split/-/; $e||=$s; $_=[$s,$e]; } } CHECK { unless(@ARGV) { push @ARGV, <DATA>; chomp @ARGV; } die "usage: $0 linespec file\n" unless @ARGV; $file = $ARGV[0]; } # === loop ==== for $l(@l){ print if $.>=$l->[0] and $.<=$l->[1] } # === end === # END { if ($file) { open $fh,'<', $0; @lines = <$fh>; close $fh; open $fh,'>',$0; for(@lines){ print $fh $_; last if /^__DATA__$/; } print $fh $file,"\n"; } } __DATA__
which code isn't posted to Cool Uses for Perl yet...
In reply to Re: Starting a New Script
by shmem
in thread Starting a New Script
by LloydRice
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |