[9806] in Perl-Users-Digest
Perl-Users Digest, Issue: 3399 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 9 01:07:33 1998
Date: Sat, 8 Aug 98 22:00:17 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 8 Aug 1998 Volume: 8 Number: 3399
Today's topics:
a possibly useful Perl program. <jbn@mygale.org>
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in (Marek Jedlinski)
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in (Marek Jedlinski)
Binary pattern matching webmaster@schnibitz.hypermart.net
Re: Binary pattern matching <rlogsdon@io.com>
Re: But what about "baz"? (Was: "foo" and "bar") <REPLY_TO_lastronin@earthlink.net>
Re: Can't make flock work as described... <dld@degeorge.org>
CGI.pm TEMP files not deleted on NT after file upload <tbeaulieu@mediaone.net>
Re: Converting Excel Spreadsheet to the text file ? <Russell_Schulz@locutus.ofB.ORG>
Dressed for XS: The MacPerl Toolbox Interface Modules (Rich Morin)
Re: Good Book? <tbeaulieu@mediaone.net>
Re: Help Help Please Help ! <rick.delaney@shaw.wave.ca>
Re: Help Help Please Help ! <rick.delaney@shaw.wave.ca>
Help with regular expression (Awrobinson)
Re: Help with regular expression (Michael J Gebis)
Re: Help with regular expression (Larry Rosler)
Re: Help with regular expression (Craig Berry)
Re: Help with regular expression (Awrobinson)
Re: Is Perl Year 1999 Compliant??? <Russell_Schulz@locutus.ofB.ORG>
Mail attachments in NT w/o sendmail, blat, etc... <laurie@eclipse.net>
Re: sorting hash by values <da96mjn@torun.ing.umu.se>
Re: sorting hash by values (Mark-Jason Dominus)
Suggestions for a cond_timedwait() equivalent? <ged@FaerieMUD.org>
Re: unwanted CR/LF translation in FILE UPLOAD <tbeaulieu@mediaone.net>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 04 Aug 1998 13:51:59 -0400
From: Jean-Baptiste <jbn@mygale.org>
Subject: a possibly useful Perl program.
Message-Id: <35C74A3F.FF03C15E@mygale.org>
Hi everyone,
i just finished up (meaning that it is mostly working) a small Perl
script that generates (and then compiles) a C file that embeds your
script
with a Perl interpreter, thus allowing you to distribute binary versions
of
your scripts (for instance when the end-users do not have Perl installed
on
their machines). Note that if you link each time with a static library,
you'll
end up with a collection of bloated programs instead of tiny little
scripts!
Note also that it is not intended to allow people to hide their Perl
code
(since you can always look at the Perl source inside the binary
file...).
It still could use some more work, especially to make it include all the
packages that your script uses to really produce a standalone executable
file..
Tell me what you think (even if you do not like the idea..).
jb.
URL: http://www.mygale.org/~jbn/software/packager.pl
------------------------------
Date: Sat, 08 Aug 1998 23:46:36 GMT
From: cicho@polbox.com (Marek Jedlinski)
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <35cce286.28045368@news.nask.org.pl>
Keywords: If you're happy and you know it, clunk your chains.
nvp@shore.net (Nathan V. Patwardhan) wrote:
>: In comp.lang.perl.misc,
>: cicho@polbox.com (Marek Jedlinski) writes:
>: :Suggested solution: since gzip is unix-centric anyway, please provide a
>: :.zip archive version as well.
>
>Bologna. Get Winzip and be happy. AND if you've got a working Perl,
>you'll have the benefit of both Compress::Zlib and Archive::Tar which
>should work under Win32. The CPAN module can/will invoke these when
>you download/install modules.
I *am* happy. I can deal with .tar.gz myself (and have used CPAN modules
before, though I always convert the ones I download into zip files locally
for archiving). I can even deal with http servers sending .tar.gz as
text/plain :) But a few others have had problems with this, so I suggested
a solution. Tom's point about the number of files in CPAN is well taken, of
course.
.marek
--
General Frenetics, Discorporated: http://www.lodz.pdi.net/~eristic/
People must not do things for fun. We are not here for fun. There is
no reference to fun in any Act of Parliament.
------------------------------
Date: Sat, 08 Aug 1998 23:46:39 GMT
From: cicho@polbox.com (Marek Jedlinski)
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <35cde29f.28071129@news.nask.org.pl>
Keywords: If you're happy and you know it, clunk your chains.
ncarey@harlequin.com (Nicholas Carey) wrote:
>> Netscape certainly honors content-encoding (in other cases) when it knows
>> how to handle it. Since windoze systems don't normally know about gzip,
>> Netscape cannot but display it as plain text. However, if Content-*Type*
>> was set to something like "compressed/gzip" then Netscape would ask how to
>> handle it, and I could point it to gzip.exe on my disk.
>>
>> Suggested solution: since gzip is unix-centric anyway, please provide a
>> .zip archive version as well.
>
>Where do you get this idea that gzip is unavailable on Windows?
Uh, where do *you* get the idea I said it wasn't? Please read the bit of my
post (quoted above) about "gzip.exe on my disk" again, thanks :)
>So speak for yourself -- The only problems I've encountered with *.gz
>(and yes, *.zip as well) files have to do with sites that tag these
>files incorrectly.
Absolutely so.
.marek
------------------------------
Date: Sat, 08 Aug 1998 17:25:26 -0700
From: webmaster@schnibitz.hypermart.net
Subject: Binary pattern matching
Message-Id: <35CCEC76.773B3E17@schnibitz.hypermart.net>
Hi all,
A quick question. I have set up a perl-based proxy server (don't
laugh). I set it up to filter rogue HTML code, and rogue javascript.
With perl's pattern matching it is not that difficult to do. But, what
about Java (re: not javascript). Java is transmitted as binary and can
contain rogue code too. Is there any way to make perl detect it?
Here is why I ask. I once set up the server so it would print the
traffic to my shell screen (in raw form) as it is being transmitted from
the server to the client. When a binary such as a JPG was being
transmitted, understandibly a whole bunch of garbled characters would
fly across my screen. I wonder if there is any way to make perl do
pattern patching with that garble? Or is there an easier way?
~Prime
------------------------------
Date: Sat, 8 Aug 1998 19:58:48 -0500
From: REUBEN LOGSDON <rlogsdon@io.com>
To: webmaster@schnibitz.hypermart.net
Subject: Re: Binary pattern matching
Message-Id: <Pine.BSI.3.96.980808195009.18493C-100000@pentagon.io.com>
Well, you can do pattern matching on some binary data. As I understand
it, the binary data is treated as text for some pattern matching purposes.
When I cat a JPG, I get a bunch of garbage, some of which looks like
normal ascii characters, and I can successfully match these characters:
$pat = 'some ascii-looking charcters';
open(F,"<file.jpg") or die $!;
binmode(F);
while (<F>) {print "match: $_" if m/$pat/}
close(F);
If you are looking for non-standard characters, like chr(21), you can't
just paste that into your $pat string. You have to do something like:
$pat = chr(21).chr(4).chr(3); # etc.
But this does work.
As to knowing which strings of binary java code are dangerous and which
are safe... I have no clue.
Regards,
Reuben Logsdon
On Sat, 8 Aug 1998 webmaster@schnibitz.hypermart.net wrote:
> Hi all,
> A quick question. I have set up a perl-based proxy server (don't
> laugh). I set it up to filter rogue HTML code, and rogue javascript.
> With perl's pattern matching it is not that difficult to do. But, what
> about Java (re: not javascript). Java is transmitted as binary and can
> contain rogue code too. Is there any way to make perl detect it?
> Here is why I ask. I once set up the server so it would print the
> traffic to my shell screen (in raw form) as it is being transmitted from
> the server to the client. When a binary such as a JPG was being
> transmitted, understandibly a whole bunch of garbled characters would
> fly across my screen. I wonder if there is any way to make perl do
> pattern patching with that garble? Or is there an easier way?
> ~Prime
>
>
>
------------------------------
Date: Sat, 8 Aug 1998 22:15:32 -0400
From: "Ha" <REPLY_TO_lastronin@earthlink.net>
Subject: Re: But what about "baz"? (Was: "foo" and "bar")
Message-Id: <6qj03v$b2a$1@oak.prod.itd.earthlink.net>
A stab in the dark....
bar. 2. An excuse; a yarn, a 'tale': Army, but esp. in the Guards: since
ca. 1910. Kersh, 1942, 'He had a good bar though, it was on his pass. He'd
been trying to get some geezer out of a shelter'; Grinstead, 1943 and 1946,
records soft bar (a persuasive story)... 5. In can't stand or won't or
wouldn't have a bar of, to detest; deny or reject; to beunable to terate:
Aus. Ccoll.: since the 1930s. Trist, 1945; Buzo, 1969, where Bentley
remarks, 'The block got all excited...syaing it was Hammo's fault..Hammo
wouldn't have a bar of that. "My fault?" he said, "That's a laugh."'
phooey! An expression of utter disbelief or pronounced distaste or even,
contempt. Adopted, ca. 1959, ex. US. Deriving ex the Yiddish form of German
pfui and popularised by Walter Winchell during the 1930s.
okay, here's a distant resemblance.... i can't draw ascii art worth a
darn...
Phoo, aka Chad. 'The British Services' counterpart of Kilroy.. is known
variously as Chad, Flywheel, Clem, Private Snoops, the Jeep, or just Phoo.
His chalked-up picture is always accompanied by the theme song: "What
no...?"' (a newspaper cutting, 17 Nov. 1945). The 'picture', a rudimentary
cartoon, showed the semicurcular top of a head above the top of a brick
wall, its single strand of hair in the form of a question mark, its eyes
mere crosses, and anose drooping over the edge of the wall-top; sometimes a
hand cluted the wall-top on each side of the 'head'. (Mr) Chad was mostly
RAF the RN, the Watcher.
and, of course...
fu-fu, aka foo-foo. foo-foo valve. 'A mythical "gadget" that's always blamed
for any mechanical break-down' (Granville, letter, 1947): RN since ca.1910.
foo. A favourite gremlin: RAAF: ca. 1941-45. Arbitrary, though perhaps with
a pun on FOO, a Forward Observation Officer. Baker, 1943, less precisely
writes: 'A fictitious person to whom all lapses and bungling are attributed'
and classifies it as general war slang: whence fooism, a saying, or an
exploit, attributed to Foo. Or perhaps, ex a popular US cartoon strip called
'Smokey Storer': there, the 'hero' used it as a stop-gap name for anything
for which he wouldn't be bothered to find the correct word.
once we dig deeper....
gremlin. A mischievous sprite that, haunting aircraft, deludes pilots:
airmen's: since late 1920s. Mr Watson remembers that gremlins could even be
helpful on occasioon; they were 'resonsible for all unaccountable
happeningsgood or bad'.
oddly, when we look up the following, we find something fascinating...
ooja-ka-piv or ooja-ka (or cum)-pivvy, the later being the original
corruption, is prob. a corruption of the nautical hook-me-dinghy or else ex
Hindustani (as Manchon says); military, earlier C.20, it means a
'gadget'anything with a name that one cannot at the moment recall. Further
corruptions wee ooja-cum-spiff and, later still, oojiboo.
Beale, Paul, ed. A Concise Dictionary of Slang and Unconventional English.
New York: Macmillan, 1989.
Sorry if these were way off the path. I though they might shed some light
(or more obfuscation?). i'll stick w/ what everyone else says. .. f***cked
up beyond recognition.
cheers,
ha quach
mailto:info@r-go.com
Russ Allbery wrote in message ...
>Jon Bell <jtbell@presby.edu> writes:
>
>> I've probably seen the "foobar" etymology as often as anyone else in
>> this group, I guess, but I still don't know where "baz" came from. You
>> don't see "baz" as often as "foo" and "bar", but it occurs often enough
>> in connection with the other two that there must be a story behind it.
>
>The Jargon File is your friend. <URL:http://www.ccil.org/jargon/>
>
>:baz: /baz/ n. 1. The third {metasyntactic variable} "Suppose we have
> three functions: FOO, BAR, and BAZ. FOO calls BAR, which calls
> BAZ...." (See also {fum}) 2. interj. A term of mild annoyance. In this
> usage the term is often drawn out for 2 or 3 seconds, producing an
> effect not unlike the bleating of a sheep; /baaaaaaz/. 3. Occasionally
> appended to {foo} to produce `foobaz'.
>
> Earlier versions of this lexicon derived `baz' as a Stanford corruption
> of {bar}. However, Pete Samson (compiler of the {TMRC} lexicon)
> reports it was already current when he joined TMRC in 1958. He says
> "It came from "Pogo". Albert the Alligator, when vexed or outraged,
> would shout `Bazz Fazz!' or `Rowrbazzle!' The club layout was said to
> model the (mythical) New England counties of Rowrfolk and Bassex
> (Rowrbazzle mingled with (Norfolk/Suffolk/Middlesex/Essex)."
>
>--
>#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
>$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
> 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
>rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sun, 09 Aug 1998 01:26:09 +0000
From: David DeGeorge <dld@degeorge.org>
Subject: Re: Can't make flock work as described...
Message-Id: <35CCFAB1.A0A9A7B4@degeorge.org>
I did see the code that was posted and what Tom means (putting words in
his mouth) is that after one process has flocked the file a competing
process also has to call flock. An open and a subsequent write on an
flocked file will succeed but another flock will either block or return
with an error depending on the call. So cooperation between the
processes is necessary i.e. each needs to check the lock by calling
flock.
David
------------------------------
Date: Sat, 8 Aug 1998 17:43:23 -0400
From: "Todd B" <tbeaulieu@mediaone.net>
Subject: CGI.pm TEMP files not deleted on NT after file upload
Message-Id: <6qigt3$nr5$1@wbnws01.ne.highway1.com>
FAQ says to make sure to close the file as a solution to this. i am
definately closing the file, but they still remain in the temp dir.
i suppose i will attempt to retrieve the filename and manually delete it
after processing it.
anyone seen this behavior and have the real solution, or understand how it
is supposed to be deleted automatically?
------------------------------
Date: Sat, 8 Aug 1998 15:21:13 -0400
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: Converting Excel Spreadsheet to the text file ?
Message-Id: <19980808.152113.9A3.rnr.w164w_-_@locutus.ofB.ORG>
Marian Zurek <ln02g@london.waii.com> writes:
> Could anyone help me in converting Excel Spreadsheet into
> raw-text file.
Excel will do it.
> I'd like to avoid running the application and perform that
> from command line using Perl/Awk/Shell/XXX script under the UNIX
> environment.
see these in the comp.apps.spreadsheets FAQ:
7.2.4 Herbert, a free platform independent MS Excel to HTML convertress
13.0 General References
The File Formats Handbook
Excel binary interchange format (BIFF)
13.7 Excel formats
The FAQ list for comp.apps.spreadsheets can be found on the Internet:
<ftp://rtfm.mit.edu/pub/usenet/comp.apps.spreadsheets/faq>
<http://www.faqs.org/faqs/spreadsheets/faq/>
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: Sun, 9 Aug 1998 03:12:02 GMT
From: rdm@cfcl.com (Rich Morin)
Subject: Dressed for XS: The MacPerl Toolbox Interface Modules
Message-Id: <rdm-0708981308170001@140.174.42.30>
The San Francisco Perl Users Group presents-
Dressed for XS: The MacPerl Toolbox Interface Modules
Matthias Neeracher - August 25, 1998
San Francisco Perl Users Group
The MacPerl interface to the Mac OS toolbox allows Perl programmers to
use more than 2000 constants and 1300 API calls from the Mac OS Toolbox.
It is one of the biggest published sets of Perl XS (eXternal Subroutine)
and interface code: 22000+ lines of XS code, 15000+ lines of Perl code.
MacPerl's Toolbox modules cover a wide range of capabilities, including
file and memory management, Apple Events, multimedia (Sound, Speech, and
Video output), and more.
Matthias will first discuss how to use the MacPerl Toolbox modules to:
- Write simple applications
- Prototype user interfaces
- Explore complex Toolbox modules
He will then cover the design and implementation of MacPerl's Toolbox
modules, discussing:
- The transformation of Pascal/C-oriented calling conventions into a
style more natural to Perl.
- The mapping of struct/record types into Perl.
- The construction of a simple application framework and other higher-
level facilities on top of the raw toolbox functionality.
Details:
PLEASE RSVP to matt@saturn5.com
PLEASE RSVP to matt@saturn5.com
(Did I mention that I need an RSVP?)
Date: August 25, 1998
Time: 8 pm
Place: 600 Townsend St., first floor meeting room
P.S. Donations will be happily accepted to help offset the cost
of the beer and munchies!
This event is produced by the San Francisco Perl Users Group, an
informal organization of perl geeks who like to talk about... uh...
well... perl. See http://www.pootpoot.com/sfpug for details.
This event is sponsored by InterShop Communications, one of the few
eCommerce shops in this area that's actually doing well. They're
entirely perl-based, and are a pretty hip place to work. See
http://www.intershop.com for more information.
Finally, please direct any questions or comments about this posting
to "Matthew D. P. K. Lanier" <matt@saturn5.com>.
--
Canta Forda Computer Laboratory | Prime Time Freeware - quality
UNIX consulting, training, & writing | freeware at affordable prices
+1 415-873-7841 | +1 408-433-9662 -0727 (Fax)
Rich Morin, rdm@cfcl.com | www.ptf.com, info@ptf.com
------------------------------
Date: Sat, 8 Aug 1998 17:48:20 -0400
From: "Todd B" <tbeaulieu@mediaone.net>
Subject: Re: Good Book?
Message-Id: <6qih6c$nuf$1@wbnws01.ne.highway1.com>
i highly doubt you spend most of your day fixing code that is caused by
incorrect advice gleaned from books.
------------------------------
Date: Sun, 09 Aug 1998 03:37:34 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Help Help Please Help !
Message-Id: <35CD1AE3.B8BE21F@shaw.wave.ca>
Neil Kandalgaonkar wrote:
>
> This will also do what you want:
>
> @x = (0,1,2,3,4,5);
> @xx = map (($_, $_), @x);
Or, as long as you're throwing x's around,
@xx = map $_ x 2, @x;# should be a bit faster
> print join ("", @xx) . "/n";
>
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sun, 09 Aug 1998 04:10:24 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Help Help Please Help !
Message-Id: <35CD229C.658B724D@shaw.wave.ca>
Rick Delaney wrote:
>
> Neil Kandalgaonkar wrote:
> >
> > This will also do what you want:
> >
> > @x = (0,1,2,3,4,5);
> > @xx = map (($_, $_), @x);
>
> Or, as long as you're throwing x's around,
>
> @xx = map $_ x 2, @x;# should be a bit faster
^^^^^^
Oops, it's actually a lot _slower_.
>
> > print join ("", @xx) . "/n";
> >
I originally included the join in my benchmark, which masked the
slowness of the map since there are half as many elements in @xx with my
map. However, it is a bit faster if you need the join. Here's a
benchmark of these two, plus one with no join.
use Benchmark;
timethese(100000, {
mapx => sub {
@x = (0,1,2,3,4,5);
@xx = map $_ x 2, @x;
$x = join ("", @xx) . "\n";
},
map2 => sub {
@x = (0,1,2,3,4,5);
@xx = map (($_, $_), @x);
$x = join ("", @xx) . "\n";
},
catx => sub {
$x = "";
@x = (0,1,2,3,4,5);
for (@x) { $x .= $_ x 2 }
},
});
--
Benchmark: timing 100000 iterations of catx, map2, mapx...
catx: 18 secs (18.73 usr 0.00 sys = 18.73 cpu)
map2: 51 secs (50.72 usr 0.00 sys = 50.72 cpu)
mapx: 40 secs (39.90 usr 0.00 sys = 39.90 cpu)
YMMV
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: 9 Aug 1998 01:36:31 GMT
From: awrobinson@aol.com (Awrobinson)
Subject: Help with regular expression
Message-Id: <1998080901363100.VAA20228@ladder01.news.aol.com>
I'm trying to parse table rows in a pathological html document. The document
doesn't have any closing tags for <table>, <tr>, <th>, or <td>. This is what I
tried that did not work:
while ( $html =~ m#(<tr>.*?)<tr>)#gs ) {
# do stuff
}
It picks up every other row because I have run past the beginning of the row
tag with the second "<tr>". Is there a way to tell perl to 'put back' the four
characters before continuing the match? How should I be doing this?
Thanks!
Andrew Robinson
Andrew Robinson
---
Disclaimer: The opinions expressed are mine alone and do not represent the
views of America Online
------------------------------
Date: 9 Aug 1998 01:47:12 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Help with regular expression
Message-Id: <6qiv30$26n@mozo.cc.purdue.edu>
awrobinson@aol.com (Awrobinson) writes:
}I'm trying to parse table rows in a pathological html document. The document
}doesn't have any closing tags for <table>, <tr>, <th>, or <td>. This is what I
}tried that did not work:
} while ( $html =~ m#(<tr>.*?)<tr>)#gs ) {
} # do stuff
} }
}It picks up every other row because I have run past the beginning of the row
}tag with the second "<tr>". Is there a way to tell perl to 'put back' the four
}characters before continuing the match? How should I be doing this?
Look up "lookahead" in the man pages (or for true insights, Friedl's
Mastering Regular Expressions.) Then use it.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Sat, 8 Aug 1998 19:18:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help with regular expression
Message-Id: <MPG.1036a6e937b3f9189897bd@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <1998080901363100.VAA20228@ladder01.news.aol.com> on 9 Aug
1998 01:36:31 GMT, Awrobinson <awrobinson@aol.com> says...
> I'm trying to parse table rows in a pathological html document. The document
> doesn't have any closing tags for <table>, <tr>, <th>, or <td>. This is what I
I'll bet it has </table> or it wouldn't display at all.
> tried that did not work:
>
> while ( $html =~ m#(<tr>.*?)<tr>)#gs ) {
> # do stuff
> }
You couldn't have tried exactly that, because the parentheses don't
match. However...
> It picks up every other row because I have run past the beginning of the row
> tag with the second "<tr>". Is there a way to tell perl to 'put back' the four
> characters before continuing the match? How should I be doing this?
(?=...) means look but don't touch. So try this:
while ( $html =~ m#(<tr>.*?)(?=<tr>)#gis ) {
Now the parentheses match :-). I've added the /i modifier because you
want to ignore case for HTML tags.
How will you deal with the last row of the table (i.e., no following
<tr>)? You might want to change that look-ahead to (?=(<tr>|</table>)).
As I said, I'll bet there is an </table> tag.
HTH,
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 9 Aug 1998 04:04:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Help with regular expression
Message-Id: <6qj743$ksq$1@marina.cinenet.net>
Larry Rosler (lr@hpl.hp.com) wrote:
: How will you deal with the last row of the table (i.e., no following
: <tr>)? You might want to change that look-ahead to (?=(<tr>|</table>)).
First, you'll want to make thos non-capturing parens or you'll mess up
what gets returned on each /g iteration. Second, there's a minor
optimization possible which only matters if you're doing this a lot --
putting the common < and > outside the alternation. Third, though this
becomes irrelvant, the parent grouping around the alternation is
unnecessary. Combining the these:
(?=<(?:tr|/table)>)
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 9 Aug 1998 04:44:40 GMT
From: awrobinson@aol.com (Awrobinson)
Subject: Re: Help with regular expression
Message-Id: <1998080904444000.AAA14185@ladder01.news.aol.com>
From: lr@hpl.hp.com (Larry Rosler)
>(?=...) means look but don't touch. So try this:
>
> while ( $html =~ m#(<tr>.*?)(?=<tr>)#gis ) {
Thanks to everyone who suggested lookahead. That was what I needed and did not
know.
>As I said, I'll bet there is an </table> tag.
There was not. The body of the document consisted entirely of tables. One table
ended with the beginning tag of the next table. The last one was terminated by
the </html> tag. Surprised me too, but Netscape had no trouble rendering it.
Thanks everyone for the help.
Andrew Robinson
---
Disclaimer: The opinions expressed are mine alone and do not represent the
views of America Online
------------------------------
Date: Sat, 8 Aug 1998 15:44:52 -0400
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: Is Perl Year 1999 Compliant???
Message-Id: <19980808.154452.0z1.rnr.w164w@locutus.ofB.ORG>
> okay.... but nobody ever answered my post. I just want to know if my
> floppy drives are in fact year 2000 compatible. Do you perhaps know?
> My microsoft authorized vendor promised me my hard drives were, but he
> didn't mention the floppy. It's just a basic NEC or Zenith 3 1/4"
> floppy, the $20 kind.
well, were they $20.00 or $19.99?
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: Sat, 08 Aug 1998 16:52:59 -0400
From: Laurie Russinko <laurie@eclipse.net>
Subject: Mail attachments in NT w/o sendmail, blat, etc...
Message-Id: <35CCBAAB.6F1E718C@eclipse.net>
I've just started working with Perl in NT 4.0 (I'm used to working in
Unix) and I've run into a problem I'm hoping someone can help me out
with...
I need to send a text file that's on our server to a specified email
address, but it has to be sent as an attachment. The server we're
working on does not have sendmail.exe installed, and it's not ours so I
can't install any modules or other executable programs. Currently, I'm
using a perl script developed by Christian Mallwitz
(http://www.geocities.com/SiliconValley/Park/8312/mail1a_pl.txt) to send
the file, but it sends the file in the body of the message, not as an
attachment. I've looked around and found several suggested solutions to
this problem, but all require either extra modules or executables to be
installed on the server. Are there any other ways to do this?
Any help would be greatly appreciated...
------------------------------
Date: 8 Aug 1998 21:31:17 GMT
From: Magnus Jonsson <da96mjn@torun.ing.umu.se>
Subject: Re: sorting hash by values
Message-Id: <6qig35$kpu$1@studium.student.umu.se>
j <jjones@nospam.elementdesign.com> wrote:
> I have a hash with a bunch of words as keys, and the number of times
> they occured in the file as values.
> I want to sort the values and print them out, with their corresponding
> keys, in numerical order.
> I have no problem doing this with keys, but haven't the slightest idea
> how to do it with values. Yes, I have looked at the perl faq, but
> that was no help.
foreach(sort {$hash{$a} <=> $hash{$b}} keys %hash) {
print "$_ = $hash{$_}\n";
}
This prints the keys and the value with the smallest value
first.
I think this information is found in the 'perlfunc' manpage...
Hope it helps...
/Magnus Jonsson
--
.oooO Magnus Jonsson, bigfoot@acc.umu.se, http://www.acc.umu.se/~bigfoot/
( ) Studying Computer Engineering at Umea University, Sysadmin@{acc,ts}
\ ( |
\_) `-- I only code for fun...
------------------------------
Date: 8 Aug 1998 23:14:49 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: sorting hash by values
Message-Id: <6qj479$gme$1@monet.op.net>
In article <35ccb4a4.37602004@nntp.best.com>,
j <jjones@nospam.elementdesign.com> wrote:
>Yes, I have looked at the perl faq, but that was no help.
In Perlfaq 4, there is a section titled ``How do I sort a hash
(optionally by value instead of key)?'' If that was no help, I don't
think anyone here is going to be able to help you either.
------------------------------
Date: Sat, 8 Aug 1998 16:42:17 -0600
From: Ged the Grey's Hain <ged@FaerieMUD.org>
Subject: Suggestions for a cond_timedwait() equivalent?
Message-Id: <Pine.LNX.3.96.980808153554.14127A-100000@drill.800-ALL-NEWS.com>
Hi,
I'm writing an online interactive game (a MUD) in perl, and have recently
been experimenting with threads in 5.005.
I'm attempting to create a threaded event queue object that accepts events
to be executed, and assigns one of a pool of threads to execute each one.
This, so far, has worked beautifully, but I would like the event queue to
be able to add to or reduce the number of threads in the pool when the
load changes, but am at a loss to figure out how to have threads in a
cond_wait() wake up after a specified interval so they may be told to
expire.
I don't think alarms will work, as SIGALRM is caught by the Thread::Signal
thread, and so can't be used in the same way as in a serial app, right? I
know that there's a cond_timedwait() function in pthreads -- is there any
equivalent planned for perl threads, and/or a workaround that will supply
equivalent functionality in the meantime?
I've been a lurker on p5p for a while, and have searched the archives for
both it and the various clpm.* newsgroups, but I can find no mention of a
similar problem. Am I missing something?
--
Ged the Grey's Hain <ged@FaerieMUD.org>
Perlmage and Believer
The FaerieMUD Consortium <http://www.FaerieMUD.org>
------------------------------
Date: Sat, 8 Aug 1998 17:41:23 -0400
From: "Todd B" <tbeaulieu@mediaone.net>
Subject: Re: unwanted CR/LF translation in FILE UPLOAD
Message-Id: <6qigpc$np8$1@wbnws01.ne.highway1.com>
found the answer. i had to override the mode to be binmode.
------------------------------
Date: 12 Jul 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 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 3399
**************************************