[26300] in Perl-Users-Digest
Perl-Users Digest, Issue: 8479 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 3 11:05:37 2005
Date: Mon, 3 Oct 2005 08:05:06 -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, 3 Oct 2005 Volume: 10 Number: 8479
Today's topics:
look-ahead search for overlapping <"h.v.niekerk at hccnet.nl">
Re: look-ahead search for overlapping <noreply@gunnar.cc>
Re: look-ahead search for overlapping <"h.v.niekerk at hccnet.nl">
Re: look-ahead search for overlapping <1usa@llenroc.ude.invalid>
Re: look-ahead search for overlapping <bernard.el-haginDODGE_THIS@lido-tech.net>
Re: look-ahead search for overlapping <darkon.tdo@gmail.com>
Re: look-ahead search for overlapping <"h.v.niekerk at hccnet.nl">
Re: Net::SMTP - sending email header ? <tintin@invalid.invalid>
Re: Net::SMTP - sending email header ? <uctraing@ultranet.com>
Re: Net::SMTP - sending email header ? <noreply@gunnar.cc>
Re: Net::SMTP - sending email header ? <1usa@llenroc.ude.invalid>
Re: Net::SMTP - sending email header ? <vek@station02.ohout.pharmapartners.nl>
Re: threads, XSUB allocated memory, destructors, destru <sisyphus1@nomail.afraid.org>
Re: XML Parsing <mirod@xmltwig.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 03 Oct 2005 14:55:50 +0200
From: Huub <"h.v.niekerk at hccnet.nl">
Subject: look-ahead search for overlapping
Message-Id: <4341298f$0$780$3a628fcd@reader20.nntp.hccnet.nl>
Hi,
I'm trying to realize this with a reg.exp.:
this is a test for fun -> this is a is a test a test for test for fun
for fun
I've tried reg.exp. like this:
s/(?=([\w\b\]{3}))[\w\b]{1}/(\1)\g
but then it looks for letters and I get this:
(thi)(his)is is a (tes)(est)st (for)or (fun)un
I also tried \w\s, \w+\b, \w+?\b, \w\t etc. Where do I go wrong?
Thanks
Huub
------------------------------
Date: Mon, 03 Oct 2005 15:10:17 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: look-ahead search for overlapping
Message-Id: <3qcot6Fe1fvaU1@individual.net>
Huub wrote:
> I'm trying to realize this with a reg.exp.:
<various random things snipped>
> Where do I go wrong?
In the description of what it is you want to achieve.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 03 Oct 2005 15:29:52 +0200
From: Huub <"h.v.niekerk at hccnet.nl">
Subject: Re: look-ahead search for overlapping
Message-Id: <43413188$0$771$3a628fcd@reader10.nntp.hccnet.nl>
> In the description of what it is you want to achieve.
>
Ok, 1 single thing 1st: I want to search for a word of unknown length.
Using \w\b, it looks for a word-character and word-boundary. A
word-boundary is not the same as 'white space', right? Since \s is white
space. Then what's a word-boundary?
------------------------------
Date: Mon, 03 Oct 2005 13:35:30 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: look-ahead search for overlapping
Message-Id: <Xns96E4619435C07asu1cornelledu@127.0.0.1>
Huub <"h.v.niekerk at hccnet.nl"> wrote in
news:43413188$0$771$3a628fcd@reader10.nntp.hccnet.nl:
>> In the description of what it is you want to achieve.
>>
>
> Ok, 1 single thing 1st: I want to search for a word of unknown length.
> Using \w\b, it looks for a word-character and word-boundary. A
> word-boundary is not the same as 'white space', right? Since \s is
> white space. Then what's a word-boundary?
perldoc perlre
A word boundary ("\b") is a spot between two characters that has a "\w"
on one side of it and a "\W" on the other side of it (in either order),
counting the imaginary characters off the beginning and end of the
string as matching a "\W".
Do read the documentation. Do not consider this group a "read the
documentation for me" service.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Mon, 3 Oct 2005 15:35:22 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: look-ahead search for overlapping
Message-Id: <Xns96E49E9553A79elhber1lidotechnet@62.89.127.66>
Huub <"h.v.niekerk at hccnet.nl"> wrote:
>> In the description of what it is you want to achieve.
>>
>
> Then what's a word-boundary?
Any place where \w meets \W (or vice versa). See perldoc perlre for
more details.
--
Cheers,
Bernard
------------------------------
Date: Mon, 03 Oct 2005 13:40:46 -0000
From: "David K. Wall" <darkon.tdo@gmail.com>
Subject: Re: look-ahead search for overlapping
Message-Id: <Xns96E4627673D11dkwwashere@216.168.3.30>
Huub <"h.v.niekerk at hccnet.nl"> wrote:
>> In the description of what it is you want to achieve.
>>
>
> Ok, 1 single thing 1st: I want to search for a word of unknown
> length. Using \w\b, it looks for a word-character and
> word-boundary. A word-boundary is not the same as 'white space',
> right? Since \s is white space. Then what's a word-boundary?
When in doubt, consult the documentation.
perldoc perlre
A word boundary ("\b") is a spot between two characters
that has a "\w" on one side of it and a "\W" on the
other side of it (in either order), counting the
imaginary characters off the beginning and end of the
string as matching a "\W". (Within character classes
"\b" represents backspace rather than a word boundary,
just as it normally does in any double-quoted string.)
------------------------------
Date: Mon, 03 Oct 2005 15:50:23 +0200
From: Huub <"h.v.niekerk at hccnet.nl">
Subject: Re: look-ahead search for overlapping
Message-Id: <43413658$0$772$3a628fcd@reader10.nntp.hccnet.nl>
> Do read the documentation. Do not consider this group a "read the
> documentation for me" service.
I have been reading the docs on
http://search.cpan.org/dist/perl/pod/perlre.pod. I just can't figure it
out, so I thought someone might give a hint.
------------------------------
Date: Mon, 3 Oct 2005 20:21:30 +1300
From: "Tintin" <tintin@invalid.invalid>
Subject: Re: Net::SMTP - sending email header ?
Message-Id: <ZZ40f.15750$iM2.1283095@news.xtra.co.nz>
"Bob" <uctraing@ultranet.com> wrote in message
news:1d31k1lq0iddu7nov6ga0so8j4nmai8dcs@4ax.com...
>I need a pointer... I am using Net::SMTP to send an email message but
> I need to generate the MIME headers. I checked the NET::SMTP docs but
> they don't have what I need. help?
MIME::Lite would be the easiest option
------------------------------
Date: Mon, 03 Oct 2005 12:28:13 GMT
From: Bob <uctraing@ultranet.com>
Subject: Re: Net::SMTP - sending email header ?
Message-Id: <nv82k11ci2jvt1rmo2fodnjtv2at98a33a@4ax.com>
On Mon, 3 Oct 2005 20:21:30 +1300, "Tintin" <tintin@invalid.invalid>
wrote:
>
>"Bob" <uctraing@ultranet.com> wrote in message
>news:1d31k1lq0iddu7nov6ga0so8j4nmai8dcs@4ax.com...
>>I need a pointer... I am using Net::SMTP to send an email message but
>> I need to generate the MIME headers. I checked the NET::SMTP docs but
>> they don't have what I need. help?
>
>MIME::Lite would be the easiest option
>
Tintin:
I looked at that but I could not find an example of using MIME::Lite
hooked up with Net::SMTP - although the Perl docs alluded to the
ability to do that. WOuld you know of any examples that show the
two tied together ?
Thanks,
------------------------------
Date: Mon, 03 Oct 2005 15:06:01 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Net::SMTP - sending email header ?
Message-Id: <3qcol7Fe8a70U1@individual.net>
Bob wrote:
> "Tintin" wrote:
>> "Bob" wrote:
>>> I am using Net::SMTP to send an email message but
>>> I need to generate the MIME headers.
>>
>> MIME::Lite would be the easiest option
>
> I looked at that but I could not find an example of using MIME::Lite
> hooked up with Net::SMTP - although the Perl docs alluded to the
> ability to do that. WOuld you know of any examples that show the
> two tied together ?
Thought I'd mention my favorite module for sending mail: Mail::Sender.
It's a packaged module that easily lets you set the headers.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 03 Oct 2005 13:20:43 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Net::SMTP - sending email header ?
Message-Id: <Xns96E45F130F7F2asu1cornelledu@127.0.0.1>
Bob <uctraing@ultranet.com> wrote in
news:nv82k11ci2jvt1rmo2fodnjtv2at98a33a@4ax.com:
> On Mon, 3 Oct 2005 20:21:30 +1300, "Tintin" <tintin@invalid.invalid>
> wrote:
>
>>
>>"Bob" <uctraing@ultranet.com> wrote in message
>>news:1d31k1lq0iddu7nov6ga0so8j4nmai8dcs@4ax.com...
>>>I need a pointer... I am using Net::SMTP to send an email message but
>>> I need to generate the MIME headers. I checked the NET::SMTP docs
>>> but they don't have what I need. help?
>>
>>MIME::Lite would be the easiest option
>>
>
> Tintin:
>
> I looked at that but I could not find an example of using MIME::Lite
> hooked up with Net::SMTP - although the Perl docs alluded to the
> ability to do that. WOuld you know of any examples that show the
> two tied together ?
http://search.cpan.org/~yves/MIME-Lite-
3.01/lib/MIME/Lite.pm#Print_a_message_into_a_string
http://search.cpan.org/~yves/MIME-Lite-3.01/lib/MIME/Lite.pm#Sending
Sinan
PS: Setting X-No-Archive is a good way to get into killfiles.
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: 03 Oct 2005 13:51:34 GMT
From: Villy Kruse <vek@station02.ohout.pharmapartners.nl>
Subject: Re: Net::SMTP - sending email header ?
Message-Id: <slrndk2dr5.11n.vek@station02.ohout.pharmapartners.nl>
On Mon, 03 Oct 2005 12:28:13 GMT,
Bob <uctraing@ultranet.com> wrote:
> On Mon, 3 Oct 2005 20:21:30 +1300, "Tintin" <tintin@invalid.invalid>
> wrote:
>
>>
>>"Bob" <uctraing@ultranet.com> wrote in message
>>news:1d31k1lq0iddu7nov6ga0so8j4nmai8dcs@4ax.com...
>>>I need a pointer... I am using Net::SMTP to send an email message but
>>> I need to generate the MIME headers. I checked the NET::SMTP docs but
>>> they don't have what I need. help?
>>
>>MIME::Lite would be the easiest option
>>
>
> Tintin:
>
> I looked at that but I could not find an example of using MIME::Lite
> hooked up with Net::SMTP - although the Perl docs alluded to the
> ability to do that. WOuld you know of any examples that show the
> two tied together ?
>
MIME::Lite will use Net::SMTP if you chose to send using SMTP. If
it is running on unix it will call sendmail as a program instead.
Example from the MIME::Lite documentation. (perldoc MIME::Lite).
### Do something like this in your 'main':
if ($I_DONT_HAVE_SENDMAIL) {
MIME::Lite->send('smtp', "smtp.myisp.net", Timeout=>60);
}
### Now this will do the right thing:
$msg->send; ### will now use Net::SMTP as shown above
Villy
------------------------------
Date: Mon, 3 Oct 2005 17:35:26 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: threads, XSUB allocated memory, destructors, destruction
Message-Id: <4340df7b$0$31912$afc38c87@news.optusnet.com.au>
"Andrew Torda" <please@no.mail.org> wrote in message
.
.
> In order to see the problem with threads cleaning up malloc'd
> memory, I think you should take your nice example, and put a loop
> like
> for (my $i = 0; $i < 10; $i++) {
> around your code below. Under linux, at least, I think you will
> find you will not reach the second iteration of the loop.
> > $thread1 = threads->new("start_thread", @array_to_read_from_1);
> > $thread2 = threads->new("start_thread", @array_to_read_from_2);
> > $thread3 = threads->new("start_thread", @array_to_read_from_3);
> >
> > $s1 = $thread1->join;
> > $s2 = $thread2->join;
> > $s3 = $thread3->join;
> >
> > print "$s1 $s2 $s3\n";
> > print "All joined\n";
>
So I did :
for($i = 0; $i < 10; $i++){
$thread1 = threads->new("start_thread", @array_to_read_from_1);
$thread2 = threads->new("start_thread", @array_to_read_from_2);
$thread3 = threads->new("start_thread", @array_to_read_from_3);
$s1 = $thread1->join;
$s2 = $thread2->join;
$s3 = $thread3->join;
print "$s1 $s2 $s3\n";
print "All joined\n";
sleep(2);
}
And there was no problem on Win32 with that .... until the global
destruction phase after the 10 loops had run (just prior to exit). ie, I
got:
Thread started
Thread started
Thread started
200 400 650
All joined
Thread started
Thread started
Thread started
200 400 650
All joined
.
.
Thread started
Thread started
Thread started
200 400 650
All joined
Thread started
Thread started
Thread started
200 400 650
All joined
destroying int object
int object destroyed
destroying int object
int object destroyed
destroying int object
int object destroyed
.
.
destroying int object
int object destroyed
destroying int object
Free to wrong pool 336c878 not abababab during global destruction.
Looks like the error is different on linux, then. Now wishing I'd built my
perl on linux with threads support ... just so I can see for myself.
Afaik, if you built your pointer objects as I built mine, then you've done
it right - and what you're up against is simply a bug. I guess that would
call for a bug report (see 'perldoc perlbug').
If you haven't already, you could check that everything functions ok when
threads are removed from the scene (just to prove that it's threads that are
stuffing things up, and not something else).
You could also try replacing malloc/free with New/Safefree (though I'm not
expecting that to fix anything) ..... plus any other straws you care to
clutch at :-)
Cheers,
Rob
------------------------------
Date: Mon, 03 Oct 2005 12:06:55 +0200
From: Michel Rodriguez <mirod@xmltwig.com>
Subject: Re: XML Parsing
Message-Id: <434102bf$0$8480$5fc30a8@news.tiscali.it>
xhoster@gmail.com wrote:
> I'm currently using XML::Parser to process some XML. I am wondering what
> else is out there. A search of CPAN on 'XML' reveals that there is way
> more out there than I can possible evaluate, but that most of it is not
> general XML processing modules, but rather for very specific tasks which
> just happen to involve XML.
>
> I'd like to be familiar with the major alternatives to XML::Parser, without
> having to read 3689 different perldoc pages to find those major
> alternatives. So, what are your favorite Perl modules for general-purpose
> XML processing?
It depends what you are looking for:
XML::Simple is often enough to load XML data into a Perl data structure,
XML::LibXML gives you the speed and power of libxml2
XML::Twig is perlish and convenient (and written by me ;--)
XML::SAX::Machine gives you a framework for stream processing
I guess those are the ones I would recomment these days
The Perl XML FAQ ( http://perl-xml.sourceforge.net/faq/ ) has some more
information. I also have a few articles on my site that show examples of
using the various modules: http://www.xmltwig.com/article/index_wtr.html
--
Michel Rodriguez
Perl & XML
xmltwig.com
------------------------------
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 8479
***************************************