Class::Tiny::Chained(3pm)

Class::Tiny::Chained3pm

Minimalist class construction, with chained attributes

Usage

In Person.pm:

 package Person;
 
 use Class::Tiny::Chained qw( name );
 
 1;

In Employee.pm:

 package Employee;
 use parent 'Person';
 
 use Class::Tiny::Chained qw( ssn ), {
   timestamp => sub { time }    # attribute with default
 };
 
 1;

In example.pl:

 use Employee;
 
 my $obj = Employee->new( name => "Larry", ssn => "111-22-3333" );
 
 # attribute setters are chainable
 my $obj = Employee->new->name("Fred")->ssn("444-55-6666");
 my $ts = $obj->name("Bob")->timestamp;

Overview

Class::Tiny::Chained is a wrapper around Class::Tiny which makes the generated attribute accessors chainable; that is, when setting an attribute value, the object is returned so that further methods can be called.

Releases

4 releases since Debian 10 (Buster); the text changed 2 times.

  1. 10
  2. 11
  3. 12–13

Bugs

Report any issues on the public bugtracker.

Author

Dan Book <[email protected]>

From libclass-tiny-chained-perl 0.004-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.