The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::Cloner - Interface Type for the Callback to Clone a Object

Usage

use Cloner;
use Point;

my $cloner = (Cloner)method : object ($object : object) {
  my $point = (Point)$object;
  
  my $cloned_point = Point->new($point->x, $point->y);
  
  return $cloned_point;
};

my $point = Point->new(1, 2);
my $cloned_point = $cloner->($point);

Description

Cloner is the interface type for the callback to clone a object.

Interface Methodss

required method : object ($object : object);

The implementation must receive a object and return the cloned object.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License