PURPOSE
An example of extending Moops to add an exception
keyword.
The MoopsX::Ception module itself does little, except injects the MoopsX::Ception::Parser module.
MoopsX::Ception::Parser uses Moops::Parser's hooks to add support for parsing the exception
keyword, and injects the MoopsX::Ception::Keyword::Exception code generator when it is encountered.
MoopsX::Ception::Keyword::Exception is a simple subclass of Moops::Keyword::Class and simply adds Throwable to the list of roles that the class does.
A more practical application of this would be something like an MVC framework, where you might want to define model
, view
and controller
keywords, which set up classes with particular inheritance patterns, and import commonly used functions into each (e.g. URI manipulation functions into controllers, and HTML escaping functions into views).
DEPENDENCIES
Requires the Throwable role which is available from CPAN.
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.