sub validate { my $text = shift; my $new_text = ''; my %is_approved = (); my @approved_tags = ( 'a', 'p', 'br', 'b', 'i', 'strong', 'tt', 'small', 'strike', 's', 'u', 'sub', 'sup', 'blockquote', 'table', 'th', 'tr', 'td', 'caption', 'thead', 'tfoot', 'tbody', 'colgroup', 'dl', 'dt', 'dd', 'ul', 'li', 'ol', ); foreach( @approved_tags ) { $is_approved{ $_ } = 1 } my $validator = HTML::Parser->new( start_h => [sub { my $self = shift; my ($tagname, $attr, $origtext) = @_; $new_text .= $origtext if ($is_approved{ $tagname }); }, "self, tagname, attr, text"], end_h => [sub { my $self = shift; my ($tagname) = @_; $new_text .= "</$tagname>" if ($is_approved{ $tagname }); + }, "self, tagname"], text_h => [sub { my $self = shift; my ($origtext) = @_; $new_text .= $origtext; }, "self, text"] ); $validator->parse( $text ); return $new_text; }
In reply to Re: (ichimunki) Re: Truncated data using MySQL and DBI
by larsen
in thread Truncated data using MySQL and DBI
by larsen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |