App-grep-email
view release on metacpan or search on metacpan
This is a grep-like utility that greps for emails of certain criteria.
This function is not exported.
Arguments ('*' denotes required arguments):
* address_contains => *str*
* address_matches => *re*
* address_not_contains => *str*
* color => *str* (default: "auto")
* comment_contains => *str*
* comment_matches => *re*
* comment_not_contains => *str*
* count => *true*
Supress normal output, return a count of matching lines.
* files => *array[filename]*
* host_contains => *str*
* host_matches => *re*
* host_not_contains => *str*
* ignore_case => *bool*
* invert_match => *bool*
Invert the sense of matching.
* line_number => *true*
* max_emails => *int* (default: -1)
* min_emails => *uint* (default: 1)
* name_contains => *str*
* name_matches => *re*
* name_not_contains => *str*
* quiet => *true*
* user_contains => *str*
* user_matches => *re*
* user_not_contains => *str*
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status
code (200 means OK, 4xx caller error, 5xx function error). Second
element ($reason) is a string containing error message, or something
like "OK" if status is 200. Third element ($payload) is the actual
result, but usually not present when enveloped result is an error
response ($status_code is not 2xx). Fourth element (%result_meta) is
called result metadata and is optional, a hash that contains extra
lib/App/grep/email.pm view on Meta::CPAN
max_emails => {
schema => 'int*',
default => -1,
tags => ['category:filtering'],
},
comment_contains => {
schema => 'str*',
tags => ['category:email-criteria'],
},
comment_not_contains => {
schema => 'str*',
tags => ['category:email-criteria'],
},
comment_matches => {
schema => 're*',
tags => ['category:email-criteria'],
},
address_contains => {
schema => 'str*',
tags => ['category:email-criteria'],
},
address_not_contains => {
schema => 'str*',
tags => ['category:email-criteria'],
},
address_matches => {
schema => 're*',
tags => ['category:email-criteria'],
},
host_contains => {
schema => 'str*',
tags => ['category:email-criteria'],
},
host_not_contains => {
schema => 'str*',
tags => ['category:email-criteria'],
},
host_matches => {
schema => 're*',
tags => ['category:email-criteria'],
},
user_contains => {
schema => 'str*',
tags => ['category:email-criteria'],
},
user_not_contains => {
schema => 'str*',
tags => ['category:email-criteria'],
},
user_matches => {
schema => 're*',
tags => ['category:email-criteria'],
},
name_contains => {
schema => 'str*',
tags => ['category:email-criteria'],
},
name_not_contains => {
schema => 'str*',
tags => ['category:email-criteria'],
},
name_matches => {
schema => 're*',
tags => ['category:email-criteria'],
},
files => {
'x.name.is_plural' => 1,
lib/App/grep/email.pm view on Meta::CPAN
# comment criteria
if (defined $fargs->{comment_contains}) {
if ($fargs->{ignore_case} ?
index(lc($email->comment), lc($fargs->{comment_contains})) >= 0 :
index($email->comment , $fargs->{comment_contains}) >= 0) {
} else {
next;
}
}
if (defined $fargs->{comment_not_contains}) {
if ($fargs->{ignore_case} ?
index(lc($email->comment), lc($fargs->{comment_not_contains})) < 0 :
index($email->comment , $fargs->{comment_not_contains}) < 0) {
} else {
next;
}
}
if (defined $fargs->{comment_matches}) {
if ($fargs->{ignore_case} ?
$email->comment =~ qr/$fargs->{comment_matches}/i :
$email->comment =~ qr/$fargs->{comment_matches}/) {
} else {
next;
lib/App/grep/email.pm view on Meta::CPAN
# address criteria
if (defined $fargs->{address_contains}) {
if ($fargs->{ignore_case} ?
index(lc($email->address), lc($fargs->{address_contains})) >= 0 :
index($email->address , $fargs->{address_contains}) >= 0) {
} else {
next;
}
}
if (defined $fargs->{address_not_contains}) {
if ($fargs->{ignore_case} ?
index(lc($email->address), lc($fargs->{address_not_contains})) < 0 :
index($email->address , $fargs->{address_not_contains}) < 0) {
} else {
next;
}
}
if (defined $fargs->{address_matches}) {
if ($fargs->{ignore_case} ?
$email->address =~ qr/$fargs->{address_matches}/i :
$email->address =~ qr/$fargs->{address_matches}/) {
} else {
next;
lib/App/grep/email.pm view on Meta::CPAN
# host criteria
if (defined $fargs->{host_contains}) {
if ($fargs->{ignore_case} ?
index(lc($email->host), lc($fargs->{host_contains})) >= 0 :
index($email->host , $fargs->{host_contains}) >= 0) {
} else {
next;
}
}
if (defined $fargs->{host_not_contains}) {
if ($fargs->{ignore_case} ?
index(lc($email->host), lc($fargs->{host_not_contains})) < 0 :
index($email->host , $fargs->{host_not_contains}) < 0) {
} else {
next;
}
}
if (defined $fargs->{host_matches}) {
if ($fargs->{ignore_case} ?
$email->host =~ qr/$fargs->{host_matches}/i :
$email->host =~ qr/$fargs->{host_matches}/) {
} else {
next;
lib/App/grep/email.pm view on Meta::CPAN
# user criteria
if (defined $fargs->{user_contains}) {
if ($fargs->{ignore_case} ?
index(lc($email->user), lc($fargs->{user_contains})) >= 0 :
index($email->user , $fargs->{user_contains}) >= 0) {
} else {
next;
}
}
if (defined $fargs->{user_not_contains}) {
if ($fargs->{ignore_case} ?
index(lc($email->user), lc($fargs->{user_not_contains})) < 0 :
index($email->user , $fargs->{user_not_contains}) < 0) {
} else {
next;
}
}
if (defined $fargs->{user_matches}) {
if ($fargs->{ignore_case} ?
$email->user =~ qr/$fargs->{user_matches}/i :
$email->user =~ qr/$fargs->{user_matches}/) {
} else {
next;
lib/App/grep/email.pm view on Meta::CPAN
# name criteria
if (defined $fargs->{name_contains}) {
if ($fargs->{ignore_case} ?
index(lc($email->name), lc($fargs->{name_contains})) >= 0 :
index($email->name , $fargs->{name_contains}) >= 0) {
} else {
next;
}
}
if (defined $fargs->{name_not_contains}) {
if ($fargs->{ignore_case} ?
index(lc($email->name), lc($fargs->{name_not_contains})) < 0 :
index($email->name , $fargs->{name_not_contains}) < 0) {
} else {
next;
}
}
if (defined $fargs->{name_matches}) {
if ($fargs->{ignore_case} ?
$email->name =~ qr/$fargs->{name_matches}/i :
$email->name =~ qr/$fargs->{name_matches}/) {
} else {
next;
lib/App/grep/email.pm view on Meta::CPAN
This function is not exported.
Arguments ('*' denotes required arguments):
=over 4
=item * B<address_contains> => I<str>
=item * B<address_matches> => I<re>
=item * B<address_not_contains> => I<str>
=item * B<color> => I<str> (default: "auto")
=item * B<comment_contains> => I<str>
=item * B<comment_matches> => I<re>
=item * B<comment_not_contains> => I<str>
=item * B<count> => I<true>
Supress normal output, return a count of matching lines.
=item * B<files> => I<array[filename]>
=item * B<host_contains> => I<str>
=item * B<host_matches> => I<re>
=item * B<host_not_contains> => I<str>
=item * B<ignore_case> => I<bool>
=item * B<invert_match> => I<bool>
Invert the sense of matching.
=item * B<line_number> => I<true>
=item * B<max_emails> => I<int> (default: -1)
=item * B<min_emails> => I<uint> (default: 1)
=item * B<name_contains> => I<str>
=item * B<name_matches> => I<re>
=item * B<name_not_contains> => I<str>
=item * B<quiet> => I<true>
=item * B<user_contains> => I<str>
=item * B<user_matches> => I<re>
=item * B<user_not_contains> => I<str>
=back
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code
(200 means OK, 4xx caller error, 5xx function error). Second element
($reason) is a string containing error message, or something like "OK" if status is
200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth
( run in 1.232 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )