| Next | Welcome to my ~/bin | 51 |
How did the file get tied?
my (@SEQUENCE, $TIED);
my $folder;
if ($ARGV[0] =~ /^\+(.*)/) {
$folder = shift;
mhc "folder -nocreate $folder";
$folder =~ s/^\+//;
} else {
$folder = mhc "folder -fast";
}
my $seqfile = seqfile($folder);
my $TIED = tie my @SEQUENCE, 'Tie::File', $seqfile
or die "Couldn't tie $seqfile: $!";
$TIED->flock(LOCK_EX) or die "Couldn't lock $seqfile: $!";
unless (@ARGV) {
list_seqs();
exit 0;
}
Lessons learned:
Tie::File makes a good lightweight database, if performance is unimportant
Calling out the the shell is easy and convenient
Dispatch tables can provide synonyms for internal operations
| Next | Menu | ![]() |
Copyright © 2005 M. J. Dominus |