X-Git-Url: http://www.dxcluster.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=perl%2FFilter.pm;h=d45f5096ac8e0ab7ef2226ac7052c1dd133a6252;hb=647730580f6fe6ad14ee8445f0d5d583390cb130;hp=2b30c8cdea5c8484ca348e21442464cf50c9fe65;hpb=23bebd4158e9b66ba5c72c786e76309f6e2b5757;p=spider.git diff --git a/perl/Filter.pm b/perl/Filter.pm index 2b30c8cd..d45f5096 100644 --- a/perl/Filter.pm +++ b/perl/Filter.pm @@ -72,7 +72,9 @@ sub read_in my $s = readfilestr($fn); my $newin = eval $s; dbg('conn', "$@") if $@; - return bless [ @$in ], 'Filter::Old' if $in; + if ($in) { + $newin = bless {filter => $in, name => "$flag$call.pl" }, 'Filter::Old' + } return $newin; } return undef; @@ -83,44 +85,12 @@ sub read_in sub write { my $self = shift; - - my $sort = shift; - my $call = shift; - my $fn = "$filterbasefn/$sort"; - - - # make the output directory - mkdir $fn, 0777 unless -e $fn; - - # write out the file - $fn = "$fn/$call.pl"; - unless (open FILTER, ">$fn") { - warn "can't open $fn $!" ; - return; - } - - my $today = localtime; - print FILTER "#!/usr/bin/perl -# -# Filter for $call stored $today -# -\$in = [ -"; +} - my $ref; - for $ref (@_) { - my ($action, $field, $fieldsort, $comp, $actiondata) = @{$ref}; - print FILTER "\t[ $action, $field, $fieldsort,"; - if ($fieldsort eq 'n' || $fieldsort eq 'r') { - print FILTER "[ ", join (',', $comp), " ],"; - } elsif ($fieldsort eq 'a') { - my $f = $comp; - print FILTER "'$f'"; - } - print FILTER " ],\n"; - } - print FILTER "];\n"; - close FILTER; +sub print +{ + my $self = shift; + return $self->{name}; } package Filter::Old; @@ -161,7 +131,8 @@ use vars qw(@ISA); # sub it { - my $filter = shift; # this is now a bless ref of course but so what + my $self = shift; + my $filter = $self->{filter}; # this is now a bless ref of course but so what my ($action, $field, $fieldsort, $comp, $actiondata); my $ref;