| 1 | # | ||||||||||||||||||||||||||||||
| 2 | # $Id: Filter.pm,v 8ee92019aa06 2023/03/07 16:29:38 gomor $ | ||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||
| 4 | package OPP::Proc::Filter; | ||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use base qw(OPP::Proc); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 9 | 1 | __PACKAGE__->cgBuildIndices; | |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||
| 11 | 1 | our $VERSION = '1.00'; | |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||
| 13 | # | ||||||||||||||||||||||||||||||
| 14 | # | fieldcount domain | filter domaincount:>=3 | ||||||||||||||||||||||||||||||
| 15 | # | ||||||||||||||||||||||||||||||
| 16 | sub process { | ||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||
|
Subroutine
process: not called CC=17 SCAR=57.2
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 18 | 0 | my ($input) = @_; | |||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | my $options = $self->options or return; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||
| 22 | 0 | for my $o (keys %$options) { | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | next if $o eq 'args'; # Skip original arguments line | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 24 | 0 | my $values = $self->value($input, $o); | |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | next unless $values; # Skip input when no field found | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 26 | 0 | my $filter = $options->{$o}; # Example: $filter = [ >=3 ] | |||||||||||||||||||||||||||||
| 27 | 0 | $filter = $filter->[0]; # Example: $filter >= 3 | |||||||||||||||||||||||||||||
| 28 | 0 | for my $this (@$values) { # Example: $this = 3 | |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | if ($filter =~ m{((?:>|<|>=|<=|=))(\d+)$}) { # Example: $1 = >=, $2 = 3 | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | if ($1 eq '>' ) { $self->output->add($input) if $this > $2 } | ||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | elsif ($1 eq '>=') { $self->output->add($input) if $this >= $2 } | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | elsif ($1 eq '<' ) { $self->output->add($input) if $this < $2 } | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | elsif ($1 eq '<=') { $self->output->add($input) if $this <= $2 } | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | elsif ($1 eq '=' ) { $self->output->add($input) if $this == $2 } | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||
| 39 | 0 | return 1; | |||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||
| 42 | 1 | 1; | |||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||
| 44 | __END__ | ||||||||||||||||||||||||||||||