Curious behaviour of Text::Parse::shellwords (was: [ic] Errors (Unknown filter)

Stefan Hornburg Racke interchange-users@interchange.redhat.com
Fri Sep 28 16:10:47 2001


Michael Hall <mhall@riverside.org> writes:

> I recently installed the 4.8.2 tarball and setup a few catalogs, two each
> of 'tools' and 'reports', one to keep original and the other for development.
> Seeing all kinds of these errors in all the individual catalog 'error.log',
> even the unmodified ones, nothing in the main 'error.log' though.
> 
> Any ideas what these are from and how to fix the problem causing them?
> 
> 209.102.66.12 aYbZtxcI:209.102.66.12 - [21/September/2001:23:14:47 -0700] 482-tools /cgi-bin/482-tools/admin/flex_select.html Unknown filter
> 209.102.66.12 aYbZtxcI:209.102.66.12 - [21/September/2001:23:14:38 -0700] 482-tools /cgi-bin/482-tools/ui Unknown filter
> 209.102.66.12 aYbZtxcI:209.102.66.12 - [21/September/2001:23:08:52 -0700] 482-tools /cgi-bin/482-tools/scan/MM=2851c7a206b416f673c18c5a97519e63:0:49:50 Unknown filter
> 
> 209.102.66.12 nrprizB4:209.102.66.12 - [21/September/2001:00:28:36 -0700]
482-reports /cgi-bin/482-reports/admin/flex_select Unknown filter

I traced it down to the following:
flex_select

	for(@$line) {
		my $filter = $filter_show[$i] || '';
		$filter .= ' encode_entities' unless $filter =~ /\b(?:encode_)?entities\b/;

		my $extra = '';
		$extra .= " $1" while $filter =~ s/(v?align=\w+)//i;

Log("$i filter = $filter");

		$_ = $Tag->filter($filter, $_);
		s/\[/&#91;/g;
		$out .= "<TD$extra>$_</TD>";
		$i++;
	}
	return $out . "\n";

if $filter_show[$i] is false, $filter becomes '' and in the 
next line ' encode_entities'.

$filter is passed to Vend::Interpolate::filter_value and there we read:

	my @filters = Text::ParseWords::shellwords($filter); 

@filters evaluates to ('', 'encode_entities'). Duh !!!

If I run 'set      a        b         c' in the shell, I get
$1='a'. 

Why returns T::P::shellwords two entries (Perl from the stone age,
as you would say resp. 5.005).

Ciao
        Racke

-- 
Racke happily hacks Interchange and maintains Debian packages like Courier.

For projects and other business stuff please refer to COBOLT NetServices
(URL: http://www.cobolt.net; Email: info@cobolt.net; Phone: 0041-1-3884400)