Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jan 2006 13:29:39 -0600
From:      Greg Barniskis <nalists@scls.lib.wi.us>
To:        Jack Stone <antennex@hotmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Perl script help
Message-ID:  <43D7D1A3.8070008@scls.lib.wi.us>
In-Reply-To: <BAY106-F82AA1E19FEB39B4AF3033CC120@phx.gbl>
References:  <BAY106-F82AA1E19FEB39B4AF3033CC120@phx.gbl>

next in thread | previous in thread | raw e-mail | index | archive | help
Jack Stone wrote:
> I'm using an old (2001) canned perl script to manage questions to my 
> tech site. It is of big help since it can answer common questions from 
> templates and a real time saver.

First, this isn't really a FreeBSD question, so you may certainly 
have better luck getting it answered in a Perl-oriented forum (or 
best, the help forum or the original author of the script in question).

[snip]
> Is there any way to insert the same type of tests on those original 
> copies in the storage as "*.ftf" files and just delete them so they 
> aren't there when the question manager program is loaded??

If I were you I would be looking at the Perl code just before those 
lines that you quoted in your original message. Inspect the content 
of $FORM{message} earlier in the process and use Perl pattern 
matching to see if it contains taboo content. Something like

if ($FORM{message} =~ /taboophrase/) { msgisjunk; }

Here I've made up a subroutine name "msgisjunk" that would get 
executed if "taboophrase" was found in the message. You will need to 
figure out what is the appropriate thing to do in that situation 
(might be simply "exit;"), and you may well need a more complex 
comparison operation, depending on what is normally the format and 
content of the message data.

Basically though, the idea is that if bad content is found then you 
should skip entirely the section of code that goes about writing the 
file and sending the email. If the bad content is neither delivered 
nor stored in a file in the first place, then you don't need any 
other filtering or deletion to occur.

If you don't know much Perl, the numerous Perl books at www.ora.com 
are generally great reading, IMHO. Start with _Learning Perl_.


-- 
Greg Barniskis, Computer Systems Integrator
South Central Library System (SCLS)
Library Interchange Network (LINK)
<gregb at scls.lib.wi.us>, (608) 266-6348



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43D7D1A3.8070008>