Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: Looking for feed back on a guestbookby George_Sherston (Vicar) |
on Nov 15, 2001 at 12:16 UTC ( [id://125525]=note: print w/replies, xml ) | Need Help?? |
A few more pence in the pound: (1) I'd use a module for stripping those tags, especially since you want to allow some and disallow others. I've not looked at this before, but there's bound to be one somewhere... searches CPAN for HTML stuff... well, just from glancing at the docs, looks like HTM::TagFilter would do just what you want. Looks as though it wd let you be pretty flexible abt what html you allowed your users, in an easy to maintain kind of way. (2) Wog alluded to this one in a different context: you cd do your censor in one regex: $message =~ s/badword2|badword3|badword/bleep/ig;Although n.b. you have to be a little careful with the order of your search words, if some of them "contain" others. You notice I have instead of because the latter wd turn "badword2" into "bleep2". (3) About printing out, I agree with the monks who say use CGI or die;, and also those who say that if you do You don't need then to do My preference in a short script (or in any script, because I have only a limited understanding of OO programming) is the former. Then you could do all your printing right at the end, after munging around your $message etc variables, with these lines which (and I agree beauty is in the eye of the beholder) I think are elegant and easy to read: Hope that's some use. Please do post your revised code when you're finished with it, as it makes the thread a more complete learning resource for future generations. § George Sherston
In Section
Seekers of Perl Wisdom
|
|