"perlcode 2" creates faulty script
Brought to you by:
toddatkins
When embedding perlcode into the swatch script, the
statement:
perlcode 2 something
creates a faulty script. The script contains the
"something" in the correct location, PLUS a line like this:
perlcode('' => "something", 'MESSAGE' => "$_", );
which breaks the swatch script.
An example swatch script is attached. This colorizes
the first packet in each direction of a tcpdump output.
Usage:
swatch -c swatch.perlcode2.example --read-pipe
'tcpdump -i eth0 ! port 22'
Swatch script for colorizing tcpdump output
Logged In: YES
user_id=1404363
Originator: NO
This Patch will fix it in Version 3.2.2:
--- swatch.orig 2008-02-05 20:04:14.000000000 +0100
+++ swatch 2008-02-05 19:51:07.000000000 +0100
@@ -720,6 +720,8 @@
my $act = $a_ref->{action};
if ($act eq 'perlcode' and $a_ref->{depth} == 3) {
$code .= "\t$a_ref->{value}\n";
+ } elsif ($act eq 'perlcode' and $a_ref->{depth} == 2) {
+ next;
} elsif ($act eq 'continue') {
$do_continue = 1;
} elsif ($act eq 'quit') {