| 1 | package Switch::Perlish::Smatch::Code; | ||
| 2 | |||
| 3 | 11 | $VERSION = '1.0.0'; | |
| 4 | |||
| 5 | 11 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 11 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | ## DESC - Call $t with $m. | ||
| 9 | 4 | ▶ | sub _VALUE { |
|
Subroutine
_VALUE: called CC=1 SCAR=0.0
| |||
| 10 | 4 | my($t, $m) = @_; | |
| 11 | 4 | return $t->($m); | |
| 12 | } | ||
| 13 | |||
| 14 | ## DESC - Call $t with $m. | ||
| 15 | 11 | *_UNDEF = \&_VALUE; | |
| 16 | |||
| 17 | ## DESC - Check if $m refers to $t. | ||
| 18 | 2 | ▶ | sub _SCALAR { |
|
Subroutine
_SCALAR: called CC=1 SCAR=0.0
| |||
| 19 | 2 | my($t, $m) = @_; | |
| 20 | 2 | return $t == $$m; | |
| 21 | } | ||
| 22 | |||
| 23 | ## DESC - Pass @$m to $t. | ||
| 24 | 2 | ▶ | sub _ARRAY { |
|
Subroutine
_ARRAY: called CC=1 SCAR=0.0
| |||
| 25 | 2 | my($t, $m) = @_; | |
| 26 | 2 | return $t->(@$m); | |
| 27 | } | ||
| 28 | |||
| 29 | ## DESC - Pass %$m to $t. | ||
| 30 | 2 | ▶ | sub _HASH { |
|
Subroutine
_HASH: called CC=1 SCAR=0.0
| |||
| 31 | 2 | my($t, $m) = @_; | |
| 32 | 2 | return $t->(%$m); | |
| 33 | } | ||
| 34 | |||
| 35 | ## DESC - Pass $m to $t. | ||
| 36 | 2 | ▶ | sub _CODE { |
|
Subroutine
_CODE: called CC=1 SCAR=0.0
| |||
| 37 | 2 | my($t, $m) = @_; | |
| 38 | 2 | return $t->($m); | |
| 39 | } | ||
| 40 | |||
| 41 | ## DESC - Pass $m to $t. | ||
| 42 | 2 | ▶ | sub _OBJECT { |
|
Subroutine
_OBJECT: called CC=1 SCAR=0.0
| |||
| 43 | 2 | my($t, $m) = @_; | |
| 44 | 2 | return $t->($m); | |
| 45 | } | ||
| 46 | |||
| 47 | ## DESC - Pass $m to $t. | ||
| 48 | 2 | ▶ | sub _Regexp { |
|
Subroutine
_Regexp: called CC=1 SCAR=0.0
| |||
| 49 | 2 | my($t, $m) = @_; | |
| 50 | 2 | return $t->($m); | |
| 51 | } | ||
| 52 | |||
| 53 | 11 | Switch::Perlish::Smatch->register_package( __PACKAGE__, 'CODE' ); | |
| 54 | |||
| 55 | 11 | 1; | |
| 56 | |||
| 57 | =pod | ||
| 58 | |||
| 59 | =head1 NAME | ||
| 60 | |||
| 61 | Switch::Perlish::Smatch::Code - The C<CODE> comparatory category package. | ||
| 62 | |||
| 63 | =head1 VERSION | ||
| 64 | |||
| 65 | 1.0.0 - Initial release. | ||
| 66 | |||
| 67 | =head1 DESCRIPTION | ||
| 68 | |||
| 69 | This package provides the default implementation for the C<CODE> comparator | ||
| 70 | category. For more information on the comparator implementation see. | ||
| 71 | L<Switch::Perlish::Smatch::Comparators/"Code">. | ||
| 72 | |||
| 73 | =head1 SEE. ALSO | ||
| 74 | |||
| 75 | L<Switch::Perlish::Smatch> | ||
| 76 | |||
| 77 | L<Switch::Perlish::Smatch::Comparators> | ||
| 78 | |||
| 79 | =head1 AUTHOR | ||
| 80 | |||
| 81 | Dan Brook C<< <mr.daniel.brook@gmail.com> >> | ||
| 82 | |||
| 83 | =head1 COPYRIGHT | ||
| 84 | |||
| 85 | Copyright (c) 2006, Dan Brook. All Rights Reserved. This module is free | ||
| 86 | software. It may be used, redistributed and/or modified under the same | ||
| 87 | terms as Perl itself. | ||
| 88 | |||
| 89 | =cut | ||