Switch::Perlish::Smatch::Comparators - Overall document for comparator behaviour.
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.
$t
$m
Smatch for an element of @$m in @$t.
@$m
@$t
Call &$m with @$t.
&$m
Check if an element of @$t exists as a key in %$m.
%$m
Check if an element of @$t exists as a method of $m.
Match $m against the elements of @$t.
Check if $m points to an element of @$t.
Return false as $t is already defined.
Smatch for $m in @$t.
Check if $m refers to $t.
Pass %$m to $t.
Pass @$m to $t.
Pass $m to $t.
Call $t with $m.
Check if an element of @$m exists as a key of %$t.
%$t
Check if the return from &$m is a hash key of %$t.
Check if a key => value pair exists in both %$t and %$m.
key => value
Check if a key of %$t exists as a method of $m.
Check if any keys from %$t match $m.
Check if $m points to value in %$t.
Check for an undefined value in %$t (better suggestions welcome).
Check if $m exists as a key in %$t.
If the $t is a blessed ARRAY, delegate to the ARRAY<=>ARRAY comparator, otherwise returns false.
ARRAY<=>ARRAY
Call the $t on &$m i.e $t->$m.
$t->$m
If the $t is a blessed HASH, delegate to the HASH<=>HASH comparator, otherwise returns false.
HASH<=>HASH
Check if the $t->isa($m) or the same class (better suggestions welcome).
$t->isa($m)
Match the class of $t against the $m.
Check if the $m points to the $t.
croak("Can't compare OBJECT with an undef") # Suggestions welcome.
Check if $t has $m as a method.
Match $t for every element in @$m.
Pass $t to &$m.
Check if any of keys of %$m match $t.
Match $t against $m's class.
Match $m to $t.
croak("Can't compare Regexp with an undef") # suggestions welcome.
Match $t against $m.
Check if $t points to an element of @$m.
Check if $t points to $m.
Check if $t points to value in %$m.
Check if $t refers to the object $m.
Check if $t refers to the Regexp object $m.
Numerically compare the scalar refs $t and $m.
Check if $$t is undef.
$$t
Call Switch::Perlish::Smatch::value_cmp() with $$t and $m.
Check for an undef in @$m.
Pass undef to &$m (to be consistent with other CODE comparators).
Check for an undefined value in %$m (better suggestions welcome).
croak("Can't compare undef with OBJECT") # Suggestions welcome.
croak("Can't compare undef with Regexp") # Suggestions welcome.
Check if $$m is undef.
$$m
Return true as $m is also undefined.
Return false as $m is already defined.
Check if $t is in $m.
Check if $t exists as a key in $m.
Check if the method $t exists in $m.
Check if what $$m is the same as $t.
Return false, a VALUE is always defined.
VALUE
Call Switch::Perlish::Smatch::value_cmp() with $t and $m.
Switch::Perlish::Smatch
Dan Brook <mr.daniel.brook@gmail.com>
<mr.daniel.brook@gmail.com>
@gmail
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.
To install Switch::Perlish, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Switch::Perlish
CPAN shell
perl -MCPAN -e shell install Switch::Perlish
For more information on module installation, please visit the detailed CPAN module installation guide.