Class::MakeMethods::Template::Ref(3pm)

Class::MakeMethods::Template::Ref3pm

Universal copy and compare methods

Usage

  package MyObject;
  use Class::MakeMethods::Template::Ref (
    'Hash:new'      => [ 'new' ],
    clone           => [ 'clone' ]
  );
  
  package main;
  my $obj = MyObject->new( foo => ["Foozle", "Bozzle"] );
  my $clone = $obj->clone();
  print $obj->{'foo'}[1];

Overview

The following types of methods are provided via the Class::MakeMethods interface:

clone

Produce a deep copy of an instance of almost any underlying datatype.

Parameters:

init_method

If defined, this method is called on the new object with any arguments passed in.

prototype

Create new instances by making a deep copy of a static prototypical instance.

Parameters:

init_method

If defined, this method is called on the new object with any arguments passed in.

compare

Compare one object to another.

Templates

•

default

Three-way (sorting-style) comparison.

•

equals

Are these two objects equivalent?

•

identity

Are these two references to the exact same object?

Releases

10 releases since Debian 4.0 (Etch); the text changed 3 times.

  1. 4.0–5.0
  2. 6.0–8
  3. 9–11
  4. 12–13

From libclass-makemethods-perl 1.01-7 in Debian 13 (Trixie). Parsed by carta from the page's man source.