NAME

SPVM::Stringer - a callback type for stringification

SYNOPSYS

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);

DESCRIPTION

SPVM::Stringer is a callback type to stringify a object.

CALLBACK METHOD

sub : string ($self : self, $obj : object)

This method should receive a object and return the string expression in the method imlementaion.