SPVM::Stringer - a callback type for stringification
use SPVM::Stringer; my $stringer : SPVM::Stringer = sub : string ($self : self, $obj : object) { my $point = (SPVM::Point)$obj; my $x = $point->x; my $y = $point->y; my $str = "($x, $y)"; return $str; }; my $point = SPVM::Point->new(1, 2); my $str = $stringer->($point);
SPVM::Stringer is a callback type to stringify a object.
sub : string ($self : self, $obj : object)
This method should receive a object and return the string expression in the method imlementaion.
To install SPVM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SPVM
CPAN shell
perl -MCPAN -e shell install SPVM
For more information on module installation, please visit the detailed CPAN module installation guide.