[32860] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4126 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 28 16:09:30 2014

Date: Tue, 28 Jan 2014 13:09:03 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 28 Jan 2014     Volume: 11 Number: 4126

Today's topics:
    Re: [OT] sys call length limitation <rweikusat@mobileactivedefense.com>
    Re: [OT] sys call length limitation <whynot@pozharski.name>
        anyone using continuity for sites? making money? and or <visphatesjava@gmail.com>
    Re: creating a custom newsreader <cal@example.invalid>
    Re: creating a custom newsreader <ben@morrow.me.uk>
    Re: creating a custom newsreader <gamo@telecable.es>
    Re: creating a custom newsreader <*@eli.users.panix.com>
    Re: creating a custom newsreader <ben@morrow.me.uk>
        Prediction 0128 IND 1930 (Tuesday) Game 46 <news@todbe.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 26 Jan 2014 18:19:34 +0000
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: [OT] sys call length limitation
Message-Id: <87ha8qppvt.fsf@sable.mobileactivedefense.com>

tmcd@panix.com (Tim McDaniel) writes:
> In article <09qdra-08p1.ln1@anubis.morrow.me.uk>,
> Ben Morrow  <ben@morrow.me.uk> wrote:
>>
>>Quoth tmcd@panix.com:
>>> File::Temp (on my machine's perl) says "The object isa 'IO::Handle'",
>>> so this should work (though I've not tested it):
>>> 
>>> sub filter {
>>>     my $fh = File::Temp->new();
>>>     $fh->autoflush(1);
>>>     print $fh (@_);
>>>     return `wc -c < $fh`;
>>> }
>>
>>This needs a
>>
>>    use IO::Handle;
>>
>>unless something else has loaded it already (which you shouldn't rely
>>on).
>
> I'm not at all familiar with inheritance and haven't done much with
> Perl OOP.  Its statement that "The object isa 'IO::Handle'" isn't
> sufficient?  Is there a way that a module can be isa something else
> without having its methods?

@ISA is an array in the symbol table of some package and it contains a
list of strings. In case of a method call

$foo->bar()

when bar doesn't exist in the symbol table of the package the reference
stored in $foo was blessed into, a (default case) breadth-first search
of the symbol tables of the modules whose names are listed in @ISA and
the the modules whose names are listed in @ISA-arrays of any of these
packages and so on is conducted in order to 'find a bar'.

But putting a string into the @ISA array doesn't cause anything to be
loaded into the 'symbol space' of a running Perl interpreter.


------------------------------

Date: Sun, 26 Jan 2014 12:45:21 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: [OT] sys call length limitation
Message-Id: <slrnle9pq1.p4c.whynot@orphan.zombinet>

with <slrnle9omc.n03.whynot@orphan.zombinet> Eric Pozharski wrote:
> with <imudra-22q1.ln1@anubis.morrow.me.uk> Ben Morrow wrote:

>> ...in fact, I've just tested some things, and this is no longer a
>> problem in any case. I wonder when that changed? 
> 5.11.3

My bad.  That's the version when that started.  It was sorted out in
5.13.8.

-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


------------------------------

Date: Sun, 26 Jan 2014 22:24:59 -0800 (PST)
From: johannes falcone <visphatesjava@gmail.com>
Subject: anyone using continuity for sites? making money? and or squatting on continuity?
Message-Id: <9dc23494-c6db-4716-b8eb-984849d6d9d4@googlegroups.com>

let me see it in action!


------------------------------

Date: Sun, 26 Jan 2014 18:08:51 -0800
From: Cal Dershowitz <cal@example.invalid>
Subject: Re: creating a custom newsreader
Message-Id: <oaidnR6Dw_IpInjPnZ2dnUVZ_rudnZ2d@supernews.com>

On 01/26/2014 12:06 AM, $Bill wrote:

[long post; if you'd rather not read a long post, please skip this thread]

 > I stripped some code out of a working script that should help you -
 > just fill in the host/user/pass/ip fields and maybe change the loop
 > index to something other than 10:

<code here>

$ perl nntp5.pl
New NNTP connection to news.supernews.com
sending auth
Setting group
cnt=446442, first=538069, last=984510, grp=comp.lang.c
get 984510 head
head has 19 lines
get 984510 body
body has 20 lines
David Thompson <dave.thompson2@verizon.net> writes:
[...]
 > Not officially. n1569 6.2.7p1:
[...]

N1256 is the best current draft for C99 (it includes the official C99
standard with the three Technical Corrigenda merged into it).

<big snip>

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
     -- Antony Jay and Jonathan Lynn, "Yes Minister"

last: <lnzjmis1ny.fsf@nuthaus.mib.org>
message: 984507 <lnzjmis1ny.fsf@nuthaus.mib.org>

<end output>

I set the group to c.l.c., so that the body would make sense.  With a 
net that catches 3 messages, I caught the Thompson twins, both of whom I 
would typically read.

This is how I merged Bill's script with what I have now:

$ cat nntp5.pl
#!/usr/bin/perl -w
use strict;
use 5.010;
use lib "template_stuff";
use nntp1 qw(get_nntp_object);
use Net::NNTP;

my $group = 'comp.lang.c';    # newsgroup
my $nntp = get_nntp_object();

# set newsgroup
print "Setting group\n";
my ($cnt, $first, $last, $grp) = $nntp->group($group) or
   die "group failed: $! ($^E)";
print "cnt=$cnt, first=$first, last=$last, grp=$grp\n";

# start at last message
my $msgnum = $last;
for (my $ii = 0; $ii < 3; $ii++) {

     # get msg header
     print "get $msgnum head\n";
     my $head = $nntp->head($msgnum) or do {
         warn "nntp->head $msgnum failed: $! ($^E)";
         goto next_msg;    # skip message - you could retry
     };

     print "head has ", scalar @$head, " lines\n";

     # filter msg based on header
     # ...    <your code here>

     # get msg body
     print "get $msgnum body\n";
     my $bodyref = $nntp->body($msgnum) or do {
         die "nntp->body $msgnum failed: $!\n";
         next;
     };
     print "body has ", scalar @$bodyref, " lines\n";
     say @$bodyref;
next_msg:
     # go to prior message
     my $msgid;
     unless ($msgid = $nntp->last()) {
         print "nntp->last($ii): $!\n";
         last;
     }
     print "last: $msgid\n";

     # get msg number for header request
     $msgnum = $nntp->message();
     chomp $msgnum;
     print "message: $msgnum\n";
     $msgnum =~ s/^\s*(\d+)\s+.*$/$1/;
}
$nntp->quit;

__END__

And the module that constructs my nntp object is here:
$ cd template_stuff/
$ cat nntp1.pm
#!/usr/bin/perl -w
package nntp1;
require Exporter;

our @ISA = qw(Exporter);
our @EXPORT = qw( get_nntp_object);
our %config = (

     usenet =>  {
            domain   =>  'news.supernews.com',
            username =>  '',
            password =>  '',
            ip       =>  '216.168.3.30',
           },
);

sub get_nntp_object{
use strict;
use Net::FTP;
my $sub_hash = "usenet";
my $host = $config{$sub_hash}->{'domain'};
my $user = $config{$sub_hash}->{'username'};
my $pass = $config{$sub_hash}->{'password'};
my $ip   = $config{$sub_hash}->{'ip'};
# create news server connection
print "New NNTP connection to $host\n";
my $nntp;
if (not $nntp = Net::NNTP->new($host, Timeout => 15)) {
     warn "Cannot connect to $host: $! ($^E)";
     if (not $nntp = Net::NNTP->new($ip, Timeout => 15)) {
         die "Cannot connect to $ip: $! ($^E)";
     }
}
# login
print "sending auth\n";
$nntp->authinfo ($user, $pass) or die "nntp->authinfo: $! ($^E)" if $user;
return $nntp;
}

$

The subdirectory template_stuff is stipulated to exist along with the 
appropriate use statement.  At this point, no other subdirectories exist 
in this project.

Q1)  My simple question is this.  I want to have these messages divided 
up into newsgroups, using the message number as a key.  Given that I'm 
writing this in a newsgroup where we all have dabbled with this, where 
it is certain that I'm re-inventing the wheel if I proceed as if it 
hadn't been done before: what are my best choices for file architecture?

I can make a subdirectory named 'messages'.  As subdirectories, I'd have 
the 10 or 15 newsgroups that are worth paying attention to, and I know 
about.

How do you do it, Uri?  Peter?  Thanks, Bill, for your attention.  Cheers,
-- 
Cal


------------------------------

Date: Mon, 27 Jan 2014 13:30:30 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: creating a custom newsreader
Message-Id: <mk3ira-2gk2.ln1@anubis.morrow.me.uk>


Quoth Cal Dershowitz <cal@example.invalid>:
> 
> Q1)  My simple question is this.  I want to have these messages divided 
> up into newsgroups, using the message number as a key.  Given that I'm 
> writing this in a newsgroup where we all have dabbled with this, where 
> it is certain that I'm re-inventing the wheel if I proceed as if it 
> hadn't been done before: what are my best choices for file architecture?

Are you sure you don't just want to install leafnode?

Ben



------------------------------

Date: Mon, 27 Jan 2014 18:31:41 +0100
From: gamo <gamo@telecable.es>
Subject: Re: creating a custom newsreader
Message-Id: <lc6568$gku$1@speranza.aioe.org>

El 27/01/14 14:30, Ben Morrow escribió:
>
> Quoth Cal Dershowitz <cal@example.invalid>:
>>
>> Q1)  My simple question is this.  I want to have these messages divided
>> up into newsgroups, using the message number as a key.  Given that I'm
>> writing this in a newsgroup where we all have dabbled with this, where
>> it is certain that I'm re-inventing the wheel if I proceed as if it
>> hadn't been done before: what are my best choices for file architecture?
>
> Are you sure you don't just want to install leafnode?
>
> Ben
>

I agree with Ben. Just in case you want to manage articles localy, it
was used to store 100 articles per file. One directory per newsgroup.

-- 
http://www.telecable.es/personales/gamo/


------------------------------

Date: Mon, 27 Jan 2014 22:35:27 +0000 (UTC)
From: Eli the Bearded <*@eli.users.panix.com>
Subject: Re: creating a custom newsreader
Message-Id: <eli$1401271735@qz.little-neck.ny.us>

In comp.lang.perl.misc, gamo  <gamo@telecable.es> wrote:
> El 26/01/14 09:57, Cal Dershowitz escribió:
> > I'm a little bit bored and have decided to indulge a hobby project.  I
> But a hobby doesn't means you doesn't RTFM.

Start with the classics:

    Read This Before You Write a Newsreader, News Transport System, etc.
    By Tom Limoncelli
    Version 1.12. Updated 1995-03-30
    http://newsreaders.com/misc/twpierce/news/newsreader-manifesto.html

> $c = new News::NNTPClient("news.aioe.org");
> ($first, $last) = ($c->group("comp.lang.perl.misc"));
> 
> for (; $first <= $last; $first++) {
>      print $c->article($first);
> }

Does News::NNTPClient do the "MODE READER" command for you? Checking
the docs, no. You need to call mode_reader. That's the polite way to
read news.

Anyway, unless your server is braindead (unlikely), in a case like
Cal's, or in most cases, getting the overview file first and using that
to decide which articles are interesting is the way to go.

Some places (eg, my local provider, panix.com) have specially tweaked
the overview to be more useful for killfiling. Specifically, the local
overview has NNTP-Posting-Host:

:r! nntplist overview.fmt
Subject:
From:
Date:
Message-ID:
References:
Bytes:
Lines:
Xref:full
NNTP-Posting-Host:full

(The nntplist command connects to a server and runs "LIST $arg" for you,
my copy came with trn, which is Larry Wall's newsreader, but is apparently
Stan Barber's work. nntplist is also very useful for getting the list of
groups available with high and low water marks for article numbers.)

Some code from the overview file pretty printer I have:

	$c = new News::NNTPClient;

# ...

	# Use overview.fmt to find format, don't just assume it is always
	# the shipped out default
	push(@fields, "Article of $group: ",
		       map { s/\s+/ /g;
			     s/.*:full $//;
			     $_;
		       } $c->list('overview.fmt'));

	# select our group
	$c->group($group);

	# fetch the overview data for a range of articles and process
	foreach $xover ($c->xover($art1, $art2)) {
	    @xover = split(/\t/, $xover);
	    for($i = 0; $i < @xover; $i++) {
	      print "$fields[$i]$xover[$i]\n";
	    }
	    print "\n";
	}

Elijah
------
some newsreader has a bug needing :full on all non-standard overview entries


------------------------------

Date: Tue, 28 Jan 2014 02:57:42 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: creating a custom newsreader
Message-Id: <6uijra-52t2.ln1@anubis.morrow.me.uk>


Quoth Eli the Bearded <*@eli.users.panix.com>:
> 
> (The nntplist command connects to a server and runs "LIST $arg" for you,
> my copy came with trn, which is Larry Wall's newsreader, but is apparently
> Stan Barber's work.

In the beginning Larry created rn and perl. And rn was without
threading, or scoring; and darkness *was* upon the face of the Net. And
the Spirit of /K:j moved upon the face of the network. [...]

Stan wrote the rrn patches (NNTP support), and when they were merged
into mainline rn he took over maintenance (such as it is) of rn. trn
(threading) was written by Wayne Davison. strn (scoring) was written by
Clifford A. Adams; this code was later merged into trn, which I believe
is still officially maintained by Wayne, although AFAICS the only CVS
commits in the last ten years are from Colin Watson, who appears to be
the Debian package maintainer.

(Do you realise there have been no material changes to trn in the last
ten years? How many other ten-year-old software packages do you think
are still in regular use?)

Ben 
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)



------------------------------

Date: Mon, 27 Jan 2014 18:56:10 -0800
From: "$Bill" <news@todbe.com>
Subject: Prediction 0128 IND 1930 (Tuesday) Game 46
Message-Id: <52E71C4A.4070608@todbe.com>

# IND sitting on top of the league right now - should be fun.

# Next games following:
#       CHA at LAL: Fri Jan 31 1930 Game 47
#       LAL at MIN: Tue Feb  4 1700 Game 48
#       LAL at CLE: Wed Feb  5 1600 Game 49 (BTB)

#------------------------------------------------------------------------------

# Either reply to this post or create a new thread with the same subject line.
# Note that only 'Prediction MMDD' is needed in the subject line, the OPP and
# game time are to make it easy to remember the opponent and the game time.

# If replying to a prediction post remove the entire previous message or if
# it's short, top-post to make sure your guess is picked up first.  If you make
# a mistake or change your mind, just repost (only last post counts).

# Quoted lines from a previous post will be ignored (lines starting with any
# of these characters and any leading spaces : [~+;:|#!<>[](){}-] will be
# assumed to be quoted).

# To reply to another poster's post without predicting, change the date to XXXX
# to avoid causing a predict.

# Make sure Laker score is first number or is prefixed by a word matching
# this RE: /^la(?!c)(?:l|k)?/i and a space delimiter (if you understand Perl
# regular expr. syntax).  See examples below.

# Simplest sample post for predicting LA 101 and Seattle opponent 92 :
# ------
# 101 92                Laker score is always first if not qualified
# ------

# Equivalent posts :
# ------
# 101
# 92
# ------
# LAL 101
# SEA 92
# ------
# 92 LAL 101
# ------
# SEA 92 LAL 101
# ------
# SEA 92
# LAL 101
# ------

# Online Laker prediction contest page: http://www.todbe.com/lakers/
# Predict: http://www.todbe.com/lakers/cgi-bin/laker.pl
# Standings: http://www.todbe.com/lakers/cgi-bin/lakerytd.pl
# Text Schedule: http://www.todbe.com/lakers/cgi-bin/lakersched.pl?action=text
# HTML Schedule: http://www.todbe.com/lakers/cgi-bin/lakersched.pl?action=html
# If nameserver down, try IP of 69.175.58.130 instead of www.todbe.com

# You can predict in advance if you won't be able to post on game day.
# You can also get the year-to-date standings and Laker schedule there.

# To predict online after predicting on Usenet, you will need to have your
# password reset by me (since it's been set with a default value to prevent
# others from predicting for you).  Just email me and I'll set one for you
# and you can change it on your next online predict.  If you haven't made a
# prediction on Usenet, you can set your own password on your first online
# predict.  NOTE: ONLINE PREDICTIONS TAKE PRECEDENCE OVER USENET PREDICTIONS.


------------------------------

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:

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 4126
***************************************


home help back first fref pref prev next nref lref last post