The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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.