🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #27086

Re: Use of startup_innd.pl filter

#27086
From: Kenneth Herron
Date: Sun, 22 Mar 1998 00:00
48 lines
2076 bytes
In article <m3afajz9xg.fsf@windlord.Stanford.EDU>,
Russ Allbery  <rra@stanford.edu> wrote:
|You know what I *really* want?  ctlinnd runperl 'name_of_perl_sub'.  And
|you know, that probably wouldn't even be that hard....

Surely you guys have noticed the filter_mode hook that's called on
every mode change?

	sub filter_mode {
		# Don't act on 'ctlinnd go' since any perlaction would
		# have to be a repeat of something we just did.
		return if ($mode{'NewMode'} eq 'running');

		$mode{'reason'} =~ tr/A-Z/a-z/;
		my($state);
		foreach $_ (split(' ', $mode{'reason'})) {
			if (!defined $state) {
				if ($_ eq 'perlaction') {
					$state = 1;
				}
			}
			elsif ($_ eq 'flushhistory') {
				undef %history;
			}
			elsif ($_ eq 'flushreject') {
				undef %reject_mid;
			}
			elsif ($_ eq 'dumpstats') {
				writestats;
			}
		}
	}

Call it with

	ctlinnd pause 'perlaction dumpstats'; ctlinnd go ''

Extending this with additional commands, or even to execute arbitrary
perl from the command line, is pretty straightforward.
-- 
Kenneth Herron -- kherron@campus.mci.net
"When Microsoft first took control of the Funk & Wagnalls Encyclopedia
product, there was a flattering biography of Bill Gates.  But it said he
was known as a tough competitor.  Now it says that he's known for his
charitable contributions." -- Gary Reback, <http://www.ljx.com/reback/>

Technical Details
Message-ID: <6f26ms$cpl$1@news.campus.mci.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <m367l85nm5.fsf@windlord.Stanford.EDU> <m3n2ejzcwd.fsf@windlord.Stanford.EDU> <26%Q.6$TR5.1570@firestorm.gunslinger.net> <m3afajz9xg.fsf@windlord.Stanford.EDU>

Show Full Headers
Complete Article Headers
Message-ID: <6f26ms$cpl$1@news.campus.mci.net>
Subject: Re: Use of startup_innd.pl filter
Date: Sun, 22 Mar 1998 00:00:00 +0000
From: kherron@campus.mci.net (Kenneth Herron)
References: <m367l85nm5.fsf@windlord.Stanford.EDU> <m3n2ejzcwd.fsf@windlord.Stanford.EDU> <26%Q.6$TR5.1570@firestorm.gunslinger.net> <m3afajz9xg.fsf@windlord.Stanford.EDU>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 336451658
Organization: CampusMCI
Newsgroups: news.software.nntp