++ed by:
AERO ANDREFS AWNCORP AZAWAWI BEROV

14 PAUSE user(s)
10 non-PAUSE user(s).

Toby Inkster

PURPOSE

An example of extending Moops to add an exception keyword.

MoopsX::TraitFor::Parser::ExceptionKeyword is a trait for Moops::Parser, adding support for parsing the exception keyword, and injects the MoopsX::Keyword::Exception class when it is encountered.

MoopsX::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.




Hosting generously
sponsored by Bytemark