[ic] problem with new filter
Kevin Walsh
kevin at cursor.biz
Tue May 11 13:43:01 EDT 2004
Mark Bryant [mark at vwe.net] wrote:
> I found the final solution in:
>
> GlobalSub <<EOR
> sub new_filter {
> BEGIN {
> package Vend::Interpolate;
> $Filter{sentence} = sub {
> my $val = shift;
> my $crap;
> ($val, $crap) = split (/(\. |\.<)/, $val);
> $val = $val . ".";
> return $val;
> };
> }
> }
> EOR
>
> I had to take into account the opening brackets of HTML tags too ;)
>
I may be a bit late, now that you've found your final solution, but
I would suggest the following:
my $val = shift;
$val =~ s/^(.*?\.)[\s<]+.*/$1/s;
return $val;
I would also suggest that you take Mike Heins' advice and use a CodeDef
instead of a GlobalSub.
--
_/ _/ _/_/_/_/ _/ _/ _/_/_/ _/ _/
_/_/_/ _/_/ _/ _/ _/ _/_/ _/ K e v i n W a l s h
_/ _/ _/ _/ _/ _/ _/ _/_/ kevin at cursor.biz
_/ _/ _/_/_/_/ _/ _/_/_/ _/ _/
More information about the interchange-users
mailing list