Net::NNTP, retrieving articles help please

J

jbl

What am I overlooking?

use Net::NNTP;

# create a new Net::NNTP object:
$server = Net::NNTP->new("news-server.com")
or die "Can't connect to news server: $@\n";

($narticles, $first, $last, $name) =
$server->group("comp.lang.perl.misc")
or die "comp.lang.perl.misc\n";
print "$narticles $first $last $name\n";

for ($n=$first; $n<=$last; $n++)
{
@lines = $server->article($n);
print map { "$_ \n" } @lines;
}


I want to read the article, all I am getting is a reference to the
array

the print map { "$_ \n" } @lines;

this gets me

ARRAY(0x198e0d4)

not any text

Thanks
jbl
 
S

Sherm Pendley

jbl said:
@lines = $server->article($n);
print map { "$_ \n" } @lines;
I want to read the article, all I am getting is a reference to the
array

So, what's the problem? That's what the docs say you should get from
article(), a reference to an array.

Instead of storing that reference as the first element in @lines, you
probably want something more like this instead:

my $lines = $server->article($n);
print map { "$_ \n" } @$lines;

(I haven't tested this, but I have a hunch that the above will produce
double-spaced articles, because I think the lines you get back will
already have \ns.)

sherm--
 
J

jbl

So, what's the problem? That's what the docs say you should get from
article(), a reference to an array.

Instead of storing that reference as the first element in @lines, you
probably want something more like this instead:

my $lines = $server->article($n);
print map { "$_ \n" } @$lines;

(I haven't tested this, but I have a hunch that the above will produce
double-spaced articles, because I think the lines you get back will
already have \ns.)

sherm--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top