| 1 | package SPVM::Stringer; | ||
| 2 | |||
| 3 | 1; | ||
| 4 | |||
| 5 | =head1 Name | ||
| 6 | |||
| 7 | SPVM::Stringer - Interface Type for Stringing Callback | ||
| 8 | |||
| 9 | =head1 Usage | ||
| 10 | |||
| 11 | use Stringer; | ||
| 12 | use Point; | ||
| 13 | |||
| 14 | my $stringer = (Stringer)method : string ($object : object) { | ||
| 15 | my $point = (Point)$object; | ||
| 16 | |||
| 17 | my $string = $point->to_string; | ||
| 18 | |||
| 19 | return $string; | ||
| 20 | }; | ||
| 21 | |||
| 22 | my $point = Point->new(1, 2); | ||
| 23 | my $string = $stringer->($point); | ||
| 24 | |||
| 25 | =head1 Description | ||
| 26 | |||
| 27 | L<Stringer|SPVM::Stringer> is the interface type for the stringing callback. | ||
| 28 | |||
| 29 | =head1 Interface Methods | ||
| 30 | |||
| 31 | C<required method : string ($object : object)> | ||
| 32 | |||
| 33 | The implementation must receive an object and return the string that represents the object. | ||
| 34 | |||
| 35 | =head1 Copyright & License | ||
| 36 | |||
| 37 | Copyright (c) 2023 Yuki Kimoto | ||
| 38 | |||
| 39 | MIT License |