| 1 | # | ||
| 2 | # $Id: Where.pm,v 69a3d7308875 2023/04/05 15:11:02 gomor $ | ||
| 3 | # | ||
| 4 | package OPP::Proc::Where; | ||
| 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 | __PACKAGE__->cgBuildIndices; | ||
| 10 | |||
| 11 | 1 | ▶ | use Onyphe::Api; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | |||
| 13 | our $VERSION = '1.00'; | ||
| 14 | |||
| 15 | my $oa = Onyphe::Api->new->init or die("where: init failed"); | ||
| 16 | $oa->silent(1); | ||
| 17 | $oa->verbose(0); | ||
| 18 | |||
| 19 | # | ||
| 20 | # NOTE: this where output only results from the previous proc | ||
| 21 | # | ||
| 22 | # | where category:datascan ip:$ip | ||
| 23 | # | ||
| 24 | sub process { | ||
| 25 | 0 | ▶ | my $self = shift; |
|
Subroutine
process: not called CC=1 SCAR=6.9
| |||
| 26 | 0 | my ($input) = @_; | |
| 27 | |||
| 28 | 0 | my $options = $self->options; | |
| 29 | 0 | my $args = $options->{args}; | |
| 30 | |||
| 31 | # Update place holders with found input values: | ||
| 32 | 0 | my $searches = $self->placeholder($args, $input); | |
| 33 | |||
| 34 | my $cb = sub { | ||
| 35 | 0 | ▶ | my ($results) = @_; |
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||
| 36 | 0 | for my $r (@$results) { | |
| 37 | # Keep original result if matches were found: | ||
| 38 | 0 | $self->output->add($input); | |
| 39 | } | ||
| 40 | 0 | }; | |
| 41 | |||
| 42 | 0 | $oa->search($searches->[0], 1, 1, { trackquery => 'true' }, $cb); # Use default callback | |
| 43 | |||
| 44 | 0 | return 1; | |
| 45 | } | ||
| 46 | |||
| 47 | 1; | ||
| 48 | |||
| 49 | __END__ | ||