[25057] in Perl-Users-Digest
Perl-Users Digest, Issue: 7307 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 25 21:10:45 2004
Date: Mon, 25 Oct 2004 18:10:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 25 Oct 2004 Volume: 10 Number: 7307
Today's topics:
Re: localizing %SIG handlers <nospam-abuse@ilyaz.org>
Re: MAIL recommendation <nospam@nospam.com>
Re: MAIL recommendation <jgibson@mail.arc.nasa.gov>
Re: MAIL recommendation (R Solberg)
Re: MAIL recommendation <noreply@gunnar.cc>
Re: MAIL recommendation <usa1@llenroc.ude.invalid>
Re: Net::POP3 Install <3432513@yahoo.de>
Re: Net::POP3 Install <nospam@nospam.com>
Re: Parsing SGML with Perl <usenet@morrow.me.uk>
Re: perl optimazation guide/book <uri@stemsystems.com>
Re: Practical Extraction Recording Language <bik.mido@tiscalinet.it>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 26 Oct 2004 00:09:03 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: localizing %SIG handlers
Message-Id: <clk4iv$30dm$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Anno Siegel
<anno4000@lublin.zrz.tu-berlin.de>], who wrote in article <ckdtd2$of3$1@mamenchi.zrz.TU-Berlin.DE>:
> $SIG{ HUP} = \&global_handler;
> {
> local $SIG{ HUP} = \ &local_handler;
> # provoke and deal with one or more HUP signals
> }
>
> The assumption is that $SIG{ HUP} is either the global or the local
> handler at all times, so the (HUP) signal will always be caught, but
> apparently that assumption isn't true. "local" sets the handler
> to undef, and then "=" sets it to \ &local_handler. It is quite
> possible for a signal to arrive when the hander is undefined, which
> ends the program through an uncaught signal.
What you describe is a serious flaw in Perl signal-handling
implementation. But many more others may be present; it is very hard
for unexperienced-in-asm C programmers (i.e., for most of us) to write
signal-safe code.
The first thing to check is whether just *assignment* to $SIG{HUP} is
a signal-safe operation (it may contain some more windows of
vulnerability). If it is safe (10^8 signals savely delivered is a
good indication - should take couple of days on current OSes), I
would think that this would be safe too:
#!/usr/bin/perl -w
use strict;
sub DESTROYER::DESTROY {shift->()}
sub ON_DESTROY (&) {bless shift, 'DESTROYER'}
sub LOCAL_SIG (&$) {my $s=pop; my $o = $SIG{$s}; $SIG{$s}=shift;
ON_DESTROY {$SIG{$s}=$o || 'DEFAULT'}}
$SIG{HUP} = \&global_sig;
{ my $on_leave = LOCAL_SIG {warn 'got SIG'} 'HUP';
# Do something...
}
Hope this helps,
Ilya
------------------------------
Date: Mon, 25 Oct 2004 19:14:31 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: MAIL recommendation
Message-Id: <1098746129.481256@nntp.acecape.com>
> As regards the original question in this thread, and the related FAQ
> entries, I did post an answer to the OP (even if he seems to have been
> too buzy to acknowledge it...). I mentioned Mail::Sender and MIME::Lite.
my apologies gunnar,
i do make the attempt to thanks answers, and i only show these two from you
where you are answering charlton (not that i have opened his). but i show
no answer here from you regarding Mail::Sender and MIME::Lite
ahhh wait, there it is, it is a reply to the ORIGINAL....but it got pushed
to the bottom due to the length of this thread's tangent...
------------------------------
Date: Mon, 25 Oct 2004 16:56:33 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: MAIL recommendation
Message-Id: <251020041656338251%jgibson@mail.arc.nasa.gov>
In article <2u59psF26eqb0U1@uni-berlin.de>, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
> Charlton Wilbur wrote:
> > If you're unhappy with the treatment of a subject in the FAQ, submit
> > a patch or bring it up here for discussion. That's what makes the
> > FAQ the authoritative word on the matter.
>
> Or *a* authoritative word on the matter. Don't forget TMTOWTDI. :) But
> I agree, I should have brought up a few matters for discussion. (Suppose
> that's true for most of us, btw.) Let me start now:
>
> As regards the original question in this thread, and the related FAQ
> entries, I did post an answer to the OP (even if he seems to have been
> too buzy to acknowledge it...). I mentioned Mail::Sender and MIME::Lite.
>
> I have never really used MIME::Lite, since I'm a happy user of
> Mail::Sender since a few years. Both handle attachments, and both are
> frequently recommended here and in similar forums. As regards
> Mail::Sender, I know that its author is a seasoned Perl programmer who
> is highly active in the Perl community (beginners@perl.org) and open for
> discussing changes to the module.
>
> Even if I'm not able to compare them, to me it appears as if
> Mail::Sender deserves to be mentioned in the FAQ.
I would like to point out that both the FAQ and search.cpan.org are a
bit deficient in regards to e-mail techniques or modules. 'perldoc -q
mail' brings up the entry 'How do I send mail?', which recommends
forking the sendmail utility, and mentions only the Mail::Mailer and
Mail::Internet modules as possible, less portable alternatives to
sendmail.
search.cpan.org has the "Mail and Usenet News" sub-page, which contains
9 entries:
Email::AutoReply
Email::Send::SMTP::Auth
IMAP::Admin
Mariachi
NNML::Server
NNTP::Server
Net::Milter
Sendmail::AccessDB
Sendmail::Milter
only one of which (Email::Send::SMTP::Auth) is described as a way to
send e-mail.
Searching for "mail" in "modules" at search.cpan.org returns 718
entries, starting with "Mail::Abuse". The first entry that looks like
it might be used for sending e-mail is #45 "Mail::POP3Client".
So until the FAQ is upgraded or search.cpan.org has better pointers,
you can anticipate the occasional "what is the best way to send e-mail
from perl?" question. I, too, would like to know the answer to this
question, and thank Gunnar for supplying his answer.
------------------------------
Date: 25 Oct 2004 17:36:25 -0700
From: flateyjarbok@yahoo.com (R Solberg)
Subject: Re: MAIL recommendation
Message-Id: <386cc483.0410251636.6cf6d3d3@posting.google.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<2u4383F26olmiU1@uni-berlin.de>...
> Mail::Sender and MIME::Lite are two options for sending attachments.
Do these answers for mail work if I am on windows?
Thanks much.
Richard
------------------------------
Date: Tue, 26 Oct 2004 02:44:22 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: MAIL recommendation
Message-Id: <2u5l5qF2786s5U1@uni-berlin.de>
R Solberg wrote:
> Gunnar Hjalmarsson wrote:
>>Mail::Sender and MIME::Lite are two options for sending attachments.
>
> Do these answers for mail work if I am on windows?
Yes. Portability is one of the reasons why using a module is better than
opening a pipe to some MTA such as sendmail.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 26 Oct 2004 00:48:08 GMT
From: "A. Sinan Unur" <usa1@llenroc.ude.invalid>
Subject: Re: MAIL recommendation
Message-Id: <Xns958DD39C24A22asu1cornelledu@132.236.56.8>
flateyjarbok@yahoo.com (R Solberg) wrote in
news:386cc483.0410251636.6cf6d3d3@posting.google.com:
> Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message
> news:<2u4383F26olmiU1@uni-berlin.de>...
>
>> Mail::Sender and MIME::Lite are two options for sending attachments.
>
> Do these answers for mail work if I am on windows?
It is easy to find out for yourself:
http://search.cpan.org/~jenda/Mail-Sender-0.8.10/Sender.pm#DESCRIPTION
http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm#Sending
Sinan.
------------------------------
Date: Mon, 25 Oct 2004 20:12:49 -0400
From: L D Jones <3432513@yahoo.de>
Subject: Re: Net::POP3 Install
Message-Id: <2u5j7aF25q7d6U1@uni-berlin.de>
daniel kaplan wrote:
> simple update, finnaly got the syntax right....but every other command
> windows says perl generated an error....and it terminates it....now could my
> install of perl, could be my windows machine, could be a lot of things...
>
> using activestate....are all builds equal? if not, anyone know of another
> one they would recommend?
>
5.8.4.810. should take minutes to install and you'll also have perldoc
and the faq all in one place
------------------------------
Date: Mon, 25 Oct 2004 20:23:25 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: Net::POP3 Install
Message-Id: <1098750263.838175@nntp.acecape.com>
>>5.8.4.810. should take minutes to install and you'll also have perldoc
>>and the faq all in one place
actually, i have 5.6.1 installed....someone here, can't recall who, said it
woud be a wise choice to have the same version as the one which currently
resides on my actual server (shared unix)...which makes sense to me
as for the crash itself, which people are responding to in this thread:
>>App: (pid=31536) where 31536 = perl.exe
>>Exception number: c0000005 (access violation)
>>and it is the "dreaded" Exception number: c0000005 (access violation)
i made sure to do a full uninstall, a defrag, a reboot and a reinstall, and
the problem went away.....
------------------------------
Date: Mon, 25 Oct 2004 16:38:21 +0100
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Parsing SGML with Perl
Message-Id: <d8jv42-4o4.ln1@osiris.mauzo.dyndns.org>
Quoth "Jürgen Exner" <jurgenex@hotmail.com>:
> Mohd wrote:
> > I am very new to Perl and would appreciate if someone can tell me a
> > way to extract inforamtion from a simple SGML file to HTML using Perl.
>
> This _Q_uestion is _A_sked _F_requently, please check the FAQ:
>
> How do I remove HTML from a string?
> The most correct way (albeit not the fastest) is to use
> HTML::Parser from CPAN. Another mostly correct way is to use
> HTML::FormatText which not only removes HTML but also attempts
> to do a little simple formatting of the resulting plain text.
> [...]
>
> Well, ok, the question is not exactly identical, but the answer is the same.
> Use a proper module to parse the SGML (I would assume you can even use
> HTML::Parser, it should work on any SGML).
I doubt it: HTML::Parser has the HTML DTD built into it, and won't
correctly deal with others.
Parsing SGML correctly is *difficult*. I have yet to find a Perl module
that will do it. I would recommend using osx from opensp to convert to
XML (or simply storing your data in XML in the first place, if that's
possible), and then using one of the many XML parsing modules on CPAN.
Ben
--
All persons, living or dead, are entirely coincidental.
ben@morrow.me.uk Kurt Vonnegut
------------------------------
Date: Tue, 26 Oct 2004 00:20:58 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: perl optimazation guide/book
Message-Id: <x7acuajppv.fsf@mail.sysarch.com>
>>>>> "L" == Laura <lwt0301@bellsouth.net> writes:
L> For relatively simple algorithms, the best way to test speed and
L> optimizations is to write an actual program in C which is
L> line-for-line equivalent to your Perl script. C, while primitive,
L> is considered to be the gold standard in speed. Some institutions
L> will rate their code as 2x, 4x, 8x etc... as a multiple of the
L> speed at which the code would run if it were in C. Perl will do
L> this conversion for you if you use the appropriate module.
again you have said a bunch of balderdash. you obviously don't know c
nor perl well enough because you say stuff like "do a line-for-line"
translation. that never gives an optimal translation from any language
to any other. and did you know some perl code will run faster than
'equivilent' c code? and perl's 'conversion to c' module is never
recommended and never used in the real world?
i am waiting for your next massively wrong missive.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 26 Oct 2004 00:35:29 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Practical Extraction Recording Language
Message-Id: <rntqn01ndj32jnal8eatja2p52m3ku4bl4@4ax.com>
On Sun, 24 Oct 2004 09:30:40 GMT, Octo Mancer <richard@zync.co.uk>
wrote:
<TotallyOT>
>I challenge anyone to cram so many fallacies into so few words!!! This
Well this is completely OT wrt not only the subject of this thread,
but even wrt Perl at all... however many years ago, in secondary
school, our biology teacher brought us to the lab where we saw a
couple of old, and I say *old* educational movies, probably from the
sixties. To give an idea we were studying invertebrates at that time,
I clearly remember that one of this movies was still classifying
bacteria amongst plantae.
Since the movies ended before the hour was complete, she began showing
slides more or less at random, mostly having nothing to do with
invertebrates. At a certain point a philogenetic tree of the genre
homo came out, and it could have been fine, had she only shown it
(although AFAIK it was a now outdated model of human evolution). But
she dared to add, as an explanation(?) her reading of the tags that we
could see ourselves. At a certain point she came out with "Here, you
see, we have HOMUS AFARENSIS".
^^^^^^^^^^^^^^^
Well, I'd say that this counts three errors in two words: (i) reading,
for there was clearly written "A. Afarensis", (ii) Latin, for it is
homo/hominis, not homus/homii, (iii) classification, in fact it/he
(she? - Remember "Lucy"?) is a member of the genre Australopithecus,
not Homo...
</TotallyOT>
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 7307
***************************************