Click here to get back home

modules for nntp client

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
modules for nntp client Gerry Ford 04-14-2008
Posted by Gerry Ford on April 14, 2008, 1:25 am
Please log in for more thread options
Hello c.l.p.misc!

A resurgence of spam in places I would otherwise like has renewed my
interest in writing an nntp client. Someone else's (in the public domain)
has the following use statements, which I think I have to track down now.
The part I don't get right now is what follows the vanilla use statements

use strict; <---- this one I get for free
use Net::NNTP; <----already got this one
use Net::SMTP;
use HTTP::Date qw/time2str str2time/;
use MIME::QuotedPrint qw/encode_qp decode_qp/;
use Encode qw/encode decode/;
use POSIX qw/strftime/;
use File::stat;
use File::Temp qw/:mktemp/;
use Win32::ANSIConsole qw/coninit cls/;
, such as ^^^^^^^^.

What does it mean?

TIA, and cheers,

--
"Shopping for toilets isn't the most fascinating way to spend a Saturday
afternoon. But it beats watching cable news."

~~ Booman



Posted by smallpond on April 14, 2008, 11:14 am
Please log in for more thread options
> Hello c.l.p.misc!
>
> A resurgence of spam in places I would otherwise like has renewed my
> interest in writing an nntp client. Someone else's (in the public domain)
> has the following use statements, which I think I have to track down now.
> The part I don't get right now is what follows the vanilla use statements
>
> use strict; <---- this one I get for free
> use Net::NNTP; <----already got this one
> use Net::SMTP;
> use HTTP::Date qw/time2str str2time/;
> use MIME::QuotedPrint qw/encode_qp decode_qp/;
> use Encode qw/encode decode/;
> use POSIX qw/strftime/;
> use File::stat;
> use File::Temp qw/:mktemp/;
> use Win32::ANSIConsole qw/coninit cls/;
> , such as ^^^^^^^^.
>
> What does it mean?
>
> TIA, and cheers,



I gather you are new to perl. The "qw/coninit cls/" is a way
of specifying a list, which is a basic perl data type.
If you look at the documentation for "use" which you can find
online, it shows the different forms:

use Module VERSION LIST
use Module VERSION
use Module LIST
use Module
use VERSION

The documentation describes what the LIST argument is for. See:

http://aspn.activestate.com/ASPN/docs/ActivePerl
http://aspn.activestate.com/ASPN/docs/ActivePerl/5.10/lib/pods/perlfunc.html#use

perlfunc has the documentation for each perl function call,
including "use". If you have perldoc, you can get the
same documentation with the command:

perldoc -f use

Posted by Gerry Ford on April 14, 2008, 7:40 pm
Please log in for more thread options


>> use strict; <---- this one I get for free
>> use Net::NNTP; <----already got this one
>> use Net::SMTP;
>> use HTTP::Date qw/time2str str2time/;
>> use MIME::QuotedPrint qw/encode_qp decode_qp/;
>> use Encode qw/encode decode/;
>> use POSIX qw/strftime/;
>> use File::stat;
>> use File::Temp qw/:mktemp/;
>> use Win32::ANSIConsole qw/coninit cls/;
>> , such as ^^^^^^^^.

> I gather you are new to perl. The "qw/coninit cls/" is a way
> of specifying a list, which is a basic perl data type.

Thanks for your reply, smallpond. I'm newly-new to perl. Let me see if
I've got this:

use module LIST;
Imports some semantics into the current package from the named module,
generally by aliasing certain subroutine or variable names into your
package. It is exactly equivalent to
BEGIN { require Module; Module->import( LIST ); }

So I'm to look at importing/exporting. qw is the quote word operator. So
if you have
@fruits = qw{ apple orange banana};
, your list is correctly instantiated sans commas. So
use Win32::ANSIConsole qw/coninit cls/;
imports the coninit and cls functions.

Here's where I run into double trouble. I'm having a heckuva time figuring
out what he means with win32::ansiconsole. I thought that the reason I
might not be able to find any of these is that I had an outdated activestate
install, but not so. Overnight I upgraded to 5.10 and find many modules
that look like this one, that aren't. AS has no entry for net::nntp nor
win32::ansiconsole. Without the module for me to look at, I'm not gonna
figure out what, e.g. coninit is.

What's puzzling is that I'm able to use net::nntp having downloaded nothing
but AS 5.10. I looked in the installed modules and see no reason for this
good fortune.

> perlfunc has the documentation for each perl function call,
> including "use". If you have perldoc, you can get the
> same documentation with the command:
>
> perldoc -f use
Indeed I do. I can use it on any dos prompt. I'm a little mystified by
this good fortune as well.

Given that I'm gonna have a dozen knucklehead questions like this, should I
rather ask in c.l.p.modules?
--
"Shopping for toilets isn't the most fascinating way to spend a Saturday
afternoon. But it beats watching cable news."

~~ Booman



Posted by A. Sinan Unur on April 14, 2008, 8:05 pm
Please log in for more thread options


> Here's where I run into double trouble. I'm having a heckuva time
> figuring out what he means with win32::ansiconsole.

Please capitalize module names properly. Case matters.

In any case, I am not sure but I am assuming it is an
version of the following module:

http://search.cpan.org/~jlmorel/Win32-Console-ANSI-1.00/

If you cannot find that through ppm, you might want to
add the following repositories:

Name: uwinnipeg
URL: http://cpan.uwinnipeg.ca/PPMPackages/10xx/package.xml

Name: trouchelle
URL: http://trouchelle.com/ppm10/package.xml

Name: Bribes
URL: http://www.bribes.org/perl/ppm/package.xml

> that aren't. AS has no entry for net::nntp

perl -MNet::NNTP -e "print qq"

will print the version installed (assuming it is installed).

You can see at http://perldoc.perl.org/index-modules-N.html
that both Net::NNTP and Net::SMTP are core modules.

> win32::ansiconsole. Without the module for me to look at, I'm not
> gonna figure out what, e.g. coninit is.

E:\Home\asu1> ppm install Win32::Console::ANSI
Downloading Win32-Console-ANSI-1.00...done
Unpacking Win32-Console-ANSI-1.00...done
Generating HTML for Win32-Console-ANSI-1.00...done
Updating files in site area...done
7 files installed

This module seems to be available at both Bribes and trouchelle repos.

On the other hand, you can download the original module from:

http://backpan.perl.org/authors/id/J/JL/JLMOREL/

http://backpan.perl.org/authors/id/J/JL/JLMOREL/Win32-ANSIConsole-0.01.tar.gz

> What's puzzling is that I'm able to use net::nntp having
> downloaded nothing but AS 5.10. I looked in the installed modules
> and see no reason for this good fortune.

It is in the core.

> Given that I'm gonna have a dozen knucklehead questions like this,
> should I rather ask in c.l.p.modules?

Nope. This is a fine place to ask.

However, do read the posting guidelines first.

Sinan

--
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/

Posted by Gerry Ford on April 15, 2008, 2:09 am
Please log in for more thread options



>> Here's where I run into double trouble. I'm having a heckuva time
>> figuring out what he means with win32::ansiconsole.
>
> Please capitalize module names properly. Case matters.

Thanks for your response. I'll need to shift gears from fortran, which is
case insensitive.

> In any case, I am not sure but I am assuming it is an
> version of the following module:
>
> http://search.cpan.org/~jlmorel/Win32-Console-ANSI-1.00/

I don't think it is. When I have a script with
use Win32::ANSIConsole qw/coninit cls/;
, perl.exe is looking for an absent ANSIConsole.pm that has coninit and cls
defined.

At the above link, I get this:
package Win32::Console::ANSI;
#
#
# Version 1.01 (08/06/2005)
#
# This program is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the
# GNU General Public License or the Artistic License for more details.
#

use 5.006;
use strict;
use warnings;
require Exporter;

our @ISA = qw(Exporter);
our $VERSION = '1.00';

our %EXPORT_TAGS = (
'all' => [ qw( Title Cursor XYMax SetConsoleSize Cls ScriptCP )],
);

our @EXPORT_OK = ( @{ $EXPORT_TAGS },
);

our @EXPORT = qw(
);

package Win32::Console::ANSI;

require XSLoader;
XSLoader::load('Win32::Console::ANSI', $VERSION);

1;
__END__
# pod data elided for length

First of all, Cls is, by your criterion, different from cls, and there is no
coninit at all.

> If you cannot find that through ppm, you might want to
> add the following repositories:
>
> Name: uwinnipeg
> URL: http://cpan.uwinnipeg.ca/PPMPackages/10xx/package.xml
>
> Name: trouchelle
> URL: http://trouchelle.com/ppm10/package.xml
>
> Name: Bribes
> URL: http://www.bribes.org/perl/ppm/package.xml

I looked at these, and they look like:
Common Gateway Interface Class Lincoln D. Stein (lstein@cshl.org) Automated
accessor generation Marty Pauley (marty+perl@kasei.com) Inheritable,
overridable class data Tony Bowden (tony@tmtm.com) class and object builder,
hash version GomoR (netpkt@gomor.org) Get information about a class and its
structure Adam Kennedy (adamk@cpan.org) Fast prototype-based OO programming
in Perl. Toby Ovod-Everett (toby@ovod-everett.org) Base class for creating
singleton objects Andy Wardley

This looks like it was expecting a program to read text, not a human ambling
about, trying to find a module.

> perl -MNet::NNTP -e "print qq"
> will print the version installed (assuming it is installed).
2.24

>> win32::ansiconsole. Without the module for me to look at, I'm not
>> gonna figure out what, e.g. coninit is.
>
> E:\Home\asu1> ppm install Win32::Console::ANSI
> Downloading Win32-Console-ANSI-1.00...done
> Unpacking Win32-Console-ANSI-1.00...done
> Generating HTML for Win32-Console-ANSI-1.00...done
> Updating files in site area...done
> 7 files installed
How do I replicate this process on windows? As it is, a file that ends in
tar.gz just creates huge problems for me.

>> What's puzzling is that I'm able to use net::nntp having
>> downloaded nothing but AS 5.10. I looked in the installed modules
>> and see no reason for this good fortune.
> You can see at http://perldoc.perl.org/index-modules-N.html
> that both Net::NNTP and Net::SMTP are core modules.
Gotcha. This is necessary viewing for persons who are taking their first
steps with modules.

> However, do read the posting guidelines first.
Just to prove I was there for the sixth time:

Beware of saying ``doesn't work''

--
"Shopping for toilets isn't the most fascinating way to spend a Saturday
afternoon. But it beats watching cable news."

~~ Booman



Similar ThreadsPosted
Cannot authenticate to NNTP server with Net::NNTP authinfo() August 8, 2006, 8:11 pm
Posting to nntp newsgroup with Perl (Net::NNTP) March 4, 2007, 7:05 am
Net::NNTP October 31, 2004, 10:23 pm
NNTP over SSL November 18, 2005, 2:41 am
nntp scan February 7, 2005, 4:51 pm
non nntp usenet January 18, 2008, 4:27 am
$nntp ->list() April 19, 2008, 5:11 pm
Which NNTP module to use? July 27, 2008, 11:30 pm
Net::NNTP, retrieving articles help please December 17, 2004, 3:14 pm
How do I reply a NNTP message? December 6, 2005, 12:46 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap