MooseX::DeclareX::Plugin::abstract - shiny syntax for MooseX::ABCD
class Shape is abstract { requires 'draw'; } class Circle extends Shape { method draw { ... } } class Square extends Shape { # does not implement 'draw' } # dies my $shape = Shape->new; # dies my $circle = Circle->new; # succeeds
This distribution adds two new plugins to MooseX::DeclareX.
is abstract
Declares that a class cannot be instantiated.
Also allows the standard Moose requires function to work within classes (it normally only works within roles).
requires
When a class requires a method, then subclasses are supposed to provide that method. If the subclass itself is also abstract, then it doesn't need to provide the required methods. (There's also a little cheat: classes which are mutable may extend abstract classes without implementing required methods. You should not do this though.)
is concrete
A counterpart to is abstract. Currently, this is a no-op, but in future it might enable some checks related to abstract classes.
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=MooseX-DeclareX-Plugin-abstract.
MooseX::DeclareX, MooseX::ABCD.
Toby Inkster <tobyink@cpan.org>.
This software is copyright (c) 2012 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.
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.
To install MooseX::DeclareX::Plugin::abstract, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::DeclareX::Plugin::abstract
CPAN shell
perl -MCPAN -e shell install MooseX::DeclareX::Plugin::abstract
For more information on module installation, please visit the detailed CPAN module installation guide.