NAME
Switch::Perlish::Smatch::Comparators - Overall document for comparator behaviour.
COMPARATORS
Below is a complete listing of the default comparators that come with Switch::Perlish.
In each comparator description $t refers to the topic and $m refers to the match, or the first and second arguments, respectively.
Array
- ARRAY
-
Smatch for an element of
@$min@$t. - CODE
-
Call
&$mwith@$t. - HASH
-
Check if an element of
@$texists as a key in%$m. - OBJECT
-
Check if an element of
@$texists as a method of$m. - Regexp
-
Match
$magainst the elements of@$t. - SCALAR
-
Check if
$mpoints to an element of@$t. - UNDEF
-
Return false as
$tis already defined. - VALUE
-
Smatch for
$min@$t.
Code
- ARRAY
-
Check if
$mrefers to$t. - CODE
-
Pass
%$mto$t. - HASH
-
Pass
@$mto$t. - OBJECT
-
Pass
$mto$t. - Regexp
-
Pass
$mto$t. - SCALAR
-
Call
$twith$m. - VALUE
-
Call
$twith$m.
Hash
- ARRAY
-
Check if an element of
@$mexists as a key of%$t. - CODE
-
Check if the return from
&$mis a hash key of%$t. - HASH
-
Check if a
key => valuepair exists in both%$tand%$m. - OBJECT
-
Check if a key of
%$texists as a method of$m. - Regexp
-
Check if any keys from
%$tmatch$m. - SCALAR
-
Check if
$mpoints to value in%$t. - UNDEF
-
Check for an undefined value in
%$t(better suggestions welcome). - VALUE
-
Check if
$mexists as a key in%$t.
Object
- ARRAY
-
If the
$tis a blessed ARRAY, delegate to theARRAY<=>ARRAYcomparator, otherwise returns false. - CODE
-
Call the
$ton&$mi.e$t->$m. - HASH
-
If the
$tis a blessed HASH, delegate to theHASH<=>HASHcomparator, otherwise returns false. - OBJECT
-
Check if the
$t->isa($m)or the same class (better suggestions welcome). - Regexp
-
Match the class of
$tagainst the$m. - SCALAR
-
Check if the
$mpoints to the$t. - UNDEF
-
croak("Can't compare OBJECT with an undef") # Suggestions welcome.
- VALUE
-
Check if
$thas$mas a method.
Regexp
- ARRAY
-
Match
$tfor every element in@$m. - CODE
-
Pass
$tto&$m. - HASH
-
Check if any of keys of
%$mmatch$t. - OBJECT
-
Match
$tagainst$m's class. - Regexp
-
Match
$mto$t. - SCALAR
-
Check if
$mrefers to$t. - UNDEF
-
croak("Can't compare Regexp with an undef") # suggestions welcome.
- VALUE
-
Match
$tagainst$m.
Scalar
- ARRAY
-
Check if
$tpoints to an element of@$m. - CODE
-
Check if
$tpoints to$m. - HASH
-
Check if
$tpoints to value in%$m. - OBJECT
-
Check if
$trefers to the object$m. - Regexp
-
Check if
$trefers to the Regexp object$m. - SCALAR
-
Numerically compare the scalar refs
$tand$m. - UNDEF
-
Check if
$$tis undef. - VALUE
-
Call Switch::Perlish::Smatch::value_cmp() with
$$tand$m.
Undef
- ARRAY
-
Check for an undef in
@$m. - CODE
-
Pass undef to
&$m(to be consistent with other CODE comparators). - HASH
-
Check for an undefined value in
%$m(better suggestions welcome). - OBJECT
-
croak("Can't compare undef with OBJECT") # Suggestions welcome.
- Regexp
-
croak("Can't compare undef with Regexp") # Suggestions welcome.
- SCALAR
-
Check if
$$mis undef. - UNDEF
-
Return true as
$mis also undefined. - VALUE
-
Return false as
$mis already defined.
Value
- ARRAY
-
Check if
$tis in$m. - CODE
-
Pass
$tto&$m. - HASH
-
Check if
$texists as a key in$m. - OBJECT
-
Check if the method
$texists in$m. - Regexp
-
Match
$tagainst$m. - SCALAR
-
Check if what
$$mis the same as$t. - UNDEF
-
Return false, a
VALUEis always defined. - VALUE
-
Call Switch::Perlish::Smatch::value_cmp() with
$tand$m.
SEE. ALSO
AUTHOR
Dan Brook <mr.daniel.brook@gmail.com>
COPYRIGHT
Copyright (c) 2006, Dan Brook. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.