[19214] in Perl-Users-Digest
Perl-Users Digest, Issue: 1409 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 30 18:05:53 2001
Date: Mon, 30 Jul 2001 15:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <996530713-v10-i1409@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 30 Jul 2001 Volume: 10 Number: 1409
Today's topics:
[ANN] Class::Prototyped - Fast prototype-based OO progr <nedkonz@cpan.org>
[ANNOUNCE]: Curses module v1.06 is now available <William_Setzer@ncsu.edu>
Re: Bug in fcntl support in 5.6??? <bernie@fantasyfarm.com>
CGI::Cache 1.10 released <newspost@coppit.org>
Cleaning replacing the value of a constant <bernie@fantasyfarm.com>
Re: Correction to Re: I'm doing a script to append text (Lawrence)
Re: counting slash@dot.c.o.m.org
Re: Extract the relative sorting of items from multiple (Abigail)
FAQ: How do I find the soundex value of a string? <faq@denver.pm.org>
Re: FAQ: How do I find the soundex value of a string? <iltzu@sci.invalid>
Re: Finding a word in a sorted list. <iltzu@sci.invalid>
Re: Finding a word in a sorted list. <bart.lateur@skynet.be>
Re: Finding a word in a sorted list. (Craig Berry)
Re: Finding keywords in text files <Tassilo.Parseval@post.rwth-aachen.de>
Re: How can I contribute? <newspost@coppit.org>
how to prompt for a single char from stdin? chiry@csua.Berkeley.EDU
Re: how to prompt for a single char from stdin? <Tassilo.Parseval@post.rwth-aachen.de>
Re: how to prompt for a single char from stdin? <tinamue@zedat.fu-berlin.de>
Re: How to sort old mailboxes <newspost@coppit.org>
Re: HTTP Question Marks? (Abigail)
Re: I'm doing a script to append text to a file but do (Lawrence)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 29 Jul 2001 16:42:50 +2328
From: Ned Konz <nedkonz@cpan.org>
Subject: [ANN] Class::Prototyped - Fast prototype-based OO programming in Perl - released to CPAN
Message-Id: <tmbkubjauflu23@corp.supernews.com>
Class::Prototyped - Fast prototype-based OO programming in Perl
Class::Prototyped version 0.11 (our first version) has been released to
CPAN. It is available from your local CPAN mirror as (for instance):
http://www.cpan.org/modules/by-authors/id/N/NE/NEDKONZ/Class-Prototyped-0.11.tar.gz
or
ftp://ftp.cpan.org/pub/CPAN/authors/id/N/NE/NEDKONZ/Class-Prototyped-0.11.tar.gz
This package provides for efficient and simple prototype-based
programming in Perl. You can provide different subroutines for each
object, and also have objects inherit their behavior and state from
another object.
Method invocation is as fast as in regular Perl. Data inheritance and
accessors are provided using closures. It does not use AUTOLOAD.
If you're familiar with the Self language, this will look quite
familiar.
If you find yourself using objects whose behavior is wholly or partially
determined by closures or CODE references, you should consider trying
this package.
If you're modifying @ISA or symbol tables on the fly, you should
consider using this package.
If you're using Class::SelfMethods, Class::Classless, or Class::Object,
you should _definitely_ consider using this package.
Automatic delegation is also provided, as is a full reflection
interface.
You can do the following:
* Make objects that live in their own classes
* Inherit from objects _or_ classes
* Add or remove methods from objects or classes dynamically
* Modify inheritance dynamically
* Automatically delegate specific methods to a particular object or
class
* Mix-in behavior simply from classes or objects
* Examine the capabilities and inheritance of your objects and/or
classes using a simple, consistent interface (no more inspecting @ISA or
symbol tables)
* Perl code in external files can be mixed in to the behavior of a class
or object (like the way Ruby handles mixed-in modules).
Class::Prototyped was written by Ned Konz and Toby Everett; we welcome
feedback on its design and usage. Toby wrote Class::SelfMethods and is
now using Class::Prototyped instead.
------------------------------
Date: 25 Jul 2001 15:23:54 -0400
From: William P Setzer <William_Setzer@ncsu.edu>
Subject: [ANNOUNCE]: Curses module v1.06 is now available
Message-Id: <tmbkui8qditt25@corp.supernews.com>
The Curses module v1.06 should be showing up on CPAN shortly. I've
poked, prodded, and generally made a mess of the module, so please
let me know if I broke something for your OS. (I only tested on
Solaris and Red Hat Linux.)
The README is attached. Enjoy!
William
The Curses extension to perl v5
Version 1.06
Copyright (c) 1994-2000 William Setzer
All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the same terms as perl, specifically:
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License" which comes with this Kit.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Artistic License for more details.
You should have received a copy of the Artistic License with this
Kit, in the file named "Artistic". If not, I'll be glad to provide one.
You should also have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
This is a dynamic loadable curses module for perl. You can get this
package at any CPAN archive.
Please see the INSTALL document for how to install it on your system,
the Curses pod (located at the end of "Curses.pm") for known
incompatibilities with other Perl programs, and the end of this
document for known compile or install problems.
*** SECURITY NOTICE ***
It has always been the case with the curses functions, but please note
that the following functions:
getstr() (and optional wgetstr(), mvgetstr(), and mvwgetstr())
inchstr() (and optional winchstr(), mvinchstr(), and mvwinchstr())
instr() (and optional winstr(), mvinstr(), and mvwinstr())
are subject to buffer overflow attack. This is because you pass in
the buffer to be filled in, which has to be of finite length, but
there is no way to stop a bad guy from typing.
In order to avoid this problem, use the alternate functions:
getnstr()
inchnstr()
innstr()
which take an extra "size of buffer" argument.
New in 1.06:
o Now requires perl5.005 or better to run. (You can probably run it
in perl5.002-perl5.004 by grabbing newCONSTSUB out of the IO
distribution on CPAN and editing all uses of "foreach my $var" in
my perl scripts.)
o Did lots of fiddling with the file generation in an effort to make
it more comprehensible. In doing so, I moved around the way some
things were done and probably broke it on some systems with weird
compilers. Please let me know.
o changed the "Curses->new()" function to be a bit less clever.
o Support for libmenu! Many thanks to Yury Pshenichny <yura at zp.ua>
who did most of the actual work.
Update: Well, sort of support. For some reason beyond my ken, it
doesn't work with Solaris (2.6) libmenu. (The items won't attach to
the menu.) ncurses menu, both 1.9.9 and 5.2, seem to work fine.
o libform support added, too. Ho hum. ;) This one does appear to
work with Solaris libform.
o Added the following ncurses extension functions:
use_default_colors()
assume_default_colors()
define_key()
keybound()
keyok()
resizeterm()
(Thanks to neild at misago.org, hans at kolej.mff.cuni.cz)
o Re-enabled the functions:
attr_get()
attr_off()
attr_on()
attr_set()
o Between the functions supported and the functions listed in the
pod as not supported, those are all the ones I know about.
Got any more? Let me know.
o Fixed 64 bit issue with getch() and possibly others, truncating
returns of `chtype' to 32 bits. Note that this could possibly
break some OSes. Please let me know.
(Thanks to Randall.G.Steiner at bankofamerica.com)
o Fixed bug where @ARGV was always being cleared, and so no arguments
ever got to MakeMaker.
(Thanks to bdlow at nortelnetworks.com)
o Added hints for Darwin/Mac OS X system.
(Thanks to sdietrich at emlab.com)
o Added note to NETBSD users at the bottom of this README.
o Added a security notice to the README and pod.
(Thanks to connor at ing.umu.se)
o Has anyone successfully used the mouse event stuff?
The "demo" program is for demonstration purposes only. If it
references a function your version of curses doesn't have, wrap it in
an "eval" and try again. Same goes double for the "gdc" program.
You can type "make cdemo" to make a C language version of the demo.
If you get the same results via "demo" and "cdemo", but they don't
look right, then it's a bug in your libcurses, not in Curses.
* Personal Note *
I'm very grateful to all those that send in reports and patches, and
I'm very sorry that I don't release the Curses modules more often.
Yury's excellent libmenu patches have sat around for many months
because I've been too lazy to give Curses another round of polish.
Enjoy!
William Setzer
William_Setzer at ncsu.edu
Known Problems
--------------
NCurses
getch() and getstr() don't work right under very old versions of
ncurses (around v1.8.5). Please upgrade to a newer version.
panel_hidden() test is reversed in v1.9.9g. Please upgrade to
a newer version.
Actually, there are several problems in v1.9.9g. Please upgrade
to a newer version.
NETBSD
I continue to get conflicting reports about the correct number of
arguments for longname() and touchline(), controlled via the file
`hints/c-netbsd.h'. Before compiling, you may want to look them up
yourself, confirm them, and then editing `hints/c-netbsd.h'.
Any NETBSD guru that can resolve this problem for all versions of
their OS will get my undying gratitude.
Solaris 2.6
The menu stuff doesn't appear to work. I have no idea why.
------------------------------
Date: Mon, 30 Jul 2001 17:16:09 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: Bug in fcntl support in 5.6???
Message-Id: <oeibmtcqcj65av94sjhjtbbnidhtce4iia@news.supernews.net>
Bernie Cosell <bernie@fantasyfarm.com> wrote:
} I'm going a bit nuts here trying to get fcntl file-locking to work.
[...]
} fcntl (FH, F_SETLKW, $wrlock)
} or warn("Error locking: $!\n"), return undef;
} ===========================
} $ tlock.perl
} Error locking: Invalid argument
} Couldn't lock! at ./tlock.perl line 7.
}
} =============================
}
} Now, just to make sure that it wasn't something strange in our Linux setup
} [RH 7.1, NFS mounting a Reiserfs filesystem], I tried doing the SAME thing
} in C:
}
} ======================================
} if (fcntl (fd, F_SETLKW, &L) < 0)
} { printf("Error getting lock: %d->%s\n", errno, strerror(errno)) ;
} exit(1) ;
} }
It is, indeed, a problem with Perl. A newsgroup-participant replied to me
privately something I was already investigating --- the problem is that in
our Perl installation, somehow, F_SETLKW has value 14 [which is F_SETLKW64]
rather than value 7 [which is what the C-program was using for its value].
When I changed my Perl program to brute-force use '7' for the fcntl
command... ta da... the file locking started working perfectly and no more
"invalid argument" complaints...
This brings me to a question about changing one of those constants, but
that's on another thread...
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Mon, 30 Jul 2001 12:00:31 -0400
From: David Coppit <newspost@coppit.org>
Subject: CGI::Cache 1.10 released
Message-Id: <tmbku4ae73dp21@corp.supernews.com>
Description:
- Perl extension to cache output of time-intensive CGI scripts so that
subsequent visits to such scripts will not cost as much time.
WARNING
The interface as of version 1.01 has changed considerably
and is NOT compatible with earlier versions.
Download:
- You can download CGI::Cache from CPAN:
http://www.cpan.org/authors/id/D/DC/DCOPPIT/CGI-Cache-1.10.tar.gz
- Until the file propagates to the mirrors, you can use the following URL:
http://prdownloads.sourceforge.net/cgicache/CGI-Cache-1.10.tar.gz
Changes:
- Fixed ambiguous die() warnings under Perl 5.6
- Added pause(), continue(), invalidate_cache_entry(), and buffer()
methods.
- Added test cases for new methods.
David
------------------------------
Date: Mon, 30 Jul 2001 17:16:04 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Cleaning replacing the value of a constant
Message-Id: <6libmtc84ma8ugrf8v0mouibr44vof2hmj@news.supernews.net>
In my other thread [on problems with fcntl file locking] I discovered that
in my Perl installation, the constant F_SETLKW has the wrong value
[probably all the fcntl locking-constants do, but that's the only one I'm
actually using at the moment].
so I'd like to 'correct' that. I tried:
use Fcntl;
use constant F_SETLKW => 7 ;
it didn't work and I'm not all that surprised. BUT I'm frustrated to
report that I couldn't hit AT ALL on a combination that'd work. I tried:
use Fcntl;
undef F_SETLKW ;
use constant F_SETLKW => 7 ;
that didn't work:
Can't modify non-lvalue subroutine call in undef operator at -e line 2,
near "F_SETLKW ;"
I tried:
use Fcntl;
undef &F_SETLKW ;
use constant F_SETLKW => 7 ;
and got a diffent error:
Prototype mismatch: sub main::F_SETLKW vs () at
/mnt/perl/lib/5.6.1/constant.pm line 91.
I have to confess that I can't figure out how F_SETLKW gets defined. On
our old 5.4 system I was able to find an "fcntlbits.ph" that included
eval 'sub F_SETLKW () {7;}' unless defined(&F_SETLKW);
but I can't find any similar code in our 5.6 installation, so I haven't a
*clue* how Fcntl.pm actually gets the constants it exports defined.
What I'd like to do is *patch* it. But I can't figure out a way HOW to...
Is there some way to replace the (incorrect) value that Fcntl.pm is
defining for F_SETLKW?
Thanks!
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Mon, 30 Jul 2001 20:42:50 GMT
From: lawrence@f-deans.freeserve.co.uk (Lawrence)
Subject: Re: Correction to Re: I'm doing a script to append text to a file but do not know how to deal with duplicate text
Message-Id: <3b65c530.5854082@news.freeserve.net>
On Sun, 29 Jul 2001 09:49:00 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> assisted me by writing:
>Lawrence AKA The CLPM Troll wrote:
>
>> Godzilla! wrote:
>
>> <snipped message>
>
>(snipped)
>
<snippity snip>
>However, you have consistently made a fool of yourself in the
>past, are doing so now and, will continue to do so into the future.
You can't make a fool out of a fool
>
>*laughs*
*g*(</*laughs*>)
>
>Godzilla!
------------------------------
Date: Mon, 30 Jul 2001 18:27:49 GMT
From: slash@dot.c.o.m.org
Subject: Re: counting
Message-Id: <3b65a6d7.1795625@news.freeserve.co.uk>
On Sun, 29 Jul 2001 19:26:32 -0700, "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
>My code below my signature is nothing more than a wild guess...
[...]
Nice disclaimer. How come you don't use it with all of your somewhat clumsy examples
of keyboard-based stupidity?
------------------------------
Date: 30 Jul 2001 20:42:25 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Extract the relative sorting of items from multiple lists
Message-Id: <slrn9mbhmm.d4m.abigail@alexandra.xs4all.nl>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMDCCCLXXXVII
September MCMXCIII in <URL:news:9jrqfi$mp8$1@mamenchi.zrz.TU-Berlin.DE>:
|| According to Bart Lateur <bart.lateur@skynet.be>:
|| > I've got a cute little problem here. It's actually more of a question
|| > for a proper algorithm, than a specific perl problem.
|| >
|| > I have to extract the ordering of each item in some arrays, and not
|| > every item is present in every array. For example:
|| >
|| > @list = ([qw(A C F)], [qw(A B C)], [qw(A C D E)], [qw(E F)]);
|| >
|| > From this, I'd need to deduce that 'B' comes before 'C' and after 'A',
|| > and so on, so I'd eventually have to come up with the list qw(A B C D E
|| > F). How would you do that?
|| >
|| > If there's more than one solution, any solution will do, and if there's
|| > a conflict, e.g. between orderings qw(A B C) and qw(C A), I'd like to be
|| > warned about it.
|| >
|| > As a thought for a starting point: for qw(A C F), I'd assign a number to
|| > each entry, for example (A => 1, C => 2, F => 3), and try to assign
|| > intermediate values for values that have to come in between existing
|| > items. The big question is how to mark unresolved relative orderings,
|| > for example before examining the last entry in the above example list,
|| > you know that 'D' comes after 'C'; and that 'F' comes after 'C'. So
|| > where does 'F' stand relative to 'D'? Unresolved. And what about 'E'? It
|| > comes after 'D', true... but in relation to 'F'?
||
|| There's a module for that!
||
|| Well, not quite, but Abigail's Algorithm::Graphs::TransitiveClosure
|| can play a part.
Yeah, if you have 5 elements or so.
The transitive closure is calculated using a cubed algorithm (you can do
it a bit faster using complicated techniques, but the best know algorithm
is still N^e, for some 2.5 < e < 3).
What Bart needs is a topological sort. And you are right, there is a
module for that. The Graph module, as found on CPAN and discussed in
"Mastering Algorithms with Perl" has such a method.
#!/opt/perl/bin/perl -w
use strict;
use Graph;
my @list = ([qw(A C F)], [qw(A B C)], [qw(A C D E)], [qw(E F)]);
my $graph = Graph -> new;
foreach my $path (@list) {
$graph -> add_path (@$path);
}
print "@{[$graph -> toposort]}\n";
__END__
A B C D E F
Abigail
--
use lib sub {($\) = split /\./ => pop; print $"};
eval "use Just" || eval "use another" || eval "use Perl" || eval "use Hacker";
------------------------------
Date: Mon, 30 Jul 2001 18:19:10 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I find the soundex value of a string?
Message-Id: <yyh97.170$os9.197670912@news.frii.net>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.
+
How do I find the soundex value of a string?
Use the standard Text::Soundex module distributed with Perl. Before you
do so, you may want to determine whether `soundex' is in fact what you
think it is. Knuth's soundex algorithm compresses words into a small
space, and so it does not necessarily distinguish between two words
which you might want to appear separately. For example, the last names
`Knuth' and `Kant' are both mapped to the soundex code K530. If
Text::Soundex does not do what you are looking for, you might want to
consider the String::Approx module available at CPAN.
-
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to
news:news.answers
or to the many thousands of other useful Usenet news groups.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-1999 Tom Christiansen and Nathan
Torkington. All rights reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
04.33
--
This space intentionally left blank
------------------------------
Date: 30 Jul 2001 19:41:10 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
To: PerlFAQ Server <faq@denver.pm.org>
Subject: Re: FAQ: How do I find the soundex value of a string?
Message-Id: <996521957.26514@itz.pp.sci.fi>
[Posted and mailed to <faq@denver.pm.org>.]
In article <yyh97.170$os9.197670912@news.frii.net>, PerlFAQ Server wrote:
[snip]
> `Knuth' and `Kant' are both mapped to the soundex code K530. If
> Text::Soundex does not do what you are looking for, you might want to
> consider the String::Approx module available at CPAN.
There probably should be a reference to Text::Metaphone here.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: 30 Jul 2001 19:31:49 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Finding a word in a sorted list.
Message-Id: <996520889.24670@itz.pp.sci.fi>
In article <9k3v5j$hli$1@pegasus.csx.cam.ac.uk>, M.J.T. Guy wrote:
>Bart Lateur <bart.lateur@skynet.be> wrote:
>>Mario Rizzuti wrote:
>>>
>>>I am wondering what is the fastest possible way to find the associated
>>>numbers of a given list of usernames?
>>
>>Theoretically: binary search. I would think.
>
>Nope. Hash lookup will always beat it ( O(1) rather than O(log n), with
>good constants ).
..but of course, if what you have is an array, turning it into a hash is
an O(n) operation.
On the other hand, since Perl has efficient idioms for it, it's quite
likely that (unless the array is huge) an O(n) hash slice operation will
be faster than an O(log n) binary search because the constant term is so
much lower for the hash slice.
If the data is in a sorted flat file things get even funnier, since one
would have to consider block sizes and seek times and all sorts of file
system details to get a precise answer. In practice, however, a hash
slice approach is still likely to be fastest for any moderately sized
file. For memory, nothing beats a while loop.
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: Mon, 30 Jul 2001 20:04:26 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Finding a word in a sorted list.
Message-Id: <3ffbmtses8pi3o53mka221svn1djc4do0r@4ax.com>
M.J.T. Guy wrote:
>Bart Lateur <bart.lateur@skynet.be> wrote:
>>Mario Rizzuti wrote:
>>>
>>>I am wondering what is the fastest possible way to find the associated
>>>numbers of a given list of usernames?
>>
>>Theoretically: binary search. I would think.
>
>Nope. Hash lookup will always beat it ( O(1) rather than O(log n), with
>good constants ).
>
>Provided you can afford the memory, of course.
I was talking about searching it on disk. Your approach requires first
loading the hash.
--
Bart.
------------------------------
Date: Mon, 30 Jul 2001 20:28:28 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Finding a word in a sorted list.
Message-Id: <tmbgrcjasge73d@corp.supernews.com>
M.J.T. Guy (mjtg@cus.cam.ac.uk) wrote:
: Bart Lateur <bart.lateur@skynet.be> wrote:
: >Mario Rizzuti wrote:
: >>I am wondering what is the fastest possible way to find the associated
: >>numbers of a given list of usernames?
: >
: >Theoretically: binary search. I would think.
:
: Nope. Hash lookup will always beat it ( O(1) rather than O(log n), with
: good constants ).
:
: Provided you can afford the memory, of course.
And provided you can factor out building the hash, which is O(n). If you
need to do this on the fly, from a sorted list as input, binary search on
the list may be a better bet than building and then accessing a hash. The
latter may be easier to code in Perl, of course.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Brute force done fast enough looks slick."
| - William Purves
------------------------------
Date: Mon, 30 Jul 2001 20:22:26 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Finding keywords in text files
Message-Id: <3B65A5E2.6090308@post.rwth-aachen.de>
Tad McClellan wrote:
>Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de> wrote:
>
>>Michael Budash wrote:
>>
>>>>>delete @counts{qw(a is or of it the and)}; # delete "stopwords"
>>>>>
>No, it *is* a hash slice.
>
Indeed, you are right. I guess I overlooked the part between @ and {.
--
The good (I am convinced, for one)
Is but the bad one leaves undone.
Once your reputation's done
You can live a life of fun.
-- Wilhelm Busch
------------------------------
Date: Mon, 30 Jul 2001 15:26:46 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: How can I contribute?
Message-Id: <3B65B4F6.2010908@coppit.org>
tuxy wrote:
> I wrote a module that catalogues the contents of @INC in a nice HTML
> table, or a flatfile. I offered it up on CPAN as a module, but I was
> told there is already an effort underway to address this need, and why
> didn't I join that effort instead?
>
> Well I'd be glad to do just that if I could determine how! I wrote back
> to the CPAN person who replied and never got anymore info.
Try posting to clp.modules and ask who is working on the module.
David
------------------------------
Date: Mon, 30 Jul 2001 19:19:05 +0000 (UTC)
From: chiry@csua.Berkeley.EDU
Subject: how to prompt for a single char from stdin?
Message-Id: <9k4bv9$16tl$1@agate.berkeley.edu>
Hi, I need to prompt the user for a simple key board response, like
(Y/N/R)?
the user is suppose to hit y, n, or the r key, anything else the user
enter is simply quitely absorbed, nothing shows up on the keyboard.
I tried getc but it requires a 'enter' being pressed. Is there way to
do this?
I am running active perl 5.6.1 on Windows 2000.
Thanks.
--
Raymond Chi
chiry@csua.Berkeley.EDU
------------------------------
Date: Mon, 30 Jul 2001 21:49:11 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: how to prompt for a single char from stdin?
Message-Id: <3B65BA37.6080207@post.rwth-aachen.de>
chiry@csua.Berkeley.EDU wrote:
>Hi, I need to prompt the user for a simple key board response, like
>
>(Y/N/R)?
>
>the user is suppose to hit y, n, or the r key, anything else the user
>enter is simply quitely absorbed, nothing shows up on the keyboard.
>
>I tried getc but it requires a 'enter' being pressed. Is there way to
>do this?
>
Yes. Look for Term::ReadKey, it will exactly do this.
--
How many nuclear engineers does it take to change a light bulb ?
Seven: One to install the new bulb, and six to determine what to do
with the old one for the next 10,000 years.
------------------------------
Date: 30 Jul 2001 20:18:05 GMT
From: Tina Mueller <tinamue@zedat.fu-berlin.de>
Subject: Re: how to prompt for a single char from stdin?
Message-Id: <9k4fdt$2f2ua$2@fu-berlin.de>
chiry@csua.berkeley.edu wrote:
> Hi, I need to prompt the user for a simple key board response, like
> (Y/N/R)?
> the user is suppose to hit y, n, or the r key, anything else the user
> enter is simply quitely absorbed, nothing shows up on the keyboard.
perldoc Term::ReadKey
--
http://www.tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please don't email unless offtopic or followup is set. thanks
------------------------------
Date: Mon, 30 Jul 2001 15:15:42 -0400
From: David Coppit <newspost@coppit.org>
Subject: Re: How to sort old mailboxes
Message-Id: <3B65B25E.40601@coppit.org>
Marco F wrote:
> I have already looked around in CPAN and newsgroup archives without
> success, as almost all scripts and documentation available are there
> to send email or manage incoming message, not to put order in an
> existing (completely messed up) collection of mailboxes.
>
> Imagine having many mailboxes in mbox format, with many duplicated
> messages, and not sorted at all by sender.
Mark Overmeer is currently working on a Mail::Box set of modules what
will eventually be useful for such things. (It's still currently in
development.)
Meanwhile, you may want to check out grepmail (http://grepmail.sf.net/)
to help organize (but not sort) your emails into bins, and can remove
duplicates.
<rant>
CPAN scripts *still* can't handle tarballs, so I can't upload grepmail
into the scripts repository.
</rant>
David
------------------------------
Date: 30 Jul 2001 20:47:05 GMT
From: abigail@foad.org (Abigail)
Subject: Re: HTTP Question Marks?
Message-Id: <slrn9mbhvh.d4m.abigail@alexandra.xs4all.nl>
L Hopkins (hopkins@syndesis.com) wrote on MMDCCCLXXXVI September MCMXCIII
in <URL:news:65fbefdb.0107261135.17515c50@posting.google.com>:
][ I apologize in advance, however I can't seem to find an http
][ newsgroup.
So? What makes you think a Perl group is appropriate? Why not
rec.woodmaking? Or alt.binaries.whistles.trains.china?
Abigail
--
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
------------------------------
Date: Mon, 30 Jul 2001 20:35:29 GMT
From: lawrence@f-deans.freeserve.co.uk (Lawrence)
Subject: Re: I'm doing a script to append text to a file but do not know how to deal with duplicate text
Message-Id: <3b65c3ad.5467121@news.freeserve.net>
On Sun, 29 Jul 2001 09:58:12 -0700, Jeff Zucker <jeff@vpservices.com>
assisted me by writing:
>Michael Budash wrote:
>>
>> In article <3b6327c7.22658935@news.freeserve.net>,
>> lawrence@f-deans.freeserve.co.uk (Lawrence) wrote:
>>
>> > I have a simple script I put together to solve a problem I had with my
>> > mailing list addresses.
>
>[Michael Budash's totally satisfactory code snipped]
>
>Another option is to use the AnyData module which provides a
>multi-dimensional tied hash interface to CSV, Fixed Length, XML, and
>many other file formats. In this particular case, it does everything
>Michael's code does and has these advantages over Michael's code: a) it
>accomplishes the same thing in less than a third of the lines of code
>(at least code that you would write) and with the additional benefits of
>b) file locking (if your system supports flock) and of c) not ever
>slurping any of the files en masse into arrays, rather looping through
>the lines of the files via the tie mechanism and of d) working on other
>CSV regardless of separators or eols or with XML or other formats and of
>e) providing an easy upgrade path from tied hash to a DBI interface if
>your app ever becomes more complex. It has the disadvantage of
>requiring a module and of having a slight learning curve to figure out
>the specialized tied hash.
>
>This worked using the exact data you supplied for newlist.txt (including
>the spaces around the commas and the empty fields and the duplicates)
>and produced the appropriate yeslist.txt and nolist.txt files no matter
>how many times it ran (i.e. it didn't add more to those files after the
>first run):
>
>use AnyData;
>my $newflags = {col_names=>'status,name,email', trim=>1};
>my $ynflags = {col_names=>'name,email', trim=>1};
>my $newlist = adTie('CSV','newlist.txt','r',$newflags);
>my $yeslist = adTie('CSV','yeslist.txt','u',$ynflags);
>my $nolist = adTie('CSV','nolist.txt','u',$ynflags);
>while (my $row = each %$newlist) {
> my($status,$name,$email) = ( $row->{status},
> $row->{name},
> $row->{email},
> );
> my $search_flags = {name=>$name,email=>$email};
> if ( defined $status and $status eq 'y' ) {
> $yeslist->{$name} = {email=>$email}
> if !scalar @{ $yeslist->{$search_flags} };
> }
> else {
> $nolist->{$name} = {email=>$email}
> if !scalar @{ $nolist->{$search_flags} };
> }
>}
>__END__
>
>You can then query or update any of the files with similar mechanisms,
>or you could use the companion DBD::AnyData module (formerly called
>DBD::RAM) and do all of the above with a DBI/SQL interface.
>
>AnyData is available at http://search.cpan.org/search?dist=AnyData.
>
>P.S. Take what I say with a grain of salt since I wrote the sucker and
>am not unbiased :-)
>
>--
>Jeff
Much appreciated this code serves my purpose :-)
Many thanks
Lawrence
--
http://www.f-deans.freeserve.co.uk
http://www.flytyer.co.uk
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1409
***************************************