Perl script help

2006-01-25 Thread Jack Stone
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.


Alas, that time saves is now being diminished by junk mail about cheap drugs 
and I'm trying to figure out how to filter those out of the good questions 
that are submitted by a form to a directory.


I've managed to filter the copy that is sent via sendmail by procmail using 
these tests:

* B ?? .*(cool|site|yousite|(yousite best))
* B ?? .*(http:\/\/.*\.*)|(/a href=*http:\/\/.*\.*/)

However, that still leaves the original stored in the directory that are 
displayed when the admin program is loaded and the questions are matched by 
proper answer template.


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


I need a couple of perl lines that will either block or delete the questions 
if the body of the question  matches the tests.


Below are the pertinent lines of a sub-process that processes and stores the 
questions submitted via a web form --  ( 
http://www.antennex.com/cgi-bin/qm/Question.cgi ).


# if(open(QUESTION, $Data/questionfiles/$PID.ftf)) {
#   flock(QUESTION, '2');
#   print QUESTION name||$FORM{name}\nemail||$FORM{email}\n;
#   print QUESTION date||$SHOW_TIME on $SHOW_DATE||$time\n\n\n; # 3 new 
lines

#   print QUESTION $FORM{message}\n;
#   close QUESTION;
#   backup($Data/questionfiles/$PID.ftf);
# ...etc., etc.


Any suggestions appreciated.!!

Best regards,
Jack

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Perl script help

2006-01-25 Thread Jack Stone

From: Greg Barniskis [EMAIL PROTECTED]
To: Jack Stone [EMAIL PROTECTED]
CC: freebsd-questions@freebsd.org
Subject: Re: Perl script help
Date: Wed, 25 Jan 2006 13:29:39 -0600

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; }



First, thanks for the tip as it works using exit; which might be enough, 
but would rather do a redirect to a page just in case one of the good guys 
trips over it in their questions. So, I'll try to figure out how to do that 
without further burden to you or this fine, helpful and usually friendly 
list.


With regard to your other remarks about learning perl and OT, there are many 
questions (like shell scripts here today) that don't quite fit. Of course, 
perl is part of the base OS, so it's not far off for the many script gurus I 
know that are here.


I've been a member of this list for several years and have answered dozens 
if not several 100 questions of all kinds that I do know about. Since I 
probably don't ask more than 3 or 4 question a year, I should be entitled to 
ask them vs my contributions. I enjoy helping when I can OT or not.


IMHO, this is one of the best lists to obtain help about scripts when one 
just doen's have to time to learn a whole scripting language. Going to a 
script list isn't very helpful either.


I'm a Jack of all trades, but no master of perl.

Again, thanks for the help -- but, not the lecture though as it was the 
obvious thing to do IF one really had time or the right skill/talent to 
learn a language.


Regards,
Jack

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


perl script help

2004-04-16 Thread JJB

I need $timezone to hold the time zone in this format  -00:00
The command  date +%z  will give it as  -

I know nothing about writing perl scripts.

Can somebody show me how to  add the : in the output 
of the date command in the simple following script?

The cat statement is just so I can see results are correct.


#!/usr/bin/perl
$timezone=date +%z;
cat $timezone




___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: perl script help

2004-04-16 Thread Remko Lodder
JJB wrote:
I need $timezone to hold the time zone in this format  -00:00
The command  date +%z  will give it as  -
I know nothing about writing perl scripts.

Can somebody show me how to  add the : in the output 
of the date command in the simple following script?

The cat statement is just so I can see results are correct.

#!/usr/bin/perl
$timezone=date +%z;
cat $timezone
Not that i am very good in perl,
In KSH scripting it's like this:
%H:%M for a 00:00 output instead of 

Perhaps that will help you:-)

(Oh the command date +%H:%M)

Cheers



___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


--

Kind regards,

Remko Lodder
Elvandar.org/DSINet.org
www.mostly-harmless.nl A Dutch community for helping newcomers on the 
hackerscene
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: perl script help

2004-04-16 Thread Remko Lodder
Not that i am very good in perl,
In KSH scripting it's like this:
%H:%M for a 00:00 output instead of 

Perhaps that will help you:-)

(Oh the command date +%H:%M)

Cheers

Well that does not work (FYI)

Cheers (perhaps Matthew's comments on this are better ;-) )



--

Kind regards,

Remko Lodder
Elvandar.org/DSINet.org
www.mostly-harmless.nl A Dutch community for helping newcomers on the 
hackerscene
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: perl script help

2004-04-16 Thread Shaun Friedle
On Fri, 2004-04-16 at 17:05, JJB wrote:
 I know nothing about writing perl scripts.
 
 Can somebody show me how to  add the : in the output 
 of the date command in the simple following script?

Try this:

#!/usr/bin/perl
$timezone=`date +\%z`;  #Gets the offset in $timezone
$timezone =~ s/(\+[0-9][0-9])/$1:/; #Replaces ±NN with ±NN:
print $timezone;#Prints $timezone


-- 
Shaun Friedle
[EMAIL PROTECTED]

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: perl script help

2004-04-16 Thread Warren Block
On Fri, 16 Apr 2004, Shaun Friedle wrote:

 #!/usr/bin/perl
 $timezone=`date +\%z`;#Gets the offset in $timezone
 $timezone =~ s/(\+[0-9][0-9])/$1:/;   #Replaces ±NN with ±NN:
 print $timezone;  #Prints $timezone

The regex should allow either a plus or a minus as the first character:
s/([+-][0-9]{2})/$1:/

I like Perl a lot, and use it often, but it seems a bit much for this.
If there were easy shell substring operations...  Anyway, shell-only:

date +%z | sed 's/.../:/'  # insert colon after first three chars

-Warren Block * Rapid City, South Dakota USA
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]