view release on metacpan or search on metacpan
t/boilerplate.t view on Meta::CPAN
use warnings FATAL => 'all';
use Test::More;
plan tests => 3;
sub not_in_file_ok {
my ($filename, %regex) = @_;
open( my $fh, '<', $filename )
or die "couldn't open $filename for reading: $!";
my %violated;
t/boilerplate.t view on Meta::CPAN
}
}
sub module_boilerplate_ok {
my ($module) = @_;
not_in_file_ok($module =>
'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
);
}
TODO: {
local $TODO = "Need to replace the boilerplate text";
not_in_file_ok(README =>
"The README is used..." => qr/The README is used/,
"'version information here'" => qr/to provide version information/,
);
not_in_file_ok(Changes =>
"placeholder date/time" => qr(Date/time)
);
module_boilerplate_ok('lib/Backup/Duplicity/YADW.pm');
view all matches for this distribution
view release on metacpan or search on metacpan
t/boilerplate.t view on Meta::CPAN
use warnings FATAL => 'all';
use Test::More;
plan tests => 3;
sub not_in_file_ok {
my ($filename, %regex) = @_;
open( my $fh, '<', $filename )
or die "couldn't open $filename for reading: $!";
my %violated;
t/boilerplate.t view on Meta::CPAN
}
}
sub module_boilerplate_ok {
my ($module) = @_;
not_in_file_ok($module =>
'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
);
}
TODO: {
# local $TODO = "Need to replace the boilerplate text";
not_in_file_ok(README =>
"The README is used..." => qr/The README is used/,
"'version information here'" => qr/to provide version information/,
);
not_in_file_ok(Changes =>
"placeholder date/time" => qr(Date/time)
);
module_boilerplate_ok('lib/Backup/EZ.pm');
view all matches for this distribution
view release on metacpan or search on metacpan
t/boilerplate.t view on Meta::CPAN
use 5.006;
use strict;
use warnings;
use Test::More tests => 3;
sub not_in_file_ok {
my ($filename, %regex) = @_;
open( my $fh, '<', $filename )
or die "couldn't open $filename for reading: $!";
my %violated;
t/boilerplate.t view on Meta::CPAN
}
}
sub module_boilerplate_ok {
my ($module) = @_;
not_in_file_ok($module =>
'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
);
}
TODO: {
local $TODO = "Need to replace the boilerplate text";
not_in_file_ok(README =>
"The README is used..." => qr/The README is used/,
"'version information here'" => qr/to provide version information/,
);
not_in_file_ok(Changes =>
"placeholder date/time" => qr(Date/time)
);
module_boilerplate_ok('lib/Backup/Omni.pm');
view all matches for this distribution
view release on metacpan or search on metacpan
nextchar|||
ninstr|||n
no_bareword_allowed|||
no_fh_allowed|||
no_op|||
not_a_number|||
nothreadhook||5.008000|
nuke_stacks|||
num_overflow|||n
oopsAV|||
oopsHV|||
# if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
# define PERL_PATCHLEVEL_H_IMPLICIT
# include <patchlevel.h>
# endif
# if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
# include <could_not_find_Perl_patchlevel.h>
# endif
# ifndef PERL_REVISION
# define PERL_REVISION (5)
/* Replace: 1 */
# define PERL_VERSION PATCHLEVEL
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Badger/App.pm view on Meta::CPAN
$option->args($args, $self->{ app }, $self);
}
return $self;
# $self->debug("options schema for this app is: ", $schema);
# $self->not_implemented('in base class');
}
sub validate {
my $self = shift->prototype;
lib/Badger/App.pm view on Meta::CPAN
sub run {
my $self = shift;
$self->validate;
$self->not_implemented('in base class');
}
#-----------------------------------------------------------------------
# output generation
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BalanceOfPower/Player/Role/Hitman.pm view on Meta::CPAN
}
sub check_targets
{
my $self = shift;
my $world = shift;
my @not_achieved = ();
for( @{$self->targets})
{
my $t = $_;
if($t->achieved($self))
{
$self->point;
$self->register_event("ACHIEVED TARGET: " . $t->name);
}
else
{
push @not_achieved, $t;
}
}
$self->targets(\@not_achieved);
}
sub click_targets
{
my $self = shift;
my $world = shift;
my @not_passed = ();
for( @{$self->targets})
{
my $t = $_;
if($t->click)
{
$self->register_event("TIME EXPIRED FOR TARGET: " . $t->name);
}
else
{
push @not_passed, $t;
}
}
$self->targets(\@not_passed);
}
sub point
{
my $self = shift;
$self->mission_points($self->mission_points + 1);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Banal/Config.pm view on Meta::CPAN
has 'cfg_context' => (is => 'rw', lazy_build=>1); # If you do not set this, you can also provide it with the 'cfg_context' switch or the '-Banal_ConfigContext' option. Otherwise, it will take upon the value given by 'cfg_context_default'
has 'cfg_context_default' => (is => 'rw', lazy_build=>1); # You may wish to override this, if needed.
has 'default_options_for_banal_get_data' => (is => 'rw', default=>sub {
{
search_upwards_while_not_defined => 1,
use_path_semantics => 1,
path_separator => '/',
remove_extra_separators => 1,
remove_leading_separator => 0,
remove_trailing_separator => 1,
view all matches for this distribution
view release on metacpan or search on metacpan
t/boilerplate.t view on Meta::CPAN
use warnings FATAL => 'all';
use Test::More;
plan tests => 3;
sub not_in_file_ok {
my ($filename, %regex) = @_;
open( my $fh, '<', $filename )
or die "couldn't open $filename for reading: $!";
my %violated;
t/boilerplate.t view on Meta::CPAN
}
}
sub module_boilerplate_ok {
my ($module) = @_;
not_in_file_ok($module =>
'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
);
}
TODO: {
local $TODO = "Need to replace the boilerplate text";
not_in_file_ok(README =>
"The README is used..." => qr/The README is used/,
"'version information here'" => qr/to provide version information/,
);
not_in_file_ok(Changes =>
"placeholder date/time" => qr(Date/time)
);
module_boilerplate_ok('lib/Banal/DateTime.pm');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Banal/Utils/Data.pm view on Meta::CPAN
# Function, not a method!
#----------------------------------
sub banal_get_data {
my $args = {@_};
my $opts = $args->{options} || {};
my $search_upwards_while_not_defined = $opts->{search_upwards_while_not_defined};
# This is where the MAGIC happens. For a full list of options, see the function "normalize_data_root_and_keys()".
my ($root, @keys) = _normalize_data_root_and_keys (@_);
lib/Banal/Utils/Data.pm view on Meta::CPAN
while (scalar(@keys) >= 0) {
my $value= _banal_basic_get_data_via_key_list(data=>$root, keys=>[@keys, $key]);
return $value if defined($value);
# Continue searching upwards if we are allowed to do so. Return otherwise.
return unless $search_upwards_while_not_defined;
pop @keys;
}
return;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/boilerplate.t view on Meta::CPAN
use 5.006;
use strict;
use warnings;
use Test::More tests => 3;
sub not_in_file_ok {
my ($filename, %regex) = @_;
open( my $fh, '<', $filename )
or die "couldn't open $filename for reading: $!";
my %violated;
t/boilerplate.t view on Meta::CPAN
}
}
sub module_boilerplate_ok {
my ($module) = @_;
not_in_file_ok($module =>
'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
);
}
TODO: {
local $TODO = "Need to replace the boilerplate text";
not_in_file_ok("README.md" =>
"The README is used..." => qr/The README is used/,
"'version information here'" => qr/to provide version information/,
);
not_in_file_ok(Changes =>
"placeholder date/time" => qr(Date/time)
);
module_boilerplate_ok('lib/Barcode/DataMatrix.pm');
view all matches for this distribution
view release on metacpan or search on metacpan
nextchar|||
ninstr|||
no_bareword_allowed|||
no_fh_allowed|||
no_op|||
not_a_number|||
nothreadhook||5.008000|
nuke_stacks|||
num_overflow|||n
oopsAV|||
oopsCV|||
!(defined(PATCHLEVEL) && defined(SUBVERSION))
#define PERL_PATCHLEVEL_H_IMPLICIT
#include <patchlevel.h>
#endif
#if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
#include <could_not_find_Perl_patchlevel.h>
#endif
#ifndef PERL_REVISION
#define PERL_REVISION (5)
/* Replace: 1 */
#define PERL_VERSION PATCHLEVEL
view all matches for this distribution
view release on metacpan or search on metacpan
xt/boilerplate.t view on Meta::CPAN
use warnings;
use Test::More;
plan tests => 3;
sub not_in_file_ok {
my ($filename, %regex) = @_;
open( my $fh, '<', $filename )
or die "couldn't open $filename for reading: $!";
my %violated;
xt/boilerplate.t view on Meta::CPAN
}
}
sub module_boilerplate_ok {
my ($module) = @_;
not_in_file_ok($module =>
'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
);
}
TODO: {
local $TODO = "Need to replace the boilerplate text";
not_in_file_ok(README =>
"The README is used..." => qr/The README is used/,
"'version information here'" => qr/to provide version information/,
);
not_in_file_ok(Changes =>
"placeholder date/time" => qr(Date/time)
);
module_boilerplate_ok('lib/Basic/Coercion/XS.pm');
view all matches for this distribution
view release on metacpan or search on metacpan
xt/boilerplate.t view on Meta::CPAN
use warnings;
use Test::More;
plan tests => 3;
sub not_in_file_ok {
my ($filename, %regex) = @_;
open( my $fh, '<', $filename )
or die "couldn't open $filename for reading: $!";
my %violated;
xt/boilerplate.t view on Meta::CPAN
}
}
sub module_boilerplate_ok {
my ($module) = @_;
not_in_file_ok($module =>
'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
);
}
TODO: {
local $TODO = "Need to replace the boilerplate text";
not_in_file_ok(README =>
"The README is used..." => qr/The README is used/,
"'version information here'" => qr/to provide version information/,
);
not_in_file_ok(Changes =>
"placeholder date/time" => qr(Date/time)
);
module_boilerplate_ok('lib/Basic/Types/XS.pm');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Basset/DB/Table.pm view on Meta::CPAN
'db_read_translation' => {},
'column_aliases' => {},
'references' => {},
'_cached_queries' => {},
'_cached_bindables' => {},
'attributes_not_to_create' => [],
'create_attributes' => 0,
'last_insert_query' => 'SELECT LAST_INSERT_ID()',
@_
);
lib/Basset/DB/Table.pm view on Meta::CPAN
%init
);
};
__PACKAGE__->add_attr('_attributes_to_create');
__PACKAGE__->add_attr('attributes_not_to_create');
__PACKAGE__->add_attr('create_attributes');
sub attributes_to_create {
my $self = shift;
if (@_) {
$self->_attributes_to_create($_[0]);
};
my %not = map {$_, 1} @{$self->attributes_not_to_create};
return grep {! $not{$_} } $self->alias_column($self->_attributes_to_create ? @{$self->_attributes_to_create} : $self->cols);
}
=pod
view all matches for this distribution
view release on metacpan or search on metacpan
etc/webservice.wsdl view on Meta::CPAN
<xs:simpleType name="Recstatus">
<xs:union memberTypes="tns:RecordingStatus" />
</xs:simpleType>
<xs:simpleType name="RecordingStatus">
<xs:restriction base="xs:string">
<xs:enumeration value="not_applicable" />
<xs:enumeration value="not_available" />
<xs:enumeration value="in_progress" />
<xs:enumeration value="available" />
</xs:restriction>
</xs:simpleType>
</xs:schema>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Beagle/Cmd/Command/att.pm view on Meta::CPAN
$pid = $bh->info->id;
}
elsif ( $self->parent ) {
my @ret = resolve_entry( $self->parent, handle => current_handle() || undef );
unless (@ret) {
@ret = resolve_entry($pid) or die_entry_not_found($pid);
}
die_entry_ambiguous( $pid, @ret ) unless @ret == 1;
$pid = $ret[0]->{id};
$bh = $ret[0]->{handle};
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/exception.t view on Meta::CPAN
like $@, qr{\QService 'foo' not found}, 'stringifies';
subtest 'not found with file shows file name' => sub {
my $path = $SHARE_DIR->child( 'file.yml' )->stringify;
my $wire = Beam::Wire->new( file => $path );
throws_ok { $wire->get( 'does_not_exist' ) } 'Beam::Wire::Exception::NotFound';
is $@->name, 'does_not_exist';
like $@, qr{\QService 'does_not_exist' not found in file '$path'}, 'stringifies';
};
};
subtest "extend a service that doesn't exist" => sub {
my $wire = Beam::Wire->new(
view all matches for this distribution
view release on metacpan or search on metacpan
examples/dashboard/lib/Beekeeper/Service/Dashboard/Worker.pm view on Meta::CPAN
$self->bind_remote_session( address => "frontend.dashboard-$username" );
return 1;
}
Beekeeper::JSONRPC::Error->request_not_authenticated;
}
sub service_stats {
my ($self, $params, $req) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bencher/Scenario/ManipulatingSymbolTable/CheckingSymbolExists.pm view on Meta::CPAN
our $VERSION = '0.001'; # VERSION
our $scenario = {
summary => 'Benchmark checking symbol exists',
participants => [
{name => 'PS:XS not exists', module => 'Package::Stash::XS', code_template => 'Package::Stash::XS->new("main")->has_symbol(q[$should_not_exist])'},
{name => 'PS:PP not exists', module => 'Package::Stash::PP', code_template => 'Package::Stash::PP->new("main")->has_symbol(q[$should_not_exist])'},
{name => 'PS:XS exists' , module => 'Package::Stash::XS', code_template => 'Package::Stash::XS->new("main")->has_symbol(q[$should_exist])'},
{name => 'PS:PP exists' , module => 'Package::Stash::PP', code_template => 'Package::Stash::PP->new("main")->has_symbol(q[$should_exist])'},
],
};
lib/Bencher/Scenario/ManipulatingSymbolTable/CheckingSymbolExists.pm view on Meta::CPAN
=item * PS:XS not exists (perl_code)
Code template:
Package::Stash::XS->new("main")->has_symbol(q[$should_not_exist])
=item * PS:PP not exists (perl_code)
Code template:
Package::Stash::PP->new("main")->has_symbol(q[$should_not_exist])
=item * PS:XS exists (perl_code)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Benchmark/Command.pm view on Meta::CPAN
$count //= $ENV{BENCHMARK_COMMAND_COUNT} // 0;
$opts //= {};
$opts->{quiet} //= $ENV{BENCHMARK_COMMAND_QUIET} // $ENV{QUIET} // 0;
$opts->{ignore_exit_code} //= $ENV{BENCHMARK_COMMAND_IGNORE_EXIT_CODE} // 0;
$opts->{skip_not_found} //= $ENV{BENCHMARK_COMMAND_SKIP_NOT_FOUND} // 0;
ref($cmds) eq 'HASH' or die "cmds must be a hashref";
my $subs = {};
my $longest = 0;
lib/Benchmark/Command.pm view on Meta::CPAN
}
$per_cmd_opts->{env} //= {};
@cmd or die "cmds->{$cmd_name} must not be empty";
unless (which $cmd[0]) {
if ($per_cmd_opts->{skip_not_found} // $opts->{skip_not_found}) {
warn "cmds->{$cmd_name}: program '$cmd[0]' not found, ".
"skipped\n";
next COMMAND;
} else {
die "cmds->{$cmd_name}: program '$cmd[0]' not found";
lib/Benchmark/Command.pm view on Meta::CPAN
=item * ignore_exit_code => bool (default: from env BENCHMARK_COMMAND_IGNORE_EXIT_CODE or 0)
If set to true, will not die if exit code is non-zero.
=item * skip_not_found => bool (default: 0)
If set to true, will skip benchmarking commands where the program is not found.
The default bahavior is to die.
=back
lib/Benchmark/Command.pm view on Meta::CPAN
=item * ignore_exit_code => bool
This overrides global C<ignore_exit_code> option.
=item * skip_not_found => bool
This overrides global C<skip_not_found> option.
=back
=head1 ENVIRONMENT
lib/Benchmark/Command.pm view on Meta::CPAN
Set default for C<run()>'s C<quiet> option (takes precedence of C<QUIET>).
=head2 BENCHMARK_COMMAND_SKIP_NOT_FOUND => bool
Set default for C<run()>'s C<skip_not_found> option.
=head2 QUIET => bool
Set default for C<run()>'s C<quiet> option (if C<BENCHMARK_COMMAND_QUIET> is not
defined).
view all matches for this distribution
view release on metacpan or search on metacpan
data/t/attributes/clone_weak.t
data/t/attributes/default_class_role_types.t
data/t/attributes/default_undef.t
data/t/attributes/delegation_and_modifiers.t
data/t/attributes/delegation_arg_aliasing.t
data/t/attributes/delegation_target_not_loaded.t
data/t/attributes/illegal_options_for_inheritance.t
data/t/attributes/inherit_lazy_build.t
data/t/attributes/lazy_no_default.t
data/t/attributes/method_generation_rules.t
data/t/attributes/misc_attribute_coerce_lazy.t
view all matches for this distribution
view release on metacpan or search on metacpan
html/setops.report.html view on Meta::CPAN
<td>Yes</td>
<td></td>
<td></td>
</tr>
<tr>
<td>91: not_equal</td>
<td>Yes</td>
<td></td>
<td>Yes. !=</td>
<td></td>
<td></td>
html/setops.report.html view on Meta::CPAN
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>92: not_subset</td>
<td>Yes</td>
<td></td>
<td></td>
<td></td>
<td></td>
view all matches for this distribution
view release on metacpan or search on metacpan
share/PerlCritic/Critic/Policy/NamingConventions/Capitalization.pm view on Meta::CPAN
}
sub _label_capitalization {
my ($self, $elem, $name) = @_;
return if _is_not_real_label($elem);
( my $label = $elem->content() ) =~ s< \s* : \z ><>xms;
return $self->_check_capitalization($label, $label, 'label', $elem);
}
sub _check_capitalization {
share/PerlCritic/Critic/Policy/NamingConventions/Capitalization.pm view on Meta::CPAN
return $TRUE if not $prior_to_grand_parent;
return $TRUE if not $prior_to_grand_parent->isa('PPI::Token::Word');
return $prior_to_grand_parent->content() ne 'continue';
}
sub _is_not_real_label {
my $elem = shift;
# PPI misparses part of a ternary expression as a label
# when the token to the left of the ":" is a bareword.
# See http://rt.cpan.org/Ticket/Display.html?id=41170
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Benchmark/Perl/Formance/Plugin/RxCmp.pm view on Meta::CPAN
if ($@) {
print STDERR "# ".$@ if $options->{verbose} > 2;
return { failed => "use failed" };
}
return { not_yet_implemented => 'missing comparable equivalent regex' };
my $result;
my $re_local = ("'a'?" x $n) . ("'a'" x $n);
#my $reg = qr/$re_local/; # using that $reg later segfaults
my $t = timeit $count, sub { $result = $string =~ /$re_local/ };
lib/Benchmark/Perl/Formance/Plugin/RxCmp.pm view on Meta::CPAN
my ($options) = @_;
# LPEG regexes seemingly don't work the same way as usual regexes
# therefore the pattern below does not match.
# TODO: Find a equivalent pattern.
# return { not_yet_implemented => 'need to find a equivalent pattern' };
eval "use re::engine::Lua"; ## no critic
if ($@) {
print STDERR "# ".$@ if $options->{verbose} > 2;
return { failed => "use failed" };
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Test/More.pm view on Meta::CPAN
$tb->_unoverload_str(\$e1, \$e2);
# Either they're both references or both not.
my $same_ref = !(!ref $e1 xor !ref $e2);
my $not_ref = (!ref $e1 and !ref $e2);
if( defined $e1 xor defined $e2 ) {
$ok = 0;
}
elsif ( _dne($e1) xor _dne($e2) ) {
$ok = 0;
}
elsif ( $same_ref and ($e1 eq $e2) ) {
$ok = 1;
}
elsif ( $not_ref ) {
push @Data_Stack, { type => '', vals => [$e1, $e2] };
$ok = 0;
}
else {
if( $Refs_Seen{$e1} ) {
view all matches for this distribution
view release on metacpan or search on metacpan
t/boilerplate.t view on Meta::CPAN
use strict;
use warnings;
use Test::More tests => 3;
sub not_in_file_ok {
my ($filename, %regex) = @_;
open my $fh, "<", $filename
or die "couldn't open $filename for reading: $!";
my %violated;
t/boilerplate.t view on Meta::CPAN
} else {
pass("$filename contains no boilerplate text");
}
}
not_in_file_ok(README =>
"The README is used..." => qr/The README is used/,
"'version information here'" => qr/to provide version information/,
);
not_in_file_ok(Changes =>
"placeholder date/time" => qr(Date/time)
);
sub module_boilerplate_ok {
my ($module) = @_;
not_in_file_ok($module =>
'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
);
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/99_errors.t view on Meta::CPAN
use vars qw($last_warning);
undef $last_warning;
{
local $SIG{__WARN__} = sub { $last_warning = shift };
my $weird_arg = '__this_is_not_a_valid_argument__';
my $t = Benchmark::Timer->new( $weird_arg => undef );
# 6
like($last_warning, qr/skipping unknown/, 'Invalid argument');
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BenchmarkAnything/Storage/Backend/SQL.pm view on Meta::CPAN
< - lower
> - greater
<= - lower equal
>= - greater equal
like - SQL LIKE
not_like - SQL NOT LIKE
is_empty - empty string or undef or null
2. Parameter in Sub-Array = restricted column
A restriction is possible for additional values and the default columns.
lib/BenchmarkAnything/Storage/Backend/SQL.pm view on Meta::CPAN
],
where => [
['!=', 'machine', 'mx1.small' ],
['=', 'NAME' , 'testbenchmark' ],
['like', 'some_key', 'some%value' ],
['not_like', 'another_key', 'another%value' ],
['is_empty', 'parameter1', 1 ], # check parameter1 is empty - Elasticsearch backend only
['is_empty', 'parameter2', 0 ], # check parameter2 is not empty - Elasticsearch backend only
],
limit => 2,
offset => 1,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BenchmarkAnything/Storage/Frontend/Lib.pm view on Meta::CPAN
}
else
{
# Hardcoded from BenchmarkAnything::Storage::Backend::SQL::Query::common,
# as it is a backend-special and internal thing anyway.
return [ '=', '!=', 'like', 'not_like', 'is_empty', '<', '>', '<=', '>=' ];
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BenchmarkAnything/Storage/Search/Elasticsearch.pm view on Meta::CPAN
my $i_ba_offset = $hr_ba_query->{offset}; # done
my $ar_ba_order_by = $hr_ba_query->{order_by}; # done
my @must_ranges;
my @must_matches;
my @must_not_matches;
my @should_matches;
my %source_fields = (
NAME => 1,
UNIT => 1,
VALUE => 1,
lib/BenchmarkAnything/Storage/Search/Elasticsearch.pm view on Meta::CPAN
);
my %match_operator =
(
'=' => 1,
);
my %not_match_operator =
(
'!=' => 1,
);
my %empty_match_operator =
(
lib/BenchmarkAnything/Storage/Search/Elasticsearch.pm view on Meta::CPAN
);
my %wildcard_match_operator =
(
'like' => 1,
);
my %wildcard_not_match_operator =
(
'not like' => 1, # deprecated
'not_like' => 1,
);
foreach my $w (@{ $ar_ba_where || [] })
{
my $op = $w->[0]; # operator
my $k = $w->[1]; # key
lib/BenchmarkAnything/Storage/Search/Elasticsearch.pm view on Meta::CPAN
push @should_matches, { match => { $k => $_ } } foreach @v;
} else {
push @must_matches, { match => { $k => $v[0] } };
}
}
elsif ($es_op = $not_match_operator{$op})
{
push @must_not_matches, { match => { $k => $_ } } foreach @v;
}
elsif ($es_op = $wildcard_match_operator{$op})
{
my $es_v = $v[0];
$es_v =~ s/%/*/g;
lib/BenchmarkAnything/Storage/Search/Elasticsearch.pm view on Meta::CPAN
# field is NOT EMPTY: [ "is_empty", "some_field_name", 0 ]
push @must_matches, { wildcard => { $k => '*' } };
} elsif (@v and $v[0] == 2) {
# field is EMPTY but exists (ie. not undefined): [ "is_empty", "some_field_name", 2 ]
push @must_not_matches, { wildcard => { $k => '*' } };
push @must_matches, { exists => { field => $k } };
} elsif (not @v or $v[0] == 1) {
# field is EMPTY or UNDEFINED/NULL: [ "is_empty", "some_field_name", 1 ] or [ "is_empty", "some_field_name" ]
push @must_not_matches, { wildcard => { $k => '*' } };
} else {
# we might invent other semantics so we better warn about
# what could once become meaningful.
warn "unclear 'is_empty' condition (".$v[0]."). Interpreting as 'is_empty' condition (1).";
push @must_not_matches, { wildcard => { $k => '*' } };
}
}
elsif ($es_op = $wildcard_not_match_operator{$op})
{
my $es_v = $v[0];
$es_v =~ s/%/*/g;
push @must_not_matches, { wildcard => { $k => $es_v } };
}
else
{
warn "_get_elasticsearch_query: Unsupported operator: $op\n";
return;
}
}
$hr_es_query = { query => { bool => {
(@must_matches||@must_ranges ? (must => [ @must_ranges, @must_matches ]) : ()),
(@must_not_matches ? (must_not => [ @must_not_matches ]) : ()),
(@should_matches ? (should => [ @should_matches ],minimum_should_match => 1) : ()),
},
},
%from,
%size,
view all matches for this distribution