Perl script help

Greg Barniskis nalists at
Wed Jan 25 11:29:40 PST 2006

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

> 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 
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>, (608) 266-6348

More information about the freebsd-questions mailing list