| 1 | # | ||||||||||
| 2 | # $Id: Dedup.pm,v 58d7ce835577 2023/03/25 10:34:10 gomor $ | ||||||||||
| 3 | # | ||||||||||
| 4 | package OPP::Proc::Dedup; | ||||||||||
| 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 | # | dedup hostname | ||||||||||
| 15 | # | dedup hostname,ip | ||||||||||
| 16 | # | ||||||||||
| 17 | sub process { | ||||||||||
| 18 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
process: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||
| 19 | 0 | my ($input) = @_; | |||||||||
| 20 | |||||||||||
| 21 | 0 | my $fields = $self->options->{0}; | |||||||||
| 22 | 0 | ▶ | return unless defined($fields); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | |||||||||||
| 24 | 0 | my @fields = split('\s*,\s*', $fields); | |||||||||
| 25 | |||||||||||
| 26 | 0 | my $k = ''; | |||||||||
| 27 | 0 | for my $this (@fields) { | |||||||||
| 28 | 0 | my $values = $self->value($input, $this); | |||||||||
| 29 | 0 | ▶ | next unless defined($values); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 0 | for my $v (@$values) { | |||||||||
| 31 | 0 | $k .= $this.'-'.$v.':'; | |||||||||
| 32 | } | ||||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | # Skip when no key found: | ||||||||||
| 36 | 0 | ▶ | return 1 unless length $k; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | |||||||||||
| 38 | 0 | ▶ | $self->output->add($input) unless $self->state->exists($k, $self->idx); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 0 | $self->state->incr($k, $self->idx); | |||||||||
| 40 | |||||||||||
| 41 | 0 | return 1; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 1 | 1; | |||||||||
| 45 | |||||||||||
| 46 | __END__ | ||||||||||