in reply to Usenet and arrays

I tend to stay away from the apparently abandoned News::NNTPClient, preferring the more-recently-updated Net::NNTP, in code like my rec.humor.funny reader.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Legal disclaimers
by ergowolf (Monk) on Mar 25, 2003 at 17:20 UTC
    Randal:
    "Be sure to read my standard disclaimer if this is a reply."

    I read it, but I am waiting to hear back from my lawyers...

    On a more serious note, I have alot of respect for you. You do alot for the perl community and I apreciate you taking the time out to help me. I just want to say thank you.

    "I tend to stay away from the apparently abandoned News::NNTPClient, preferring the more-recently-updated Net::NNTP, in code like my rec.humor.funny reader."

    http://www.stonehenge.com/merlyn/UnixReview/col22.html

    "The return value tells how many articles are in the group, along with a minimum and maximum article number. We can use that to scan through all possible article numbers and dump them out. Let's do that with a foreach loop:

    foreach my $artnum ($low..$high) { my $art = $c->article($artnum) or next;

    If an article doesn't exist (perhaps a cancellation or a different expiration date), we skip over to the next article number."

    I am going to try this later today and read the rest of your article while I am crammed in a NYC subway car(sardin can) on the way home from work.

    I do have a followup question though. I looked up the module at CPAN and found....

    http://search.cpan.org/author/GBARR/libnet-1.13/Net/NNTP.pm

    listgroup ( GROUP ) Returns a reference to a list of all the active messages in GROUP, or the current group if GROUP is not specified.

    Will listgroup give me an array of all the active articles saving me the trouble of weeding out the bad articles?

    iguanodon:
    "I've used xover to fetch the article information into a hash keyed by message ID. That way you just end up with the articles you know are available. Note that the News::NNTPClient docs say that xover may not be supported, but in my experience this hasn't been a problem."

    What module did you use? Do you have a sample?
      Will listgroup give me an array of all the active articles saving me the trouble of weeding out the bad articles?
      If that's what it does (haven't looked or tried), and then what you're going to do is iterate over that list, I'd suggest staying with the interface I used in my program.

      In general, I prefer getting an iterator over getting an iterated list, because there's more overhead in having the called subroutine prepare the list, just to do what you could have done in the first place.

      -- Randal L. Schwartz, Perl hacker
      Be sure to read my standard disclaimer if this is a reply.