[ic] problem with new filter

Eros Shop info at eros-shop.co.uk
Fri May 7 14:22:10 EDT 2004


Hi everyone,

I'm having a spot of bother whilst trying to write a new [filter] op that's 
supposed to return anything before and including the first "." (dot) in the 
string passed to it.

eg.

[filter op=sentence]This is sentence one. This is sentence two.[/filter]

returns:  "This is sentence one."


Following the working example in the online docs, I've put this in my 
interchange.cfg and tried to restart IC.

GlobalSub <<EOR
sub new_filter {
     BEGIN {
         package Vend::Interpolate;
         $Filter{sentence} = sub {
                             my $val = shift;
                             $val =~ m/^*\.//o;
                             return $val;
                             };
     }
}
EOR

Once the above is added IC refuses to start up giving the following error:

Starting Interchange: Bad GlobalSub 'new_filter': Bareword "o" not allowed 
while "strict subs" in use at (eval 124) line 6, <GLOBAL> line 17.
BEGIN not safe after errors--compilation aborted at (eval 124) line 9, 
<GLOBAL> line 17.
In line 17 of the configuration file '/etc/interchange.cfg':
GlobalSub <<EOR

The original example for reverse I got from 
http://www.icdevgroup.org/i/dev/docfly.html?mv_arg=ictags04%2e28 is fine 
and IC loads up, so it must be my code that's at fault.

Sadly my limited Perl knowledge doesn't permit me to understand the error 
to know what I'm doing wrong here.

I'd be very grateful if someone could point out my silly mistake(s) :)

Many thanks

Mark



Eros Shop
vwe internet ltd
PO BOX 1067
SLOUGH
SL1 7YA
UK

Shop - http://www.eros-shop.co.uk
EMail - info at eros-shop.co.uk
Tel - 0870 737 3369
Fax - 0870 737 4469




More information about the interchange-users mailing list