🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #83933

Re: nnrpd perl filter and $user

#83933
From: Jeffrey M. Vinocur
Date: Sun, 20 Mar 2011 21:38
36 lines
2073 bytes
In article <im574u$anh$1@speranza.aioe.org>, Aioe  <estasi@aioe.org> wrote:
>
>NNRPD perl filters - at least postfilter - need to make some initialization 
>job when loaded and before filtering incoming messages. The current nnrpd 
>behaviour forces them to keep inside filter_post() every code that needs to 
>know the current user and this forces the filter to re-execute these jobs 
>every time that an article is posted.

I can't comment on the perl filtering infrastructure, but if your
main concern is the redundant computation, you could easily wrap
that computation e.g.

~ > perl -we '
        sub x {
                my $x = shift;
                print "computing $x\n";
                return $x
        }
        my $y;
        print "one\n";
        $y ||= &x(1);
        print "$y\ntwo\n";
        $y ||= &x(2);
        print "$y\n";'
one
computing 1
1
two
1

or see the Memoize module.


-- 
Jeffrey M. Vinocur
jeff@litech.org
Technical Details
Message-ID: <im5s40$i2l$1@puck.litech.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news-out.octanews.net!indigo.octanews.net!news.glorb.com!news2.glorb.com!news.litech.org!not-for-mail
References: <im574u$anh$1@speranza.aioe.org>

Show Full Headers
Complete Article Headers
Message-ID: <im5s40$i2l$1@puck.litech.org>
Subject: Re: nnrpd perl filter and $user
Date: Sun, 20 Mar 2011 21:38:08 +0000
From: jeff@litech.org (Jeffrey M. Vinocur)
References: <im574u$anh$1@speranza.aioe.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news-out.octanews.net!indigo.octanews.net!news.glorb.com!news2.glorb.com!news.litech.org!not-for-mail
Newsgroups: news.software.nntp
Organization: Litech Systems Design
Lines: 36
Sender: jeff@litech.org
NNTP-Posting-Host: puck.litech.org
X-Trace: puck.litech.org 1300657088 18517 204.16.242.142 (20 Mar 2011 21:38:08
 GMT)
X-Complaints-To: usenet@litech.org
NNTP-Posting-Date: Sun, 20 Mar 2011 21:38:08 +0000 (UTC)
X-Newsreader: trn 4.0-test76 (Apr 2, 2001)
Originator: jeff@litech.org (Jeffrey M. Vinocur)
X-Original-Bytes: 1771