Group
Extension

Matches 1301

Smart-Match ( L/LE/LEONT/Smart-Match-0.008.tar.gz, LEONT, 2015; MetaCPAN )
Smart-Match/lib/Smart/Match.pm ( view source; MetaCPAN )
 @_;
	return match { return $_ ~~ $match for $sub->() };
}

sub any {
	my @possibilities = @_;
	return match {
		for my $candidate (@possibilities) {
			return 1 if $_ ~~ $candidate;
		}
		return;
	};
rn match { scalar hash and [ sort keys %{$_} ] ~~ [ sort keys %{$hash} ] };
}

sub value {
	my $value = shift;
	return $value if blessed($value);
	given (ref $value) {
		when ('') {
			return $value;
 NAME

Smart::Match - Smart matching utilities

=head1 VERSION

version 0.008

=head1 SYNOPSIS

 given ($foo) {
     say "We've got a positive number" when positive;
     say "We've got an array" when
AsposeCellsCloud-CellsApi ( A/AS/ASPOSE/AsposeCellsCloud-CellsApi-25.9.tar.gz, ASPOSE, 2025; MetaCPAN )
AsposeCellsCloud-CellsApi/lib/AsposeCellsCloud/Role/AutoDoc.pm ( view source; MetaCPAN )
                               ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
                                 $role_reqs
.

	format INHERIT_POD =
=head1 NAME

@*
$mycl
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
                                                               $handles
.

	format ATTR_NARROW
        $handles
             ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
             $handles

.
	format ATTRHEAD_POD =
=head1 ATTRIBUTES

.
	format ATTR_POD =

PDK-Utils ( C/CA/CARELINE/PDK-Utils-0.005.tar.gz, CARELINE, 2025; MetaCPAN )
PDK-Utils/lib/PDK/Utils/Set.pm ( view source; MetaCPAN )
$self->mins} ~~ @{$setObj->mins} and @{$self->maxs} ~~ @{$setObj->maxs});
}

# 判断两个集合是否不相等
sub notEqual {
    my ($self, $setObj) = @_;
    return !(@{$self->mins} ~~ @{$setObj->
mins} and @{$self->maxs} ~~ @{$setObj->maxs});
}

# 判断当前集合是否包含另一个集合(包含相等情况)
sub isContain {
    my ($self, $setObj) = @_;
    if ($self->isEqual($setObj))
WebService-Fastly ( F/FA/FASTLY/WebService-Fastly-12.00.tar.gz, FASTLY, 2025; MetaCPAN )
WebService-Fastly/lib/WebService/Fastly/Role/AutoDoc.pm ( view source; MetaCPAN )
                               ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
                                 $role_reqs
.

    format INHERIT_POD =
=head1 NAME

@*
$myclass

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
                                                               $handles
.

    format ATTR_NARROW 
         $handles
             ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~
             $handles

.
    format ATTRHEAD_POD =
=head1 ATTRIBUTES

.
    format ATTR_POD =

=he
Acme-CPANModules-SmartMatch ( P/PE/PERLANCAR/Acme-CPANModules-SmartMatch-0.007.tar.gz, PERLANCAR, 2024; MetaCPAN )
Acme-CPANModules-SmartMatch/lib/Acme/CPANModules/SmartMatch.pm ( view source; MetaCPAN )
007'; # VERSION

my $text = <<'MARKDOWN';
**About smart match**

Smart matching, via the operator `~~`, was introduced in perl 5.10 (released
2007). It's inspired by Perl 6 (now called Raku)'s `given/
) more. Interesting things begin when the left/right hand
side is an array/hash/code/object. `$str ~~ @ary_of_strs`, probably the most
common use-case for smart matching, can do value-in-array checkin
lent
to `grep { $str eq $_ } @ary_of_strs` but with short-circuiting capability. Then
there's `$re ~~ @ary_of_strs` which can perform regex matching over the elements
of array. Now what about when the
Syntax-Infix-Smartmatch ( L/LE/LEONT/Syntax-Infix-Smartmatch-0.011.tar.gz, LEONT, 2025; MetaCPAN )
Syntax-Infix-Smartmatch/lib/Syntax/Infix/Smartmatch.xs ( view source; MetaCPAN )
opy(d);
	}
	else
		d = &PL_sv_undef;

	assert(e);
	if (SvGMAGICAL(e))
		e = sv_mortalcopy(e);

	/* ~~ undef */
	if (!SvOK(e)) {
		return !SvOK(d);
	}
	else if (SvROK(e)) {
		/* First of all, handle ov
rt_amg, AMGf_noleft);
#else
			HV* stash = SvSTASH(SvRV(e));
			GV* gv = gv_fetchmeth_pvn(stash, "(~~", 3, -1, 0);

			if (gv) {
				UNOP myop = {
					.op_flags   = OPf_STACKED | OPf_WANT_SCALAR,
			
K;
				POPSTACK;
				CATCH_SET(oldcatch);
			}
#endif
			if (sv)
				return SvTRUEx(sv);
		}

		/* ~~ qr// */
		if (SvTYPE(SvRV(e)) == SVt_REGEXP) {
			dSP;
			REGEXP* re = (REGEXP*)SvRV(e);
			PMOP* 
Text-CSV ( I/IS/ISHIGAKI/Text-CSV-2.06.tar.gz, HMBRAND, 2025; MetaCPAN )
Text-CSV/Text-CSV-0.007/t/90_csv.t ( view source; MetaCPAN )
 if ($in ~~ Array && $in.elems > 0) {
        $type ~= $in.list[0].WHAT.gist;
        $type ~~ s{")("} = " of ";
        }
    my Str $s-in = sprintf "%-16s %s", $type, $in.gist;
    $s-in ~~ s:g{\n} 
> $csv),  "Sub/Obj { s-in ($in) }");
    }

# Test supported "out" formats
my $datn = $data; $datn ~~ s:g{ "\r\n" } = "\n";
for in () -> $in {
    is (csv (in => $in, out => Str, :!quote-space), $data
Switch-Back ( D/DC/DCONWAY/Switch-Back-0.000005.tar.gz, DCONWAY, 2025; MetaCPAN )
Switch-Back/lib/Switch/Back.pm ( view source; MetaCPAN )
te @pure_statements;
    @pure_statements = ();
    state $VALIDATE_PURE_GIVEN = qr{
        \A  given (?<GIVEN>  (?<ws_post_kw>   $OWS    )  \(
                             (?<ws_pre_expr>  $OWS    )
    return !defined $left;
    }

    # 2. Objects on the RHS can't be handled (at all, because no ~~ overloading available)...
    croak 'Smart matching an object breaks encapsulation'
        if $ri
removed in this version of Perl

    use Switch::Back;   # But this module brings them back

    given ($some_value) {

        when (1)   { say 1; }

        when ('a') { say 'a'; continue; }

      
Crop-Config ( O/OC/OCTAVIANI/Crop-Config-0.1.25.tar.gz, OCTAVIANI, 2025; MetaCPAN )
Crop-Config/lib/Crop/Object/Attr.pm ( view source; MetaCPAN )
y ($self, $type) = @_;
	
	given ($type) {
		when (STORED) { $self->{type} ~~ ATTR_STORED }
		when (CACHED) { $self->{type} ~~ ATTR_CACHED }
		when (KEY)    { $self->{type} ~~ ATTR_KEY    }
		when (ANY
Crop ( O/OC/OCTAVIANI/Crop-0.1.27.tar.gz, OCTAVIANI, 2025; MetaCPAN )
Crop/lib/Crop/Object/Attr.pm ( view source; MetaCPAN )
y ($self, $type) = @_;
	
	given ($type) {
		when (STORED) { $self->{type} ~~ ATTR_STORED }
		when (CACHED) { $self->{type} ~~ ATTR_CACHED }
		when (KEY)    { $self->{type} ~~ ATTR_KEY    }
		when (ANY
Geoffrey ( M/MZ/MZIESCHA/Geoffrey-0.000206.tar.gz, MZIESCHA, 2025; MetaCPAN )
Geoffrey/lib/Geoffrey/Changeset.pm ( view source; MetaCPAN )
 {
    return $_[0]->{postfix} // q~~ if !defined $_[1];
    $_[0]->{postfix} = $_[1];
    return $_[0]->{postfix};
}

sub prefix {
    return $_[0]->{prefix} // q~~ if !defined $_[1];
    $_[0]->{pre
fix} = $_[1];
    return $_[0]->{prefix};
}

sub template {
    return $_[0]->{template} // q~~ if !defined $_[1];
    $_[0]->{template} = $_[1];
    return $_[0]->{template};
}

sub handle_entry {
  
DB-Object ( J/JD/JDEGUEST/DB-Object-v1.8.1.tar.gz, JDEGUEST, 2025; MetaCPAN )
DB-Object/lib/DB/Object/Fields/Field.pm ( view source; MetaCPAN )

        'eq'    => sub{ &_op_overload( @_, 'IS' ) },
        # Full Text Search operator
        '~~'    => sub{ &_op_overload( @_, '@@' ) },
        fallback => 1,
    );
    use Wanted;
    our $VE
are overloaded:

    +, -, *, /, %, <, <=, >, >=, !=, <<, >>, lt, gt, le, ge, ne, &, |, ^, ==, eq, ~~

Thus a field named "dummy" could be used like:

    $f + 10

which would become:

    dummy + 10
ceholder in:

    $f == "'JPY'"

Simply provide:

    $f == '?'

You can use the search operator C<~~> for SQL Full Text Search and it would be converted into C<@@>:

Let's imagine a table C<articles>
Text-CSV ( I/IS/ISHIGAKI/Text-CSV-2.06.tar.gz, HMBRAND, 2025; MetaCPAN )
Text-CSV/Text-CSV-0.007/lib/Text/CSV.pod6 ( view source; MetaCPAN )
my $fh  = open "test.csv", :r, chomp => False;
 while (my @row = $csv.getline($fh)) {
     @row[2] ~~ m/pattern/ or next; # 3rd field should match
     @rows.push: @row;
     }
 $fh.close;

 # and wri
cept and C<False>
for records to reject.

 csv (in => "file.csv", filter => {
            $^row[2] ~~ /a/ &&  # third field should contain an "a"
            $^row[4].chars > 4  # length of the 5th fi
at have no visible data

This filter is a shortcut for

 filter => { $^row.first: { .defined && $_ ~~ /\S/ }}

This filter rejects all lines that I<not> have at least one field that does
not evaluate 
Text-CSV ( I/IS/ISHIGAKI/Text-CSV-2.06.tar.gz, HMBRAND, 2025; MetaCPAN )
Text-CSV/Text-CSV-0.007/t/85_util.t ( view source; MetaCPAN )
sep, ",", "Sep = ,");

for < , ; > -> $sep {
    my Str $data = "bAr,foo\n1,2\n3,4,5\n";
    $data ~~ s:g{ "," } = $sep;

    $csv.column-names (False);
    {   my $fh = IO::String.new: $data;
	ok (my
,", ";" ];
for ",", ";", "|", "\t" -> $sep {
    my Str $data = "bAr,foo\n1,2\n3,4,5\n";
    $data ~~ s:g{ "," } = $sep;

    $csv.column-names (False);
    {   my $fh = IO::String.new: $data;
	ok (my
>], "Headers");
    }

for < , ; > -> $sep {
    my Str $data = "bAr,foo\n1,2\n3,4,5\n";
    $data ~~ s:g{ "," } = $sep;

    $csv.column-names (False);
    {   my $fh = IO::String.new: $data;
	ok (my
Test-Simpler ( D/DC/DCONWAY/Test-Simpler-0.000008.tar.gz, DCONWAY, 2025; MetaCPAN )
Test-Simpler/lib/Test/Simpler.pm ( view source; MetaCPAN )
         eq | ne | lt | le | gt | ge
          | == | != | <  | <= | >  | >=
          | =~ | !~ | ~~
          ) \Z }x;

    my $expected_code = $test_code;
    my ($got_code, $comparator);
    for m
ed[0];
    ok  $result eq $expected[0];
    ok  $result == $expected->[0]->{a}[0];
    ok  $result ~~ $expected[0];
    ok  $result !~ $expected[0];
    ok  $result >  twice($expected{'half'});


=hea
$result                --> 1
    #       $expected->[0]->{a}[0] --> undef
    #
    ok 4 - $result ~~ $expected[0]
    not ok 5 - $result !~ $expected[0]
    #   Failed test at demo/ts_ok-er.pl line 1
Locale-CLDR ( J/JG/JGNI/Locale-CLDR-v0.46.0.tar.gz, JGNI, 2025; MetaCPAN )
Locale-CLDR/lib/Locale/CLDR.pm ( view source; MetaCPAN )
 /^ ( (?: (?: ~~ )*+ ~ \[ | [^\[] )++ ) /x;
        $raw //= '';
		if (length $raw) {
			$text =~ s/^ ( (?: (?: ~~ )*+ ~ \[ | [^\[] )++ ) //gx;
			# Fix up escapes
			$raw =~ s/(?:~~)*+\K~\[/[/g;

			$raw =~ s/(?:~~)*+\K~,/,/g;
			$raw =~ s/~~/~/g;
			
			# Escape stuff for perl
			$raw =~ s/\\/\\\\/g;
			$raw =~ s/'/\\'/g;
			
			$sub .= ", '$raw'";
		}
		
		last unless length $tex

		$method =~ s/ \[ \s* (.*?) \s* \] /$1/x;
		
		# sort out ~, and ~~
		$method =~ s/(?:~~)*+\K~,/\x{00}/g;
		$method =~ s/~~/~/g;
		($method, my @params) = split /,/, $method;
		
		# if $is_p
Aion ( D/DA/DART/Aion-0.4.tar.gz, DART, 2025; MetaCPAN )
Aion/lib/Aion.pm ( view source; MetaCPAN )
meta = $Aion::META{$pkg};
    my $extends = $meta->{extends} // return "";

    return 1 if $class ~~ $extends;
    for my $extender (@$extends) {
        return 1 if $extender->isa($class);
    }

  
elf;
	my $meta = $Aion::META{$pkg};
	my $does = $meta->{with} // return "";

    return 1 if $role ~~ $does;
    for my $doeser (@$does) {
        return 1 if $doeser->can("does") && $doeser->does($ro
Crop-Config ( O/OC/OCTAVIANI/Crop-Config-0.1.25.tar.gz, OCTAVIANI, 2025; MetaCPAN )
Crop-Config/lib/Crop/Debug.pm ( view source; MetaCPAN )
output items; if item is a reference, will print dump
=cut
sub debug {
	my $layer = $_[0] && $_[0] ~~ @Layer_const ? shift : DefaultLayer;

	# drop the layer prefix to print in a config-fasion manner
tput OFF
=cut
sub _verbose {
	my $layer = shift;

	my $conf = Crop->C->{debug};
	return 1 unless $conf->{output} eq 'On';
	
	return unless exists $conf->{layer};
	
	$layer ~~ @{$conf->{layer}};
}

1;
Crop ( O/OC/OCTAVIANI/Crop-0.1.27.tar.gz, OCTAVIANI, 2025; MetaCPAN )
Crop/lib/Crop/Debug.pm ( view source; MetaCPAN )
output items; if item is a reference, will print dump
=cut
sub debug {
	my $layer = $_[0] && $_[0] ~~ @Layer_const ? shift : DefaultLayer;

	# drop the layer prefix to print in a config-fasion manner
tput OFF
=cut
sub _verbose {
	my $layer = shift;

	my $conf = Crop->C->{debug};
	return 1 unless $conf->{output} eq 'On';
	
	return unless exists $conf->{layer};
	
	$layer ~~ @{$conf->{layer}};
}

1;
Geoffrey ( M/MZ/MZIESCHA/Geoffrey-0.000206.tar.gz, MZIESCHA, 2025; MetaCPAN )
Geoffrey/lib/Geoffrey/Action/Table.pm ( view source; MetaCPAN )
 {
    return $_[0]->{postfix} // q~~ if !defined $_[1];
    $_[0]->{postfix} = $_[1];
    return $_[0]->{postfix};
}

sub prefix {
    return $_[0]->{prefix} // q~~ if !defined $_[1];
    $_[0]->{pre

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.