| 1 | package Catmandu::Cmd::count; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 14 | ▶ | use Catmandu::Sane; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 14 | our $VERSION = '1.2025'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 14 | ▶ | use parent 'Catmandu::Cmd'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 14 | ▶ | use Catmandu; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 14 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | sub command_opt_spec { | ||||||||||||||||||||||||||
|
Subroutine
command_opt_spec: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 12 | 1 | (["cql-query|q=s", ""], ["query=s", ""],); | |||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | sub command { | ||||||||||||||||||||||||||
|
Subroutine
command: called CC=4 SCAR=17.3
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | 1 | my ($self, $opts, $args) = @_; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | my ($from_args, $from_opts) = $self->_parse_options($args); | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 1 | my $from_bag = delete $from_opts->{bag}; | |||||||||||||||||||||||||||
| 21 | 1 | my $from = Catmandu->store($from_args->[0], $from_opts)->bag($from_bag); | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 1 | ▶ | if ($opts->query // $opts->cql_query) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$opts->query // $opts->cql_query
MC/DC0%0/2
$opts->query // $opts->cql_query
$opts->query
$opts->cql_query
Truth table33%1/3
A // B
A= $opts->queryB= $opts->cql_query
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | $self->usage_error("Bag isn't searchable") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | unless $from->can('searcher'); | ||||||||||||||||||||||||||||
| 26 | 0 | $from = $from->searcher( | |||||||||||||||||||||||||||
| 27 | cql_query => $opts->cql_query, | ||||||||||||||||||||||||||||
| 28 | query => $opts->query, | ||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 1 | say $from->count; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 14 | 1; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | __END__ | ||||||||||||||||||||||||||||