https://github.com/rsrchboy/moosex-abstractmethod
Declare methods requirements that must be satisfied
https://github.com/rsrchboy/moosex-abstractmethod
Last synced: 10 months ago
JSON representation
Declare methods requirements that must be satisfied
- Host: GitHub
- URL: https://github.com/rsrchboy/moosex-abstractmethod
- Owner: rsrchboy
- License: other
- Created: 2011-09-17T05:02:10.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2015-07-04T04:16:56.000Z (over 10 years ago)
- Last Synced: 2025-01-16T04:17:07.107Z (12 months ago)
- Language: Perl
- Homepage: http://metacpan.org/release/MooseX-AbstractMethod/
- Size: 133 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.mkdn
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/RsrchBoy/moosex-abstractmethod)
[](http://cpants.charsbar.org/dist/overview/MooseX-AbstractMethod)
[](https://coveralls.io/r/RsrchBoy/moosex-abstractmethod?branch=master)
# NAME
MooseX::AbstractMethod - Declare methods requirements that must be satisfied
# VERSION
This document describes version 0.005 of MooseX::AbstractMethod - released July 02, 2015 as part of MooseX-AbstractMethod.
# SYNOPSIS
use Moose;
use MooseX::Abstract;
requires 'bar';
# synonm to 'requires'
abstract 'foo';
# DESCRIPTION
This extensions allows classes to flag certain methods as being required to be
implemented by a subclass, much as a [Moose::Role](https://metacpan.org/pod/Moose::Role) does with 'requires'.
# USAGE
As in the synopsis, simply mark certain methods as being required by
subclasses by passing their names to "abstract" or "requires". This will
cause a method of the same name to be installed in the class that will die
horribly if it's ever called. Additionally, when a class is made immutable,
all of its methods are checked to see if they're marked as abstract; if any
abstract methods exists that were not created in the current class, we die
horribly.
Checking for method satisfaction on make\_immutable isn't perfect, but AFAICT
it's the most reasonable approach possible at the moment. (Corrections
welcome.)
# NEW SUGAR
## abstract
abstract() allows one to declare a method dependency that must be satisfied by a
subclass before it is invoked, and before the subclass is made immutable.
abstract 'method_name_that_must_be_satisfied';
## requires
requires() is a synonym for abstract() and works in the way you'd expect.
# BUGS
Please report any bugs or feature requests on the bugtracker website
https://github.com/RsrchBoy/moosex-abstractmethod/issues
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
# AUTHOR
Chris Weyl
## I'm a material boy in a material world
Please note **I do not expect to be gittip'ed or flattr'ed for this work**,
rather **it is simply a very pleasant surprise**. I largely create and release
works like this because I need them or I find it enjoyable; however, don't let
that stop you if you feel like it ;)
[Flattr](https://flattr.com/submit/auto?user_id=RsrchBoy&url=https%3A%2F%2Fgithub.com%2FRsrchBoy%2Fmoosex-abstractmethod&title=RsrchBoy's%20CPAN%20MooseX-AbstractMethod&tags=%22RsrchBoy's%20MooseX-AbstractMethod%20in%20the%20CPAN%22),
[Gratipay](https://gratipay.com/RsrchBoy/), or indulge my
[Amazon Wishlist](http://bit.ly/rsrchboys-wishlist)... If and \*only\* if you so desire.
# COPYRIGHT AND LICENSE
This software is Copyright (c) 2011 by Chris Weyl.
This is free software, licensed under:
The GNU Lesser General Public License, Version 2.1, February 1999

