App-grep-url
view release on metacpan or search on metacpan
* 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_urls => *int* (default: -1)
* min_urls => *uint* (default: 1)
* path_contains => *str*
* path_matches => *re*
* path_not_contains => *str*
* query_param_contains => *hash*
* query_param_matches => *hash*
* query_param_not_contains => *hash*
* quiet => *true*
* scheme_contains => *str*
* scheme_matches => *re*
* scheme_not_contains => *str*
* schemes => *array[str]* (default: ["http","file"])
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
lib/App/grep/url.pm view on Meta::CPAN
'x.name.singular' => 'scheme',
schema => ['array*', of=>['str*',in=>[qw/http ftp file ssh/]]],
default => ['http', 'file'],
tags => ['category:url-criteria'],
},
scheme_contains => {
schema => 'str*',
tags => ['category:url-criteria'],
},
scheme_not_contains => {
schema => 'str*',
tags => ['category:url-criteria'],
},
scheme_matches => {
schema => 're*',
tags => ['category:url-criteria'],
},
host_contains => {
schema => 'str*',
tags => ['category:url-criteria'],
},
host_not_contains => {
schema => 'str*',
tags => ['category:url-criteria'],
},
host_matches => {
schema => 're*',
tags => ['category:url-criteria'],
},
path_contains => {
schema => 'str*',
tags => ['category:url-criteria'],
},
path_not_contains => {
schema => 'str*',
tags => ['category:url-criteria'],
},
path_matches => {
schema => 're*',
tags => ['category:url-criteria'],
},
query_param_contains => {
schema => ['hash*', of=>'str*'],
tags => ['category:url-criteria'],
},
query_param_not_contains => {
schema => ['hash*', of=>'str*'],
tags => ['category:url-criteria'],
},
query_param_matches => {
schema => ['hash*', of=>'str*'], # XXX of re
tags => ['category:url-criteria'],
},
files => {
'x.name.is_plural' => 1,
lib/App/grep/url.pm view on Meta::CPAN
# scheme criteria
if (defined $fargs->{scheme_contains}) {
if ($fargs->{ignore_case} ?
index(lc($url->scheme), lc($fargs->{scheme_contains})) >= 0 :
index($url->scheme , $fargs->{scheme_contains}) >= 0) {
} else {
next;
}
}
if (defined $fargs->{scheme_not_contains}) {
if ($fargs->{ignore_case} ?
index(lc($url->scheme), lc($fargs->{scheme_not_contains})) < 0 :
index($url->scheme , $fargs->{scheme_not_contains}) < 0) {
} else {
next;
}
}
if (defined $fargs->{scheme_matches}) {
if ($fargs->{ignore_case} ?
$url->scheme =~ qr/$fargs->{scheme_matches}/i :
$url->scheme =~ qr/$fargs->{scheme_matches}/) {
} else {
next;
lib/App/grep/url.pm view on Meta::CPAN
# host criteria
if (defined $fargs->{host_contains}) {
if ($fargs->{ignore_case} ?
index(lc($url->host), lc($fargs->{host_contains})) >= 0 :
index($url->host , $fargs->{host_contains}) >= 0) {
} else {
next;
}
}
if (defined $fargs->{host_not_contains}) {
if ($fargs->{ignore_case} ?
index(lc($url->host), lc($fargs->{host_not_contains})) < 0 :
index($url->host , $fargs->{host_not_contains}) < 0) {
} else {
next;
}
}
if (defined $fargs->{host_matches}) {
if ($fargs->{ignore_case} ?
$url->host =~ qr/$fargs->{host_matches}/i :
$url->host =~ qr/$fargs->{host_matches}/) {
} else {
next;
lib/App/grep/url.pm view on Meta::CPAN
# path criteria
if (defined $fargs->{path_contains}) {
if ($fargs->{ignore_case} ?
index(lc($url->path), lc($fargs->{path_contains})) >= 0 :
index($url->path , $fargs->{path_contains}) >= 0) {
} else {
next;
}
}
if (defined $fargs->{path_not_contains}) {
if ($fargs->{ignore_case} ?
index(lc($url->path), lc($fargs->{path_not_contains})) < 0 :
index($url->path , $fargs->{path_not_contains}) < 0) {
} else {
next;
}
}
if (defined $fargs->{path_matches}) {
if ($fargs->{ignore_case} ?
$url->path =~ qr/$fargs->{path_matches}/i :
$url->path =~ qr/$fargs->{path_matches}/) {
} else {
next;
lib/App/grep/url.pm view on Meta::CPAN
if (defined $fargs->{query_param_contains}) {
for my $param (keys %{ $fargs->{query_param_contains} }) {
if ($fargs->{ignore_case} ?
index((lc($url->query_param($param)) // ''), lc($fargs->{query_param_contains}{$param})) >= 0 :
index(($url->query_param($param) // '') , $fargs->{query_param_contains}{$param}) >= 0) {
} else {
next URL;
}
}
}
if (defined $fargs->{query_param_not_contains}) {
for my $param (keys %{ $fargs->{query_param_not_contains} }) {
if ($fargs->{ignore_case} ?
index((lc($url->query_param($param)) // ''), lc($fargs->{query_param_not_contains}{$param})) < 0 :
index(($url->query_param($param) // '') , $fargs->{query_param_not_contains}{$param}) < 0) {
} else {
next URL;
}
}
}
if (defined $fargs->{query_param_matches}) {
for my $param (keys %{ $fargs->{query_param_matches} }) {
if ($fargs->{ignore_case} ?
($url->query_param($param) // '') =~ qr/$fargs->{query_param_matches}{$param}/i :
($url->query_param($param) // '') =~ qr/$fargs->{query_param_matches}{$param}/) {
lib/App/grep/url.pm view on Meta::CPAN
=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_urls> => I<int> (default: -1)
=item * B<min_urls> => I<uint> (default: 1)
=item * B<path_contains> => I<str>
=item * B<path_matches> => I<re>
=item * B<path_not_contains> => I<str>
=item * B<query_param_contains> => I<hash>
=item * B<query_param_matches> => I<hash>
=item * B<query_param_not_contains> => I<hash>
=item * B<quiet> => I<true>
=item * B<scheme_contains> => I<str>
=item * B<scheme_matches> => I<re>
=item * B<scheme_not_contains> => I<str>
=item * B<schemes> => I<array[str]> (default: ["http","file"])
=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
( run in 0.263 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )