GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Class::Tiny::Chained(3) User Contributed Perl Documentation Class::Tiny::Chained(3)

Class::Tiny::Chained - Minimalist class construction, with chained attributes

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;

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.

Report any issues on the public bugtracker.

Dan Book <dbook@cpan.org>

This software is Copyright (c) 2015 by Dan Book.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

Object::Tap, MooX::ChainedAttributes
2016-09-16 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.