NAME
Class::Tiny::Antlers - Moose-like sugar for Class::Tiny
SYNOPSIS
{
package Point;
use Class::Tiny;
use Class::Tiny::Antlers;
has x => (is => 'ro');
has y => (is => 'ro');
}
{
package Point3D;
use Class::Tiny;
use Class::Tiny::Antlers;
extends 'Point';
has z => (is => 'ro');
}
DESCRIPTION
Class::Tiny::Antlers provides Moose-like has
, extends
and with
keywords for Class::Tiny. (The with
keyword is implemented by Role::Tiny.)
Class::Tiny doesn't support all Moose's attribute options; has
should throw you an error if you try to do something it doesn't support (like triggers or type constraints).
Class::Tiny::Antlers does however hack in support for is => 'ro'
and Moo-style is => 'rwp'
, clearers and predicates.
Export
By default, Class::Tiny::Antlers exports has
, with
and extends
, and also imports strict into its caller. You can optionally also import confess
and warnings:
use Class::Tiny::Antlers qw( -default confess warnings );
use Class::Tiny::Antlers qw( -all ); # same thing
You can put a no Class::Tiny::Antlers
statement at the end of your class definition to wipe the imported functions out of your namespace. (This does not unimport strict/warnings though.) To clean up your namespace more thoroughly, use something like namespace::sweep.
BUGS
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Class-Tiny-Antlers.
SEE ALSO
AUTHOR
Toby Inkster <tobyink@cpan.org>.
COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
DISCLAIMER OF WARRANTIES
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.