🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
3 messages
3 total messages Started by Aioe Sun, 20 Mar 2011 15:40
nnrpd perl filter and $user
#83932
Author: Aioe
Date: Sun, 20 Mar 2011 15:40
15 lines
1791 bytes
I know that nnrpd exports to the perl filter the current readers.conf 
username inside a variable called '$user'.
This variable seems to be filled by nnrpd only when filter_post() subroutine 
is executed and it's empty when filter is loaded (when it's executed 
everything that is outside that routine).
Imho, this is bad.
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.
At the same time, this behaviour is obscure (i've spent a Sunday morning 
trying to understand it).

btw, i'm rewriting postfilter from scratch.
Re: nnrpd perl filter and $user
#83933
Author: 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
Re: nnrpd perl filter and $user
#83934
Author: Aioe
Date: Mon, 21 Mar 2011 22:33
7 lines
1382 bytes
Jeffrey M. Vinocur wrote:

> 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.

nice idea :-)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads