SPUG: Those magic commands that Damian used
Damian Conway
damian at conway.org
Sat Jul 20 10:17:25 CDT 2002
Andy wrote:
> I noticed at last Tuesday's meeting that Damian
> used the command "pmd" at his Mac OS X shell prompt.
% alias pmd
cd `filemoddir !:1-$`
% cat ~/bin/filemoddir
#! /usr/bin/perl -w
# Locate directories under my Perl source tree by giving
# the first few characters of each part of the module name
my $PERLDIR = "$ENV{HOME}/src/Perl";
my $pattern = join '::', @ARGV;
$pattern =~ s|::|/|g;
if (-d "$PERLDIR/$pattern" ) {
print "$PERLDIR/$pattern\n";
exit;
}
my $ipattern = join '::', map {ucfirst} @ARGV;
$ipattern =~ s|::|/|g;
if (-d "$PERLDIR/$ipattern" ) {
print "$PERLDIR/$ipattern\n";
exit;
}
$pattern =~ s|/|*/|g;
@maybe = glob "$PERLDIR/$pattern*";
@maybe = glob "$PERLDIR/$ipattern*" unless @maybe;
print join " ", @maybe if @maybe;
print "." unless @maybe;
Asim wrote:
> Along the same lines, I noticed that Damian used a
> keystroke in Vi that executed his perl code and
> paged through the output instead of replacing the
> buffer's contents with the output (as :! does).
> How did he do that?
%cat ~/.exrc
# Hundreds of other customizations omitted
# E is for Execute...
map E :!mperl -w %
%cat ~/bin/mperl
#! /bin/csh
perl $argv |& less
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list