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 chainablemy $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.
Copyright and license
This software is Copyright (c) 2015 by Dan Book.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
Releases
4 releases since Debian 10 (Buster); the text changed 2 times.