| 1 | package SPVM::Comparator::String; | ||
| 2 | |||
| 3 | 1; | ||
| 4 | |||
| 5 | =head1 Name | ||
| 6 | |||
| 7 | SPVM::Comparator::String - Interface Type for String Comparation Callback | ||
| 8 | |||
| 9 | =head1 Usage | ||
| 10 | |||
| 11 | use Comparator::String; | ||
| 12 | |||
| 13 | my $comparator = (Comparator::String)method : int ($a : string, $b : string); { | ||
| 14 | return $a cmp $b; | ||
| 15 | }; | ||
| 16 | |||
| 17 | my $result = $comparator->(3, 5); | ||
| 18 | |||
| 19 | =head1 Description | ||
| 20 | |||
| 21 | L<Comparator::String|SPVM::Comparator::String> is the interface type for the string comparation callback. | ||
| 22 | |||
| 23 | =head1 Interface Methods | ||
| 24 | |||
| 25 | C<required method : int ($a : string, $b : string);> | ||
| 26 | |||
| 27 | This method must receive two values that types are C<string> and return the following value. | ||
| 28 | |||
| 29 | If the first argument is greater than the second argument, returns 1. If the first argument is lower than the second argument, returns -1. If the first argument is equal to the second argument, returns 0. | ||
| 30 | |||
| 31 | =head1 Copyright & License | ||
| 32 | |||
| 33 | Copyright (c) 2023 Yuki Kimoto | ||
| 34 | |||
| 35 | MIT License |