[11685] in Perl-Users-Digest
Perl-Users Digest, Issue: 5285 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 2 14:04:56 1999
Date: Fri, 2 Apr 99 11:00:16 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 2 Apr 1999 Volume: 8 Number: 5285
Today's topics:
Re: ActivePerl win32 and fork() ?? Does it work on any <cassell@mail.cor.epa.gov>
Re: cant run perl from windows <cassell@mail.cor.epa.gov>
Re: Help... Running Perl on NT <jwarner@tivoli.com>
Re: How to remove repeated signs ? (Abigail)
Re: How to remove repeated signs ? <cassell@mail.cor.epa.gov>
Re: Number of hash entries... <cassell@mail.cor.epa.gov>
Re: Perl under AIX 4.2 and mod_perl segfaults (Jens-Uwe Mager)
Reading local files <adwats@spaceweb.com>
Running CGI scripts OFFLINE <matt@gapps.co.uk>
Re: Running CGI scripts OFFLINE <ddelikat@protix.com>
Re: Running CGI scripts OFFLINE (PB)
Re: Running CGI scripts OFFLINE <ijp@thornlea.force9.co.uk>
Re: Running CGI scripts OFFLINE (Danny Platt)
Re: Running CGI scripts OFFLINE <arunas@an!m.org>
Sending a email using PERL <JK@sandwell98.free-online.co.uk>
Simple perl question <rcj@lucent.com>
Re: simple request/question <cassell@mail.cor.epa.gov>
Re: simple request/question <jim@*nospam*network-2001.com>
Re: simple request/question <jim@*nospam*network-2001.com>
Re: Telnet+Router+Command+Output <cassell@mail.cor.epa.gov>
Re: Text::Soundex for languages other than English? (Jed Parsons)
Re: Text::Soundex for languages other than English? (Jed Parsons)
Very large regular expressions (Sean McAfee)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 02 Apr 1999 10:01:59 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: ActivePerl win32 and fork() ?? Does it work on any win platform?
Message-Id: <37050617.B8C5959E@mail.cor.epa.gov>
Davekonz wrote:
> Is fort() a working function on any win32 platform. I know it is not on win95.
> Does it work on win98 or NT ( lets say 4.0 or later )..
You mis-typed fork(), but fat-fingering is a common disorder. :-)
No, there is no fork() on any win32 platform. If you want, you could
download ActiveState's build 513 which has threads as an *experimental*
feature. Caveat utor. Don't use it for anything that's mission-critical.
> Also does perl have a defined lock ( semiphor (?)) as part of the lang?
Yes. Look up flock() in the perlfunc section. There you'll see a note
that WinNT enforces mandatory locking. I think this is a good thing,
given the number of win-based programs which don't play nice with other
children.
> Thanks
> davekonz
> Just trying to understand little by little.
HTH,
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 02 Apr 1999 10:32:50 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: cant run perl from windows
Message-Id: <37050D52.F8DAFB47@mail.cor.epa.gov>
mikecard@my-dejanews.com wrote:
> hi there
> i'm new to perl. i am making my first web site and i want to give it some
> interactivity, so i am trying to get my cgi scripts working before i put them
> online.
Good strategy. Have you checked out the nifty features of the CGI.pm
module which will help with this [once you get things working from the
command line]?
> i downloaded the perl program that runs on windows. i made a script very
> basic script called first.pl and i open up the perl program. from the
> command line i type perl first.pl and hit enter and nothing happens. how do
> i run perl from windows
You 'open up the perl program'? Does this mean you're doing something
other than what you say in the next 2 sentences?
Okay. If you get 'nothing' then there's something very wrong. If the
command processor can't find your executable, you ought to get a 'Bad
command or file name' error message. If perl runs and can't find your
program, it ought to give you a 'Can't open perl script "first.pl": No
such file or directory' error message. If you got neither of these,
then I need a little more info. Which perl? ActiveState build 509?
Did you let it do the default install? Is your path altered to pick
up your perl binary?
> mike cardeiro
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 02 Apr 1999 10:56:17 -0600
From: John Warner <jwarner@tivoli.com>
Subject: Re: Help... Running Perl on NT
Message-Id: <3704F6B1.F6A17C77@tivoli.com>
You need to be aware that the original instructions below apply _only_ to IIS 3 and
not to IIS 4. IIS 4 does _not_ use the registry as it has its own database.
Setting scripts to execute only is also different between 3 and 4.
Greg McCann wrote:
> You also need to configure your web server so that it knows to *execute* .pl
> files - not serve them as text files. You need to define either a certain file
> extension - such as "pl" or "cgi" - or a certain directory - like
> "myhome/cgi-bin" as containing cgi programs.
>
> Greg
>
> F. wrote:
>
> > Open regedit and follow this path:
> > HKEY_LOCAL_MACHINE, System, CurrentControlSet, Services, W3svc, Parameters,
> > ScriptMap
>
[stuff omitted]
> >
> > H.A. wrote in message <7dfta0$hgd$1@News.Dal.Ca>...
> > >I've been having so many trouble getting Perl script to run on my NT server
> > 4.0
> > >that about to quite :-( I configured everything right according to the
> > >instructions and the help I got from the newsgroup.
> > >
> > >The error I'm getting lately is simply when I click on Submit in one of my
> > HTML
> > >forms to run the .PL file, it opens a Save As window instead of executing
> > the
> > >script? Does anyone out there know why I'm getting that?
> > >
> > >
> > >Any help or hints will greatly be appreciated.
> > >Thanks
> > >
>
--
John Warner Tivoli Systems Inc.
Sales Support Engineer 9442 Capital Of Texas Hwy North
Sales Infrastructure Group Austin, TX 78759
john_warner@tivoli.com
------------------------------
Date: 2 Apr 1999 17:33:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to remove repeated signs ?
Message-Id: <7e2v0s$mk7$1@client2.news.psi.net>
Robert (beton@topnet.pl) wrote on MMXL September MCMXCIII in
<URL:news:Ci%M2.4780$_u5.636588@news.tpnet.pl>:
?? Hi,
??
?? for example how to:
??
?? ABBA -> ABA
?? WOOOOOOOOOOOOOOOOOOOOW -> WOW
s/(.)\1+/$1/g;
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
------------------------------
Date: Fri, 02 Apr 1999 10:11:15 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: How to remove repeated signs ?
Message-Id: <37050843.254AA069@mail.cor.epa.gov>
Robert wrote:
> Hi,
> for example how to:
> ABBA -> ABA
> WOOOOOOOOOOOOOOOOOOOOW -> WOW
You could do this with regular expressions, but tr/// is faster.
Look up tr/// in the perlop section [either use perldoc or the
html version] and you'll see that there is an example that does
exactly what you asked for here.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 02 Apr 1999 10:25:33 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Number of hash entries...
Message-Id: <37050B9D.62F82CA4@mail.cor.epa.gov>
David Delikat wrote:
>
> Louis Zuckerman wrote:
> >
> > Is there a way to have Perl return how many key/value pairs are in a
> > hash? I know that accessing an array like a csalar will do this, but it
> > doesn't seemto work for hashes.
> >
> > Thank you,
> > Louis Zuckerman
> > louis@trapezoid.com
>
> how about scalar(keys %hash)?
>
> perl -e 'print scalar(keys %ENV)'
>
> -->
>
> 18
>
> -dav
>
> PS. Hey Larry, I took your advice, cool.
>
> --
> <((((><
> Consultant: Internet, Database, Business Systems
> Unix/Linux, Windows95/NT
> mailto:david-delikat@usa.net / http://obj.webjump.com/
Dav, I'm glad to see you survived your 'trial by fire' and
decided to stick around. Welcome. we can use all the right
answers we can find.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 2 Apr 1999 16:56:37 GMT
From: jum@ra.han.de (Jens-Uwe Mager)
Subject: Re: Perl under AIX 4.2 and mod_perl segfaults
Message-Id: <slrn7g9ta6.2s5.jum@ra.han.de>
On Thu, 01 Apr 1999 20:29:09 GMT, Khelben Blackstaff
<khelben_blackstaff@my-dejanews.com> wrote:
>I'm using:
> IBM F50-RS/6000 PPC
> AIX 4.2.1 with Y2k-fixes
> gcc 2.8.1
> perl 5.005_02
> mod_perl 1.17
> mod_ssl 2.2.7
> mod_php 3.0.6
> apache 1.3.6
>
>I compiled perl with all modules as shared and it segfaults
>as i "perl Makefile.PL" of mod_perl.
Try egcs instead of gcc. Or use IBM's C compiler, I used it and I get no seg
faults.
--
Jens-Uwe Mager <pgp-mailto:62CFDB25>
------------------------------
Date: Fri, 2 Apr 1999 13:00:30 -0500
From: "Andy Watts" <adwats@spaceweb.com>
Subject: Reading local files
Message-Id: <zH7N2.806$eJ.144930@news.shore.net>
How does one get a perl script to read a local file from a computer?
I'm working on a perlscript for a remote NT server, and I have had severe
problems trying to read local files...
I've tried reading files in the way of "C:/Temp/filename.txt". I've also
tried both the read and open methods, as well as an $ftp->put and an
$FTP->Put, using the Win32::Internet and Net::FTP libraries. Both I have
manage to get working on moving files on the remote site... neither I have
been able to have much success with utilizing local files on a desktop.
Any ideas?
- Andy Watts
------------------------------
Date: Fri, 2 Apr 1999 18:49:54 +0100
From: "Matt" <matt@gapps.co.uk>
Subject: Running CGI scripts OFFLINE
Message-Id: <Vm7N2.1561$04.1243@stones>
I was wondering if there was any software about that would let you run CGI
scripts offline in a windows enviroment.
This would be very useful as it would save a lot of online testing
Please mail responses to :-
matt@gapps.co.uk
------------------------------
Date: Fri, 02 Apr 1999 11:53:11 -0600
From: David Delikat <ddelikat@protix.com>
To: Matt <matt@gapps.co.uk>
Subject: Re: Running CGI scripts OFFLINE
Message-Id: <37050407.2F1C@protix.com>
Matt wrote:
>
> I was wondering if there was any software about that would let you run CGI
> scripts offline in a windows enviroment.
>
> This would be very useful as it would save a lot of online testing
>
> Please mail responses to :-
>
> matt@gapps.co.uk
how about a perl web server, I believe I've seen at least one
in some of the archives.
-dav
--
<((((><
Consultant: Internet, Database, Business Systems
Unix/Linux, Windows95/NT
mailto:david-delikat@usa.net / http://obj.webjump.com/
------------------------------
Date: Fri, 02 Apr 1999 18:19:49 GMT
From: pboin@spam-me-not.erols.com (PB)
Subject: Re: Running CGI scripts OFFLINE
Message-Id: <37050a24.1329825@news.erols.com>
David Delikat in <37050407.2F1C@protix.com>:
>Matt wrote:
>>
>> I was wondering if there was any software about that would let you run CGI
>> scripts offline in a windows enviroment.
>>
>> This would be very useful as it would save a lot of online testing
>>
>> Please mail responses to :-
>>
>> matt@gapps.co.uk
>
>how about a perl web server, I believe I've seen at least one
>in some of the archives.
Or any web server for all that matters. I'm sure you can find at least one free
one at tucows: http://www.tucows.com
--
PB
------------------------------
Date: Fri, 2 Apr 1999 19:21:21 +0100
From: "Ian Porteous" <ijp@thornlea.force9.co.uk>
Subject: Re: Running CGI scripts OFFLINE
Message-Id: <GW7N2.1243$54.1185@wards>
yeah - if you're using perl for the scripts, then get a copy of perl and a
copy of a webserver (eg apache) and you can test stuff locally...
links are perl... www.perl.com or www.activestate.com
apache - www.apache.org
see FAQ for more info. www.thornlea.force9.co.uk
Ian
Matt wrote in message ...
>I was wondering if there was any software about that would let you run CGI
>scripts offline in a windows enviroment.
>
>This would be very useful as it would save a lot of online testing
>
>Please mail responses to :-
>
>matt@gapps.co.uk
>
>
>
------------------------------
Date: Fri, 02 Apr 1999 18:29:22 GMT
From: D_Platt@bigfoot.com (Danny Platt)
Subject: Re: Running CGI scripts OFFLINE
Message-Id: <37050b9e.18487890@usenet.force9.net>
On Fri, 2 Apr 1999 18:49:54 +0100, "Matt" <matt@gapps.co.uk> wrote:
>I was wondering if there was any software about that would let you run CGI
>scripts offline in a windows enviroment.
>
>This would be very useful as it would save a lot of online testing
>
>Please mail responses to :-
>
>matt@gapps.co.uk
>
>
>
I use Activestate Perl <http://www.activestate.com/ActivePerl/> and
the win32 port of Apache server <http://www.apache.org/> and they work
fine... once you get them to work at all ;)
Later Dan
Later Dan
-
http://www.skd.clara.net
I'll get my coat.
------------------------------
Date: Fri, 2 Apr 1999 11:34:22 -0700
From: "Arunas Salkauskas" <arunas@an!m.org>
Subject: Re: Running CGI scripts OFFLINE
Message-Id: <37050e26.0@news.cadvision.com>
It's easy enough to install Apache on pretty much any system, this gives you
everything you can wish for, including cgi, and real web-server behaviour so
that you get all the appropriate environment variables. It's also about 10%
the size of any of the commercial servers
http://www.apache.org/
--
- Arunas Salkauskas
High Point Designs
www.highpointdesigns.com
Matt wrote in message ...
>I was wondering if there was any software about that would let you run CGI
>scripts offline in a windows enviroment.
>
>This would be very useful as it would save a lot of online testing
>
>Please mail responses to :-
>
>matt@gapps.co.uk
>
>
>
------------------------------
Date: Fri, 2 Apr 1999 18:04:50 +0100
From: "Sandwell" <JK@sandwell98.free-online.co.uk>
Subject: Sending a email using PERL
Message-Id: <yO6N2.1536$04.1237@stones>
I am writing a script which requires sending a email to the web master. I
have tried the following script, without much luck. I have pasted the FULL
script, if you could be give me an ideas??
#!/usr/bin/perl -w
$to='graeme\@sandwell98.free-online.co.uk';
$from='graeme\@sandwell98.free-online.co.uk';
$subject='Thank you for your inquiry';
$text='Dear reader\n\nThank you for your recent inquiry.';
&email($to,$from,$subject,$text);
sub email {
local($to,$from,$sub,$letter) = @_;
$to=~s/@/\@/;
$from=~s/@/\@/;
open(MAIL, "|/usr/sbin/sendmail") || die
"Content-type: text/text\n\nCan't open /usr/lib/sendmail!";
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $sub\n";
print MAIL "$letter\n";
Thank-You for you help,
------------------------------
Date: Fri, 02 Apr 1999 11:42:59 -0600
From: "Raymond C. Jender" <rcj@lucent.com>
Subject: Simple perl question
Message-Id: <370501A3.7B9A4E99@lucent.com>
Ok, I have done something like the following:
read input name/value pairs into %in
@tmp = %in
I can print $tmp[0] just fine but if I do
$name = $tmp[0] printing $name returns zilch!!
I've seen examples of this in Learning Perl or
Perl by Example....They do it the same way!
What gives??
Ray Jender
------------------------------
Date: Fri, 02 Apr 1999 09:45:48 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: simple request/question
Message-Id: <3705024C.8C363F@mail.cor.epa.gov>
Jim wrote:
> I'm pretty new to perl (gee, isnt it amazing how many posts in here start
> out like that?)..
Well, you can't be *too* new if you've been reading this newsgroup.
> and I need to do something that I cannot find any
> reference to in the perl documentation.
Everything is in the docs. But sometimes you have to know the docs
to find the 'thing'.
> It's fairly simple, all I want to do is add all the values between %7C and
> %5E together from this string below
>
> http://www.domain.com/script.cgi?calc=calc&case=pig%7C98.07%5E&cee2u=r+ix%7C
> 12.21%5E&board=22three95%7C12.21%5E&s_u_b_m_i_t=Calculate
So you want to pick things out of a string. That should say 'regular
expression' to you.
> I need to generically be able to add those numbers together without having
> to specify a specific amount of numbers to add together or anything else.
my $total = 0; # assuming you 'use strict' as you ought to
$total += $1 while ( /%7C([0-9.]+?)%5E/g )
> Thanks for any help,
HTH,
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 2 Apr 1999 12:36:12 -0600
From: "Jim" <jim@*nospam*network-2001.com>
Subject: Re: simple request/question
Message-Id: <7e32m4$rdm$1@news3.infoave.net>
Thanks very much!
Jim
Ronald J Kimball <rjk@linguist.dartmouth.edu> wrote in message
news:1dpm01t.18zwxoerwe4yoN@[207.60.170.137]...
| "Jim" <syt@email*@sp\am|@|spa/m@*.com> wrote:
|
| > It's fairly simple, all I want to do is add all the values between
%7C and
| > %5E together from this string below
| >
| >
http://www.domain.com/script.cgi?calc=calc&case=pig%7C98.07%5E&cee2u=r+i
x%7C
| > 12.21%5E&board=22three95%7C12.21%5E&s_u_b_m_i_t=Calculate
| >
| > I need to generically be able to add those numbers together without
having
| > to specify a specific amount of numbers to add together or anything
else.
|
| Use a regex to grab all the numbers between '%7C' and '%5E', and then
| simply add them together.
|
|
| $_ = 'http://www.domain.com/script.cgi?calc=calc&case=pig' .
| '%7C98.07%5E&cee2u=r+ix%7C12.21%5E&board=22three95%7C12.21%5E' .
| '&s_u_b_m_i_t=Calculate';
|
| $sum = 0;
|
| while (/%7C([\d.]+)%5E/gi) {
| $sum += $1;
| }
|
| --
| _ / ' _ / - aka -
| ( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
| /
http://www.tiac.net/users/chipmunk/
| "It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Fri, 2 Apr 1999 12:36:26 -0600
From: "Jim" <jim@*nospam*network-2001.com>
Subject: Re: simple request/question
Message-Id: <7e32mh$3sg$1@news3.infoave.net>
Thanks, it works
Jim
David L. Cassell <cassell@mail.cor.epa.gov> wrote in message
news:3705024C.8C363F@mail.cor.epa.gov...
| Jim wrote:
| > I'm pretty new to perl (gee, isnt it amazing how many posts in here
start
| > out like that?)..
|
| Well, you can't be *too* new if you've been reading this newsgroup.
|
| > and I need to do something that I cannot find any
| > reference to in the perl documentation.
|
| Everything is in the docs. But sometimes you have to know the docs
| to find the 'thing'.
|
| > It's fairly simple, all I want to do is add all the values between
%7C and
| > %5E together from this string below
| >
| >
http://www.domain.com/script.cgi?calc=calc&case=pig%7C98.07%5E&cee2u=r+i
x%7C
| > 12.21%5E&board=22three95%7C12.21%5E&s_u_b_m_i_t=Calculate
|
| So you want to pick things out of a string. That should say 'regular
| expression' to you.
|
| > I need to generically be able to add those numbers together without
having
| > to specify a specific amount of numbers to add together or anything
else.
|
| my $total = 0; # assuming you 'use strict' as you ought to
| $total += $1 while ( /%7C([0-9.]+?)%5E/g )
|
| > Thanks for any help,
|
| HTH,
| David
| --
| David L. Cassell, OAO cassell@mail.cor.epa.gov
| Senior computing specialist
| mathematical statistician
------------------------------
Date: Fri, 02 Apr 1999 10:23:48 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Telnet+Router+Command+Output
Message-Id: <37050B34.FC809CAB@mail.cor.epa.gov>
kamez@my-dejanews.com wrote:
> i wanna telnet to a router, checkout its interfaces status, and if they're
> down , email the network administrator.
Good. How does this relate to Perl? If you want to write this in Perl,
I'll give you a few pointers. But you'll have to do the programming.
> But i need to know how to get the result of my command on the router prompt
> ,in a file , that i can send on email ?
>
> what that implies technically in terms of instructions, since the script
> has to do all that automatically : connection + command + output in a file +
> email.
Easy in Perl. Go to CPAN for modules that do telnet and mail for you. Then
read up on the use of backticks [meaning these guys: ``] for capturing the
output of an external command.
> Thanks a lot for you help guys.
> Khalid.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 2 Apr 1999 17:51:08 GMT
From: jed@socrates.berkeley.edu (Jed Parsons)
Subject: Re: Text::Soundex for languages other than English?
Message-Id: <7e302c$hs8$1@agate.berkeley.edu>
It's for a program to look up similar-sounding entries in a database of
dictionary words, letting the user pick the right match from the list
of close matches. This is handy for two big reasons. First, I want words
with a different inflected ending to be recognized, e.g., aquae sounds like
aqua. (Though with the implementation of soundex as it is, aquarum, does not
sound like aqua.) Second, it leaves it open for the user to decide based
on context whether, e.g., populus is populus (f) `poplar tree' or populus (m)
`the people,' or whether cum is a preposition or a conjunction.
This is part of a larger project that accepts a list of input files in a
generic (XML compliant) markup, and outputs a book in TeX or HTML (RTF to
come). The book has lists of new vocabulary at the end of each chapter,
and a master list of all words used at the end. I found the easiest way to
keep track of whether a word was being used for the first time was to include
a unique identifying integer for each entry in my master dictionary file.
This id number is inserted with each latin word in each input file, either
manually or with the help of the fuzzy matcher. From then on, whenever the
book-generating program reads these files, it will compare id's it comes
across with a hash of id's already seen, and act accordingly. (The
dictionary file is itself written in a markup language, and can use the
same reference tags, so printing one dictionary entry can require others that
have not been learned by the reader.)
The idea behind this whole thing is to allow instructors or students to
make up their own textbooks by selecting grammar and reading modules from
a large collection, and putting them in the order they want. Modules can
be written by anyone, which will hopefully mean that, e.g., a person really
good at explaining the passivization of impersonal verbs will write the module
for that. It also means that a course can be freed from the constraints of
a textbook that will undoubtedly present many topics in an order the
instructor does not like, and many readings the instructor does not want
to read. (As an aside, my tex macros use EDMAC, which prints nice critical
editions, and the markup language for texts is designed to handle ap crit
variants and notes.)
(If anyone wants to write a module, let me know :)
So far, I have good output with TeX and HTML. I'll add RTF for my Word-
dependent colleagues. I do not have a nice editor yet, so markup still
has to be done by hand. Once an editor is done, I might be able to get
some classicists' and historians' help (and archaeologists, linguists, etc).
Jed
--
Jed Parsons: ``Lingua balbus, hebes ingenio
Harpsichordist, Classicist, Homebrewer. Viris doctis sermonem facio.''
mailto:jed@socrates.berkeley.edu -- Archipoeta
http://www.OCF.Berkeley.EDU/~jparsons/
------------------------------
Date: 2 Apr 1999 17:55:21 GMT
From: jed@socrates.berkeley.edu (Jed Parsons)
Subject: Re: Text::Soundex for languages other than English?
Message-Id: <7e30a9$ikm$1@agate.berkeley.edu>
In article <3703D059.9618CF8E@mail.cor.epa.gov>,
David L. Cassell <cassell@mail.cor.epa.gov> wrote:
>You might want to start with the soundex algorithm in Knuth. It may not be
>at all what you're hoping for. It doesn't 'match' words so much as hash all
>words into a small space.
Right, I know. Sorry if I was vague. The hash by the fuzzy sound-alike
algorithm is exactly what I want. I think I will have to go to Knuth
and adapt the code of Text::Soundex to suit my needs better.
Thanks for the advice,
Jed
--
Jed Parsons: ``Lingua balbus, hebes ingenio
Harpsichordist, Classicist, Homebrewer. Viris doctis sermonem facio.''
mailto:jed@socrates.berkeley.edu -- Archipoeta
http://www.OCF.Berkeley.EDU/~jparsons/
------------------------------
Date: Fri, 02 Apr 1999 17:42:11 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Very large regular expressions
Message-Id: <Tj7N2.987$9Y5.4714916@news.itd.umich.edu>
I was recently assigned the task of processing mail messages based on a
template, with details filled in by users. As a simplified example, the
template might look something like this:
( ) Telephone
( ) Correspondence
( ) Other
Name:
Address:
# and so on, for about thirty more lines and as many fields
After being filled in, the finished message might look like this:
( ) Telephone
( x ) Correspondence
( ) Other
Name: Crow T. Robot
Address: Satellite of Love
# etc.
I wanted to be forgiving of possible extra whitespace inserted by the person
filling out the form. I decided that I couldn't just do a series of
matches against each particular field, ie
($address) = $letter =~ /Address:\s*(.*)/;
...because in the event that the "Address:" string occurred more than once
in the form, I wouldn't have any way of getting the second one. So, my
first approach was to write a huge regular expression matching the entire
form:
@fields = qw(flag_telephone flag_correspondence flag_other name address ...);
@info{@fields} = $letter =~ m%^
\( \s* (\S?) \s* \) \s* Telephone \s* \n
\( \s* (\S?) \s* \) \s* Correspondence \s* \n
\( \s* (\S?) \s* \) \s* Other \s* \n
Name: (.*?) \n
Address: (.*?) \n
# and so on, for about thirty more lines
$%xs;
The problem is that if a given letter *doesn't* match the form, the program
spins its wheels doing all of the *-quantifier backtracking prior to the
point where the match initially failed. If this happens towards the end of
the string, the backtracking can take a very long time.
The solution I came up with involved breaking the huge regex up into many
smaller regexen, then matching against them incrementally:
$form = <<'EOT';
\( \s* (\S?) \s* \) \s* Telephone \s* \n
\( \s* (\S?) \s* \) \s* Correspondence \s* \n
\( \s* (\S?) \s* \) \s* Other \s* \n
Name: \s* ((?:(?!Address:).)*) \s* \n
Address: \s* ((?:(?!State:).)*) \s* \n
...
EOT
# (The "\s*((?:(?!next_field).)*)\s*" construct appears so often that I
# developed a shorthand notation for it, but that's not relevant at the
# moment.)
sub parse_form ($$\@) {
my ($letter, $form, $keys) = @_;
my ($n, $i, %hash) = 0;
my @regex = map qr/^$_/xs, split /\n/, $form;
foreach $regex (@regex) {
return unless $letter =~ $regex;
# Extract the contents of the capturing parentheses:
for ($i = 1; defined $$i; $i++) {
$hash{$keys->[$n++]} = $$i;
}
$letter = $';
}
\%hash;
}
parse_form($letter, $form, @fields);
Some care is required in writing the form regex such that all form fields are
matched successfully, even when optional.
Comments? Can anything think of a different/better way to attack this
problem? It did occur to me that a hypothetical regex feature that would
have helped greatly is an instruction to the evaluation engine not to
backtrack past a given point once the prior portion of the regex has
matched successfully. My knowledge of how the regex engine works is only
superficial, so I don't know how difficult it would be to implement this
instruction.
--
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
| K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
| tv+ b++ DI++ D+ G e++>++++ h- r y+>++** | umich.edu
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5285
**************************************