[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can newsgroup articles file be processed by mhonarc?

In my program I use Net::NNTP module to fetch messages form particular newsgroup and append them to regular text file (it seems to me that they are articles in source form) as I matter of fact I use:

$art = $nntp->article($msg_num);

if (defined($art)) {
	foreach my $l (@$art) {
		print OUT $l;	
	print OUT "\n";


I attach example file. Can the file of that format be processed by mhonarc the way
mbox file is? I noticed when I split the file into single messages files they (thanks to -add .msg switch) seem to be added (one by one) to archive.

Path: atlantis.news.tpi.pl!news.tpi.pl!newsfeed.tpinternet.pl!wsisiz.edu.pl!nntp.idg.pl!news.glorb.com!logbridge.uoregon.edu!artemis.acsu.buffalo.edu!newsstand.cit.cornell.edu!not-for-mail
From: "A. Sinan Unur" <1usa@xxxxxxxxxxx>
Newsgroups: comp.lang.perl.misc
Subject: Re: Array from a string.
Date: 31 Mar 2004 16:40:31 GMT
Organization: Cornell University
Lines: 31
Sender: asu1@xxxxxxxxxxxxxxx (on
Message-ID: <Xns94BD76C503D92asu1cornelledu@xxxxxxxxxxxx>
References: <c4eks5$9u5$1@xxxxxxxxxxxxxxxx> <Xns94BD62A5695F1asu1cornelledu@xxxxxxxxxxxx> <c4ep8f$bin$1@xxxxxxxxxxxxxxxx>
X-Trace: news01.cit.cornell.edu 1080751231 3478 (31 Mar 2004 16:40:31 GMT)
X-Complaints-To: usenet@xxxxxxxxxxxxxxxxxxxxxx
NNTP-Posting-Date: 31 Mar 2004 16:40:31 GMT
User-Agent: Xnews/5.04.25
X-Face: #0:Oa+WV[,\dU+SJ\X%#!MhGkG;vsj^Tzl1KJHck]V;S8u}yvJ<rd?.0]p2-6jgTf.>p~GpGgD.mLo)IY,&yDRM1dV3z'Y'8D=+Y7k[|[~mGbV(<(8Im%IhZkC9.A.&]TGcwX9GKGgA,lqReCST$aDsGKy#zU~laO|oJiD$e"6&_tzrxT}K,X_e,FC&}P8J"x~ii,lr6)L}=tZI#cNU,7u]J"TLISliDF2pmIKR`ulX=X-sB2aM?f4wIG5Z_nXceH~5}E*t+vx!unlkVJ7]57x`%S1\gR{.1_^Gu2L'am[/=c]'7Hj1l^Yx!nCe40dFkW
Xref: atlantis.news.tpi.pl comp.lang.perl.misc:189342

"Richard S Beckett" <spikeywan@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in 

>> > Is there an easy way to do this?
>> Yes there is. It is called checking the FAQ list before posting:
> How do you know I didn't?
>> perldoc -q inside
> Now, there's a word I would _never_ have associated with this problem,
> thanks.

There are many ways of looking for what you need in the FAQ list. What I 
gave you is a short-cut that one figures out after finding the entry for 
the first time.

The first time I found that entry was by reading through perlfaq4:

    This section of the FAQ answers questions related to manipulating
    numbers, dates, strings, arrays, hashes, and miscellaneous data

Hmmmm .. You would have found the answer had you looked at the table of 
contents and then read perlfaq4.

A. Sinan Unur
1usa@xxxxxxxxxxx (reverse each component for email address)

Path: atlantis.news.tpi.pl!news.tpi.pl!newsfeed.tpinternet.pl!wsisiz.edu.pl!newsfeed.gazeta.pl!opal.futuro.pl!news.task.gda.pl!newsfeed00.sul.t-online.de!t-online.de!diablo.theplanet.net!nntp.theplanet.net!inewsm1.nntp.theplanet.net!zen.net.uk!hamilton.zen.co.uk!!feed4.jnfs.ja.net!feed3.jnfs.ja.net!feed2.jnfs.ja.net!jnfs.ja.net!news.bham.ac.uk!not-for-mail
From: Brian McCauley <nobull@xxxxxxxx>
Newsgroups: comp.lang.perl.misc
Subject: Re: multiple lines / success or failure?!
Date: 31 Mar 2004 17:50:30 +0100
Organization: Just me, doing my own thing
Lines: 15
Message-ID: <u91xn96jvt.fsf@xxxxxxxxxxxxxxxx>
References: <agpk60pbcbfp55llfu2pjkntt10pctfpui@xxxxxxx> <c4dvm6$qqq$1@xxxxxxxxxxxxxxxxxxxxxxx> <mvsl605pc2lg3eog9kvrco0cpthbi73caa@xxxxxxx>
NNTP-Posting-Host: wcl-l.bham.ac.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: sun3.bham.ac.uk 1080751639 15473 (31 Mar 2004 16:47:19 GMT)
X-Complaints-To: usenet@xxxxxxxxxxxxxxx
NNTP-Posting-Date: Wed, 31 Mar 2004 16:47:19 +0000 (UTC)
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1
Xref: atlantis.news.tpi.pl comp.lang.perl.misc:189343

Geoff Cox <geoffacox@xxxxxxxxxxxxxxxxxxxxxxxx> writes:
> I am getting a "can't find EOHTML string terminator anywhere before
> EOF" message using above. Is there a typo?

Have you eleminiated the most likely cause that is explained when you
look that message up in the reference manual (perldiag)? 

     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\

Path: atlantis.news.tpi.pl!news.tpi.pl!newsfeed.tpinternet.pl!newsfeed.news2me.com!canoe.uoregon.edu!hammer.uoregon.edu!logbridge.uoregon.edu!news.umass.edu!news-out.cwix.com!newsfeed.cwix.com!newsfeed2.sea.pnap.net!newsfeed.pnap.net!newsgate.mot.com!newshost.mot.com!not-for-mail
From: "Richard S Beckett" <spikeywan@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Newsgroups: comp.lang.perl.misc
Subject: Re: Array from a string.
Date: Wed, 31 Mar 2004 18:16:53 +0100
Organization: Motorola
Lines: 12
Message-ID: <c4euhp$dfo$1@xxxxxxxxxxxxxxxx>
References: <c4eks5$9u5$1@xxxxxxxxxxxxxxxx> <Xns94BD62A5695F1asu1cornelledu@xxxxxxxxxxxx> <c4ep8f$bin$1@xxxxxxxxxxxxxxxx> <Xns94BD76C503D92asu1cornelledu@xxxxxxxxxxxx>
NNTP-Posting-Host: zuk28-6171.ecid.cig.mot.com
X-Trace: newshost.mot.com 1080753529 13816 (31 Mar 2004 17:18:49 GMT)
X-Complaints-To: motpost1@xxxxxxxxxxxxx
NNTP-Posting-Date: 31 Mar 2004 17:18:49 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Xref: atlantis.news.tpi.pl comp.lang.perl.misc:189344

> Hmmmm .. You would have found the answer had you looked at the table of
> contents and then read perlfaq4.

OK, it's a fair cop! :-) I'll try harder next time.

Thanks for the help.
GPLRank +79.699

Path: atlantis.news.tpi.pl!news.tpi.pl!newsfeed.tpinternet.pl!skynet.be!news.csl-gmbh.net!newsfeed.r-kom.de!news-nue1.dfn.de!news-han1.dfn.de!news.rz.tu-clausthal.de!not-for-mail
From: "Jan Biel" <jan.biel@xxxxxxxxxxxxxxx>
Newsgroups: comp.lang.perl.misc
Subject: [NEWBIE] newline question
Date: Wed, 31 Mar 2004 19:25:38 +0200
Organization: Clausthal University of Technology
Lines: 58
Message-ID: <c4eupc$mqe$1@xxxxxxxxxxxxxxxxxxxxxxxxxx>
NNTP-Posting-Host: boneman.heim7.tu-clausthal.de
Mime-Version: 1.0
Content-Type: text/plain;
Content-Transfer-Encoding: 7bit
X-Trace: ariadne.rz.tu-clausthal.de 1080753772 23374 (31 Mar 2004 17:22:52 GMT)
X-Complaints-To: usenet@xxxxxxxxxxxxxxxxxxxxxxxxxx
NNTP-Posting-Date: Wed, 31 Mar 2004 17:22:52 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Xref: atlantis.news.tpi.pl comp.lang.perl.misc:189345


>From some tutorials on the web I managed to create a perl script which finds
and replaces certain occurences in text files via regular expressions.

Then something happened which I cannot really explain, so I hope you can
clarify it for me.

The original perl script looks like this:

$filein = 'a.txt';
$fileout = 'b.txt';

open(INFO, $filein);
open(INFO2, ">$fileout");

@lines = <INFO>;


print INFO2 @lines;


where a.txt is a file containing:


The resulting b.txt contains:


So the second regular expression is ignored.

But if I write two perl scripts where each executes only one of the regular
expressions it works with the result:


as expected.

What is the mystery here?

I hope this wasn't too confusing :)

Path: atlantis.news.tpi.pl!news.tpi.pl!newsfeed.tpinternet.pl!wsisiz.edu.pl!nntp.idg.pl!news.zanker.org!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!newsfeed.kabelfoon.nl!nanites.nntp.kabelfoon.nl!not-for-mail
Date: Wed, 31 Mar 2004 11:34:52 -0600
From: John Bokma <postmaster@xxxxxxxxxxxxxxx>
Organization: Castle Amber - freelance software development
User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: comp.lang.perl.misc
Subject: Re: count files + dirs
References: <406ad87b@xxxxxxxxxxx> <20040331095631.M19862@xxxxxxxxxxxxxxxxxxxxx>
In-Reply-To: <20040331095631.M19862@xxxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Lines: 21
Message-ID: <406b0193$0$24356$58c7af7e@xxxxxxxxxxxxxxxxx>
NNTP-Posting-Host: customer-XAL-18-140.megared.net.mx
X-Trace: 1080754579 nanites.nntp.kabelfoon.nl 24356 jbokma/
X-Complaints-To: abuse@xxxxxxxxxxxx
Xref: atlantis.news.tpi.pl comp.lang.perl.misc:189346

Paul Lalli wrote:

> On Wed, 31 Mar 2004, Simon wrote:

>>$count=@files + 1;
> Why are you doing this?  @files in scalar context gives the number of
> elements in the array.  You should not be adding one to it.


>>print "$count"-1;
> what the heck is this??

Fix for the "Why are you doing this" :D

John                            personal page:  http://johnbokma.com/

Freelance Perl / Java developer available  -  http://castleamber.com/

[Index of Archives]     [Bugtraq]     [Yosemite News]     [Mhonarc Home]