COPYRIGHT000664001750001750 626112416504256 12721 0ustar00taitai000000000000Moops-0.034Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Moops Upstream-Contact: Toby Inkster (TOBYINK) Source: https://metacpan.org/release/Moops Files: README lib/Moops.pm lib/MooseX/FunctionParametersInfo.pm lib/PerlX/Define.pm t/01basic.t t/02outer.t t/03lines.t t/11class-moose.t t/11class-mouse.t t/11class-tiny.t t/11class.t t/12role-moose.t t/12role-mouse.t t/12role-tiny.t t/12role.t t/13namespace.t t/14versions.t t/21fun.t t/22method-moose.t t/22method.t t/23modifiers-moose.t t/23modifiers.t t/31types-moose.t t/31types-moosextypes-imported.t t/31types-moosextypes-moo.t t/31types-moosextypes.t t/31types-mouse.t t/31types.t t/32typeimport-moosextypes.t t/32typeimport.t t/33type-timing.t t/41constants.t t/51moresugar.t t/52customsugar.t t/71library-moosextypes.t t/71library.t t/91traits.t t/92trait-dirty.t t/93trait-mutable.t t/94trait-ro-rw-rwp.t t/QuuxDie.pm Copyright: This software is copyright (c) 2013-2014 by Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: Changes META.json META.yml doap.ttl lib/Moops/ImportSet.pm lib/Moops/Keyword.pm lib/Moops/Keyword/Class.pm lib/Moops/Keyword/Library.pm lib/Moops/Keyword/Role.pm lib/Moops/MethodModifiers.pm lib/Moops/Parser.pm lib/Moops/TraitFor/Keyword/assertions.pm lib/Moops/TraitFor/Keyword/dirty.pm lib/Moops/TraitFor/Keyword/fp.pm lib/Moops/TraitFor/Keyword/mutable.pm lib/Moops/TraitFor/Keyword/ro.pm lib/Moops/TraitFor/Keyword/rw.pm lib/Moops/TraitFor/Keyword/rwp.pm Copyright: Copyright 2014 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: INSTALL LICENSE examples/calculator.pl examples/class-versus-object-method.pl examples/cli-app.pl examples/lib/MoopsX/Keyword/Exception.pm examples/lib/MoopsX/TraitFor/Parser/ExceptionKeyword.pm examples/multimethods.pl examples/using-moops-with-method-signatures.pl examples/using-moosextypes-in-moo.pl Copyright: Unknown License: Unknown Files: t/04composition.t t/05true.t t/53warnings.t t/ReturnsTrue.pm t/ReturnsTrueAgain.pm Copyright: This software is copyright (c) 2014 by Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: examples/bench.pl examples/extending-moops.pl Copyright: This software is copyright (c) 2013 by Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: Makefile.PL dist.ini Copyright: Copyright 2013 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: lib/Moops/Manual/Objects101.pod Copyright: Copyright 2013-2014 Toby Inkster and others. License: Expat Files: t/99threads.t Copyright: This software is copyright (c) 2014 by Aaron James Trevena. License: GPL-1.0+ or Artistic-1.0 License: Artistic-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The Artistic License 1.0 License: GPL-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 License: Expat This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The MIT (X11) License CREDITS000664001750001750 66412416504254 12425 0ustar00taitai000000000000Moops-0.034Maintainer: - Toby Inkster (TOBYINK) Contributor: - Aaron James Trevena (TEEJAY) - Maurice Mengel (MMAURICE) Thanks: - Ben Goldberg (GOLDBB) - Lukas Atkinson (AMON) - Matt S Trout (MSTROUT) - Piers Cawley (PDCAWLEY) - Ron Savage (RSAVAGE) - Søren Døssing (SAUBER) Changes000664001750001750 2163412416504254 12740 0ustar00taitai000000000000Moops-0.034Moops ===== Created: 2013-06-30 Home page: Bug tracker: Maintainer: Toby Inkster (TOBYINK) 0.034 2014-10-12 [ Bug Fixes ] - Fix enormous memory leak leading to segfault caused when a role application in a scope guard threw an exception. Fixes RT#99389. Fixes RT#99409. Ben Goldberg++ Lukas Atkinson++ Søren Døssing++ [ Documentation ] - Bundle a multimethod example (stolen from MooseX:MultiMethods). - Improvements to the SUPPORT and SEE ALSO sections of the documentation. - Warn about some planned changes. [ Test Suite ] - Test that `use true` is imported by Moops. [ Packaging ] - Remove outdated dependency on Sub::Name from packaging metadata. [ Other ] - Updated: namespace::autoclean now supports Moo enough that we can start using it instead of namespace::sweep. 0.033 2014-08-16 [ Bug Fixes ] - Fix bugs introduced in 0.032 with role application via guards. [ Other ] - Updated: Take advantage of improvements in Type::Library/Type::Registry 1.000000. 0.032 2014-08-13 [ BACK COMPAT ] - Role composition is now delayed to the end of a class declaration. Matt S Trout++ [ Documentation ] - Fix a typo in Moops::Manual::Objects101. Fixes RT#93553. Ron Savage++ [ Packaging ] - PerlX::Assert is no longer bundled with Moops; it has been split out into a separate distribution. 0.031 2014-03-23 [ Documentation ] - Fix typo in manual. Fixes RT#93553. Ron Savage++ - Use the `true` constant instead of the number 1 in the cli-app.pl example. [ Test Suite ] - Test Moops in threaded Perls. Aaron James Trevena++ [ Other ] - Added: The new import parameter `-strict` enables loading strictures.pm within Moops scopes. - Avoid returning 0 from `assert` statements (PerlX::Assert). - Use Parse::Keyword instead of Devel::Pragma in order to establish the currently compiling package name. Devel::Pragma has issues under ithreads. Piers Cawley++ 0.030 2014-01-30 [ Documentation ] - Include an example using Moops to write a command-line app. Maurice Mengel++ [ Packaging ] - Require at least version 0.027 of Kavorka; this resolves a conflict using Moops with MooX::Options. [ Other ] - Hard-code a list of warnings categories to fatalize; this means that warnings categories added to future versions of Perl will not magically become fatal in Moops. 0.029 2014-01-04 [ Bug Fixes ] - Fix availability of Lexical::Accessor within class {} blocks. [ Documentation ] - Copyright 2014. 0.028 2013-12-18 [ Documentation ] - Demonstrate `is override` trait in Moops::Manual::Objects101. [ Packaging ] - Indicate conflict with MooseX::Types::Common 0.001011. - Indicate conflict with MooseX::Types::URI 0.05. 0.027 2013-12-16 [ Documentation ] - Include an example using multi methods to implement a class method and object method with the same name as each other. - Moops::Manual::Objects101. [ Other ] - Added: Private attributes via Lexical::Accessor. - Moose/Mouse classes/roles now have override/augment method modifier keywords. 0.026 2013-11-18 - Replace Function::Parameters with Kavorka. 0.025 2013-10-09 [ Documentation ] - Note that a future version of Moops may replace Function::Parameters with Kavorka. [ Other ] - Updated: Use Exporter::Tiny. 0.024 2013-09-27 [ Test Suite ] - Keyword::Simple 0.02 has been released; no longer need to skip t/03lines.t. 0.023 2013-09-26 [ Bug Fixes ] - Much improved (though not completely perfect) line number accounting. [ Documentation ] - Bundle an example of using Moops with Method::Signatures. 0.022 2013-09-16 - Minor updates to work with Function::Parameters 1.0301. 0.021 2013-09-12 - Allow version numbers to be specified for the `with`, `extends` and `types` options. 0.020 2013-09-11 [ BACK COMPAT ] - Moops->import now takes a hash of options (including the `imports` option) rather than an arrayref of modules to import. [ Packaging ] - List Moose/Mouse/Moo/Class::Tiny dependencies as optional_features in META.json. [ Other ] - Improve Moops' extensibility via parser traits. 0.019 2013-08-30 - Removed: Removed Class::Tiny::Antlers; this is now a separate CPAN distribution. 0.018 2013-08-27 - Added: Add a `library` keyword for declaring type libraries. - Declared packages now get an implied BEGIN {...} block around themselves. 0.017 2013-08-21 - Updated: Support Class::Tiny 0.004. 0.016 2013-08-21 - Added: Provide a `types` option for loading type constraint libraries into classes, roles and namespaces. 0.015 2013-08-21 [ Bug Fixes ] - Fix a reference to Moops::DefineKeyword which will only work if you happen to have installed Moops over the top of a pre-0.012 version of Moops. - Load feature.pm so that it's consistently exported to the outer scope. 0.014 2013-08-21 [ Documentation ] - Document Class::Tiny::Antlers. [ Other ] - Added: MooseX::FunctionParametersInfo - Class::Tiny::Antlers now supports has \@attrs like Moose. 0.013 2013-08-20 [ Bug Fixes ] - Fix test that uses Role::Tiny and Class::Tiny without declaring them (Test::Requires). 0.012 2013-08-20 [ Documentation ] - Various documentation improvements. [ Other ] - Added: PerlX::Assert - Rename Moops::DefineKeyword -> PerlX::Define. 0.011 2013-08-20 [ Documentation ] - Document Attribute::Handlers-style attributes as an extensibility mechanism. [ Other ] - Added: Class::Tiny::Antlers - Added: Moops::TraitFor::Keyword::dirty - Added: Moops::TraitFor::Keyword::mutable - Added: Moops::TraitFor::Keyword::ro - Added: Moops::TraitFor::Keyword::rw - Added: Moops::TraitFor::Keyword::rwp - Added: Support classes built `using Class::Tiny`. - Moose classes will now `use Moose::XSAccessor` if possible. - Use MooseX::MungeHas to 0.002 smooth over more differences between Moo, Mouse and Moose. 0.010 2013-08-19 - Added: Parse Attribute::Handlers-style attributes attached to package declarations; treat these as traits for the code generator. - Much refactoring. - Rename Moops::CodeGenerator -> Moops::Keyword. 0.009 2013-08-19 [ Bug Fixes ] - Fix at-runtime hook (used for method modifiers). [ Packaging ] - The test suite is now in a reasonable state. 0.008 2013-08-18 [ Bug Fixes ] - Fix custom imports feature. - Found a remaining hard-coded list of keywords that was breaking extensibility mechanism. - Stop using constant.pm (though it's still required via Moo); this allows `true` and `false` to be correcting swept by namespace::sweep. [ Documentation ] - Bundle an example showing how to extend Moops. [ Packaging ] - Add Mouse and Moose as 'runtime suggests' dependencies. - Add Perl 5.14 as an explicit dependency. - More test suite improvements; still more to do. 0.007 2013-08-18 [ Bug Fixes ] - Fix parsing for the `namespace` keyword that was broken in 0.005. [ Packaging ] - Dependency - runtime suggestion for MooX::HandlesVia. - More test suite improvements; still more to do. [ Other ] - Help Class::Load (and thus Moose) notice that empty roles are loaded by setting $VERSION to an empty string when no version is specified. 0.006 2013-08-16 [ Documentation ] - Much improved documentation. [ Packaging ] - Some test suite improvements; more to come. [ Other ] - Call __PACKAGE__->meta->make_immutable on Moose/Mouse classes. - Rename MooX::Aspartame -> Moops. 0.005 2013-08-14 [ REGRESSIONS ] - Broke `namespace` keyword. [ Other ] - Improvements handling comments when parsing. - Massive amounts of refactoring to simplify maintenance and make subclassing easier. 0.004 2013-08-14 - Added: Implement `before`, `after` and `around` method modifiers. - Added: Implement `define` keyword to declare constants. - Removed: Drop the `classmethod` keyword; it's better to use `method` and give the invocant an explicit variable name. - Removed: Drop the `exporter` keyword; it is better to explicitly create a class extending Exporter::TypeTiny or Exporter. - The `method` keyword is only available in classes and roles; not plain namespaces. 0.003 2013-08-13 [ Packaging ] - use Dist::Inkt. [ Other ] - Added: New keyword `namespace`. - Don't export Try::Tiny to the outer scope, as it's not lexical. - Misc internal refactoring. - Re-implement relative package names, in a new, saner way. - Updated: use Function::Parameters 1.0201, because it has configurable type constraint reification. 0.002 2013-07-17 - Added: use MooX::late 0.014. - Misc internal refactoring. - Updated: use Moo 1.003000. 0.001 2013-07-01 Initial release INSTALL000664001750001750 306712416504253 12455 0ustar00taitai000000000000Moops-0.034 Installing Moops should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm Moops If you are installing into a system-wide directory, you may need to pass the "-S" flag to cpanm, which uses sudo to install the module: % cpanm -S Moops INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan Moops MANUAL INSTALLATION As a last resort, you can manually install it. Download the tarball and unpack it. Consult the file META.json for a list of pre-requisites. Install these first. To build Moops: % perl Makefile.PL % make && make test Then install it: % make install If you are installing into a system-wide directory, you may need to run: % sudo make install OPTIONAL FEATURES Moops provides several optional features, which may require additional pre-requisites. These features are: * Moo (allow classes and roles to be built with Moo) * Moose (allow classes and roles to be built with Moose) * Mouse (allow classes and roles to be built with Mouse) * Tiny (allow classes and roles to be built with Class::Tiny/Role::Tiny) cpanminus 1.7000 and above support installing optional features: % cpanm --with-feature=Moo Moops Otherwise, Makefile.PL can prompt you to select features. Set the `MM_INSTALL_FEATURES` environment variable to "1" before running Makefile.PL. LICENSE000664001750001750 4365512416504253 12460 0ustar00taitai000000000000Moops-0.034This software is copyright (c) 2014 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. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Toby Inkster. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Toby Inkster. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. 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. The End MANIFEST000664001750001750 326712416504256 12562 0ustar00taitai000000000000Moops-0.034COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE dist.ini doap.ttl examples/bench.pl examples/calculator.pl examples/class-versus-object-method.pl examples/cli-app.pl examples/extending-moops.pl examples/lib/MoopsX/Keyword/Exception.pm examples/lib/MoopsX/TraitFor/Parser/ExceptionKeyword.pm examples/multimethods.pl examples/using-moops-with-method-signatures.pl examples/using-moosextypes-in-moo.pl lib/Moops.pm lib/Moops/ImportSet.pm lib/Moops/Keyword.pm lib/Moops/Keyword/Class.pm lib/Moops/Keyword/Library.pm lib/Moops/Keyword/Role.pm lib/Moops/Manual/Objects101.pod lib/Moops/MethodModifiers.pm lib/Moops/Parser.pm lib/Moops/TraitFor/Keyword/assertions.pm lib/Moops/TraitFor/Keyword/dirty.pm lib/Moops/TraitFor/Keyword/fp.pm lib/Moops/TraitFor/Keyword/mutable.pm lib/Moops/TraitFor/Keyword/ro.pm lib/Moops/TraitFor/Keyword/rw.pm lib/Moops/TraitFor/Keyword/rwp.pm lib/MooseX/FunctionParametersInfo.pm lib/PerlX/Define.pm t/01basic.t t/02outer.t t/03lines.t t/04composition.t t/05true.t t/11class-moose.t t/11class-mouse.t t/11class-tiny.t t/11class.t t/12role-moose.t t/12role-mouse.t t/12role-tiny.t t/12role.t t/13namespace.t t/14versions.t t/21fun.t t/22method-moose.t t/22method.t t/23modifiers-moose.t t/23modifiers.t t/31types-moose.t t/31types-moosextypes-imported.t t/31types-moosextypes-moo.t t/31types-moosextypes.t t/31types-mouse.t t/31types.t t/32typeimport-moosextypes.t t/32typeimport.t t/33type-timing.t t/41constants.t t/51moresugar.t t/52customsugar.t t/53warnings.t t/71library-moosextypes.t t/71library.t t/91traits.t t/92trait-dirty.t t/93trait-mutable.t t/94trait-ro-rw-rwp.t t/99threads.t t/QuuxDie.pm t/ReturnsTrue.pm t/ReturnsTrueAgain.pm META.json000664001750001750 1522612416504256 13070 0ustar00taitai000000000000Moops-0.034{ "abstract" : "Moops Object-Oriented Programming Sugar", "author" : [ "Toby Inkster (TOBYINK) " ], "dynamic_config" : 1, "generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.142690", "keywords" : [], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Moops", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : { "Moo" : { "description" : "allow classes and roles to be built with Moo", "prereqs" : { "runtime" : { "suggests" : { "MooX::HandlesVia" : "0" } } }, "x_default" : 1 }, "Moose" : { "description" : "allow classes and roles to be built with Moose", "prereqs" : { "runtime" : { "recommends" : { "MooseX::XSAccessor" : "0" }, "requires" : { "Moose" : "2.0600" } }, "test" : { "suggests" : { "MooseX::Types::Common::Numeric" : "0" } } }, "x_default" : 0 }, "Mouse" : { "description" : "allow classes and roles to be built with Mouse", "prereqs" : { "runtime" : { "requires" : { "Mouse" : "1.00" } } }, "x_default" : 0 }, "Tiny" : { "description" : "allow classes and roles to be built with Class::Tiny/Role::Tiny", "prereqs" : { "runtime" : { "requires" : { "Class::Tiny::Antlers" : "0", "Role::Tiny" : "1.000000" } } }, "x_default" : 0 } }, "prereqs" : { "configure" : { "recommends" : { "CPAN::Meta::Requirements" : "2.000" }, "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "runtime" : { "conflicts" : { "MooseX::Types::Common" : "== 0.001011", "MooseX::Types::URI" : "== 0.04" }, "recommends" : { "Keyword::Simple" : "0.02" }, "requires" : { "Exporter::Tiny" : "0.040", "Import::Into" : "1.000000", "Kavorka" : "0.034", "Keyword::Simple" : "0.01", "Lexical::Accessor" : "0.008", "Module::Runtime" : "0.013", "Moo" : "1.006000", "MooX::late" : "0.015", "MooseX::MungeHas" : "0.007", "Parse::Keyword" : "0.006", "PerlX::Assert" : "0.902", "Scalar::Util" : "1.40", "Try::Tiny" : "0.12", "Type::Utils" : "1.000000", "Variable::Magic" : "0", "namespace::autoclean" : "0.20", "perl" : "5.014", "true" : "0.18" } }, "test" : { "recommends" : { "Test::Warnings" : "0" }, "requires" : { "Test::Fatal" : "0", "Test::More" : "0.96", "Test::Requires" : "0" }, "suggests" : { "Types::XSD::Lite" : "0.003" } } }, "provides" : { "Moops" : { "file" : "lib/Moops.pm", "version" : "0.034" }, "Moops::ImportSet" : { "file" : "lib/Moops/ImportSet.pm", "version" : "0.034" }, "Moops::Keyword" : { "file" : "lib/Moops/Keyword.pm", "version" : "0.034" }, "Moops::Keyword::Class" : { "file" : "lib/Moops/Keyword/Class.pm", "version" : "0.034" }, "Moops::Keyword::Library" : { "file" : "lib/Moops/Keyword/Library.pm", "version" : "0.034" }, "Moops::Keyword::Role" : { "file" : "lib/Moops/Keyword/Role.pm", "version" : "0.034" }, "Moops::MethodModifiers" : { "file" : "lib/Moops/MethodModifiers.pm", "version" : "0.034" }, "Moops::Parser" : { "file" : "lib/Moops/Parser.pm", "version" : "0.034" }, "Moops::TraitFor::Keyword::assertions" : { "file" : "lib/Moops/TraitFor/Keyword/assertions.pm", "version" : "0.034" }, "Moops::TraitFor::Keyword::dirty" : { "file" : "lib/Moops/TraitFor/Keyword/dirty.pm", "version" : "0.034" }, "Moops::TraitFor::Keyword::fp" : { "file" : "lib/Moops/TraitFor/Keyword/fp.pm", "version" : "0.034" }, "Moops::TraitFor::Keyword::mutable" : { "file" : "lib/Moops/TraitFor/Keyword/mutable.pm", "version" : "0.034" }, "Moops::TraitFor::Keyword::ro" : { "file" : "lib/Moops/TraitFor/Keyword/ro.pm", "version" : "0.034" }, "Moops::TraitFor::Keyword::rw" : { "file" : "lib/Moops/TraitFor/Keyword/rw.pm", "version" : "0.034" }, "Moops::TraitFor::Keyword::rwp" : { "file" : "lib/Moops/TraitFor/Keyword/rwp.pm", "version" : "0.034" }, "MooseX::FunctionParametersInfo" : { "file" : "lib/MooseX/FunctionParametersInfo.pm", "version" : "0.034" }, "MooseX::FunctionParametersInfo::Trait::Method" : { "file" : "lib/MooseX/FunctionParametersInfo.pm", "version" : "0.034" }, "MooseX::FunctionParametersInfo::Trait::WrappedMethod" : { "file" : "lib/MooseX/FunctionParametersInfo.pm", "version" : "0.034" }, "PerlX::Define" : { "file" : "lib/PerlX/Define.pm", "version" : "0.034" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://rt.cpan.org/Dist/Display.html?Queue=Moops" }, "homepage" : "https://metacpan.org/release/Moops", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/tobyink/p5-moops.git", "web" : "https://github.com/tobyink/p5-moops" }, "x_identifier" : "http://purl.org/NET/cpan-uri/dist/Moops/project" }, "version" : "0.034", "x_breaks" : { "MooseX::Types::Common" : "== 0.001011", "MooseX::Types::URI" : "== 0.04" }, "x_contributors" : [ "Maurice Mengel (MMAURICE) ", "Aaron James Trevena (TEEJAY) " ] } META.yml000664001750001750 743212416504256 12700 0ustar00taitai000000000000Moops-0.034--- abstract: 'Moops Object-Oriented Programming Sugar' author: - 'Toby Inkster (TOBYINK) ' build_requires: Test::Fatal: '0' Test::More: '0.96' Test::Requires: '0' configure_requires: ExtUtils::MakeMaker: '6.17' conflicts: MooseX::Types::Common: '== 0.001011' MooseX::Types::URI: '== 0.04' dynamic_config: 1 generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.142690' keywords: [] license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Moops no_index: directory: - eg - examples - inc - t - xt optional_features: Moo: description: 'allow classes and roles to be built with Moo' Moose: description: 'allow classes and roles to be built with Moose' recommends: MooseX::XSAccessor: '0' requires: Moose: '2.0600' Mouse: description: 'allow classes and roles to be built with Mouse' requires: Mouse: '1.00' Tiny: description: 'allow classes and roles to be built with Class::Tiny/Role::Tiny' requires: Class::Tiny::Antlers: '0' Role::Tiny: '1.000000' provides: Moops: file: lib/Moops.pm version: '0.034' Moops::ImportSet: file: lib/Moops/ImportSet.pm version: '0.034' Moops::Keyword: file: lib/Moops/Keyword.pm version: '0.034' Moops::Keyword::Class: file: lib/Moops/Keyword/Class.pm version: '0.034' Moops::Keyword::Library: file: lib/Moops/Keyword/Library.pm version: '0.034' Moops::Keyword::Role: file: lib/Moops/Keyword/Role.pm version: '0.034' Moops::MethodModifiers: file: lib/Moops/MethodModifiers.pm version: '0.034' Moops::Parser: file: lib/Moops/Parser.pm version: '0.034' Moops::TraitFor::Keyword::assertions: file: lib/Moops/TraitFor/Keyword/assertions.pm version: '0.034' Moops::TraitFor::Keyword::dirty: file: lib/Moops/TraitFor/Keyword/dirty.pm version: '0.034' Moops::TraitFor::Keyword::fp: file: lib/Moops/TraitFor/Keyword/fp.pm version: '0.034' Moops::TraitFor::Keyword::mutable: file: lib/Moops/TraitFor/Keyword/mutable.pm version: '0.034' Moops::TraitFor::Keyword::ro: file: lib/Moops/TraitFor/Keyword/ro.pm version: '0.034' Moops::TraitFor::Keyword::rw: file: lib/Moops/TraitFor/Keyword/rw.pm version: '0.034' Moops::TraitFor::Keyword::rwp: file: lib/Moops/TraitFor/Keyword/rwp.pm version: '0.034' MooseX::FunctionParametersInfo: file: lib/MooseX/FunctionParametersInfo.pm version: '0.034' MooseX::FunctionParametersInfo::Trait::Method: file: lib/MooseX/FunctionParametersInfo.pm version: '0.034' MooseX::FunctionParametersInfo::Trait::WrappedMethod: file: lib/MooseX/FunctionParametersInfo.pm version: '0.034' PerlX::Define: file: lib/PerlX/Define.pm version: '0.034' recommends: Keyword::Simple: '0.02' requires: Exporter::Tiny: '0.040' Import::Into: '1.000000' Kavorka: '0.034' Keyword::Simple: '0.01' Lexical::Accessor: '0.008' Module::Runtime: '0.013' Moo: '1.006000' MooX::late: '0.015' MooseX::MungeHas: '0.007' Parse::Keyword: '0.006' PerlX::Assert: '0.902' Scalar::Util: '1.40' Try::Tiny: '0.12' Type::Utils: '1.000000' Variable::Magic: '0' namespace::autoclean: '0.20' perl: '5.014' 'true': '0.18' resources: Identifier: http://purl.org/NET/cpan-uri/dist/Moops/project bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=Moops homepage: https://metacpan.org/release/Moops license: http://dev.perl.org/licenses/ repository: git://github.com/tobyink/p5-moops.git version: '0.034' x_breaks: MooseX::Types::Common: '== 0.001011' MooseX::Types::URI: '== 0.04' x_contributors: - 'Maurice Mengel (MMAURICE) ' - 'Aaron James Trevena (TEEJAY) ' Makefile.PL000664001750001750 3371112416504256 13420 0ustar00taitai000000000000Moops-0.034use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "Moops Object-Oriented Programming Sugar", "author" => ["Toby Inkster (TOBYINK) "], "dynamic_config" => 1, "generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.142690", "keywords" => [], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "Moops", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "optional_features" => { Moo => { description => "allow classes and roles to be built with Moo", prereqs => { runtime => { suggests => { "MooX::HandlesVia" => 0 } } }, x_default => 1, }, Moose => { description => "allow classes and roles to be built with Moose", prereqs => { runtime => { recommends => { "MooseX::XSAccessor" => 0 }, requires => { Moose => "2.0600" }, }, test => { suggests => { "MooseX::Types::Common::Numeric" => 0 } }, }, x_default => 0, }, Mouse => { description => "allow classes and roles to be built with Mouse", prereqs => { runtime => { requires => { Mouse => "1.00" } } }, x_default => 0, }, Tiny => { description => "allow classes and roles to be built with Class::Tiny/Role::Tiny", prereqs => { runtime => { requires => { "Class::Tiny::Antlers" => 0, "Role::Tiny" => "1.000000" }, }, }, x_default => 0, }, }, "prereqs" => { configure => { recommends => { "CPAN::Meta::Requirements" => "2.000" }, requires => { "ExtUtils::MakeMaker" => 6.17 }, }, runtime => { conflicts => { "MooseX::Types::Common" => "== 0.001011", "MooseX::Types::URI" => "== 0.04", }, recommends => { "Keyword::Simple" => 0.02 }, requires => { "Exporter::Tiny" => "0.040", "Import::Into" => "1.000000", "Kavorka" => 0.034, "Keyword::Simple" => 0.01, "Lexical::Accessor" => 0.008, "Module::Runtime" => 0.013, "Moo" => "1.006000", "MooseX::MungeHas" => 0.007, "MooX::late" => 0.015, "namespace::autoclean" => "0.20", "Parse::Keyword" => 0.006, "perl" => 5.014, "PerlX::Assert" => 0.902, "Scalar::Util" => "1.40", "true" => 0.18, "Try::Tiny" => 0.12, "Type::Utils" => "1.000000", "Variable::Magic" => 0, }, }, test => { recommends => { "Test::Warnings" => 0 }, requires => { "Test::Fatal" => 0, "Test::More" => 0.96, "Test::Requires" => 0 }, suggests => { "Types::XSD::Lite" => 0.003 }, }, }, "provides" => { "Moops" => { file => "lib/Moops.pm", version => 0.034 }, "Moops::ImportSet" => { file => "lib/Moops/ImportSet.pm", version => 0.034 }, "Moops::Keyword" => { file => "lib/Moops/Keyword.pm", version => 0.034 }, "Moops::Keyword::Class" => { file => "lib/Moops/Keyword/Class.pm", version => 0.034 }, "Moops::Keyword::Library" => { file => "lib/Moops/Keyword/Library.pm", version => 0.034 }, "Moops::Keyword::Role" => { file => "lib/Moops/Keyword/Role.pm", version => 0.034 }, "Moops::MethodModifiers" => { file => "lib/Moops/MethodModifiers.pm", version => 0.034 }, "Moops::Parser" => { file => "lib/Moops/Parser.pm", version => 0.034 }, "Moops::TraitFor::Keyword::assertions" => { file => "lib/Moops/TraitFor/Keyword/assertions.pm", version => 0.034, }, "Moops::TraitFor::Keyword::dirty" => { file => "lib/Moops/TraitFor/Keyword/dirty.pm", version => 0.034 }, "Moops::TraitFor::Keyword::fp" => { file => "lib/Moops/TraitFor/Keyword/fp.pm", version => 0.034 }, "Moops::TraitFor::Keyword::mutable" => { file => "lib/Moops/TraitFor/Keyword/mutable.pm", version => 0.034 }, "Moops::TraitFor::Keyword::ro" => { file => "lib/Moops/TraitFor/Keyword/ro.pm", version => 0.034 }, "Moops::TraitFor::Keyword::rw" => { file => "lib/Moops/TraitFor/Keyword/rw.pm", version => 0.034 }, "Moops::TraitFor::Keyword::rwp" => { file => "lib/Moops/TraitFor/Keyword/rwp.pm", version => 0.034 }, "MooseX::FunctionParametersInfo" => { file => "lib/MooseX/FunctionParametersInfo.pm", version => 0.034 }, "MooseX::FunctionParametersInfo::Trait::Method" => { file => "lib/MooseX/FunctionParametersInfo.pm", version => 0.034 }, "MooseX::FunctionParametersInfo::Trait::WrappedMethod" => { file => "lib/MooseX/FunctionParametersInfo.pm", version => 0.034 }, "PerlX::Define" => { file => "lib/PerlX/Define.pm", version => 0.034 }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "http://rt.cpan.org/Dist/Display.html?Queue=Moops" }, homepage => "https://metacpan.org/release/Moops", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", url => "git://github.com/tobyink/p5-moops.git", web => "https://github.com/tobyink/p5-moops", }, x_identifier => "http://purl.org/NET/cpan-uri/dist/Moops/project", }, "version" => 0.034, "x_breaks" => { "MooseX::Types::Common" => "== 0.001011", "MooseX::Types::URI" => "== 0.04", }, "x_contributors" => [ "Maurice Mengel (MMAURICE) ", "Aaron James Trevena (TEEJAY) ", ], }; if ($ENV{MM_INSTALL_FEATURES}) { my %features = %{ $meta->{optional_features} }; my @features = sort { $features{$b}{x_default} <=> $features{$a}{x_default} or $a cmp $b } keys %features; for my $feature_id (@features) { my %feature = %{ $features{$feature_id} }; next unless prompt( sprintf('Install %s (%s)?', $feature_id, $feature{description} || 'no description'), $feature{x_default} ? 'Y' : 'N', ) =~ /^Y/i; $features{$feature_id}{x_selected} = 1; for my $stage (keys %{$feature{prereqs}}) { for my $level (keys %{$feature{prereqs}{$stage}}) { for my $module (keys %{$feature{prereqs}{$stage}{$level}}) { $meta->{prereqs}{$stage}{$level}{$module} = $feature{prereqs}{$stage}{$level}{$module}; } } } } } else { print <<'MM_INSTALL_FEATURES'; ** Setting the MM_INSTALL_FEATURES environment variable to true ** would allow you to choose additional features. MM_INSTALL_FEATURES } my %dynamic_config; for my $stage (keys %{$meta->{prereqs}}) { my $conflicts = $meta->{prereqs}{$stage}{conflicts} or next; eval { require CPAN::Meta::Requirements } or last; $conflicts = 'CPAN::Meta::Requirements'->from_string_hash($conflicts); for my $module ($conflicts->required_modules) { eval "require $module" or next; my $installed = eval(sprintf('$%s::VERSION', $module)); $conflicts->accepts_module($module, $installed) or next; my $message = "\n". "** This version of $meta->{name} conflicts with the version of\n". "** module $module ($installed) you have installed.\n"; die($message . "\n" . "Bailing out") if $stage eq 'build' || $stage eq 'configure'; $message .= "**\n". "** It's strongly recommended that you update it after\n". "** installing this version of $meta->{name}.\n"; warn("$message\n"); } } my %WriteMakefileArgs = ( ABSTRACT => $meta->{abstract}, AUTHOR => ($EUMM >= 6.5702 ? $meta->{author} : $meta->{author}[0]), DISTNAME => $meta->{name}, VERSION => $meta->{version}, EXE_FILES => [ map $_->{file}, values %{ $meta->{x_provides_scripts} || {} } ], NAME => do { my $n = $meta->{name}; $n =~ s/-/::/g; $n }, test => { TESTS => "t/*.t" }, %dynamic_config, ); $WriteMakefileArgs{LICENSE} = $meta->{license}[0] if $EUMM >= 6.3001; sub deps { my %r; for my $stage (@_) { for my $dep (keys %{$meta->{prereqs}{$stage}{requires}}) { next if $dep eq 'perl'; my $ver = $meta->{prereqs}{$stage}{requires}{$dep}; $r{$dep} = $ver if !exists($r{$dep}) || $ver >= $r{$dep}; } } \%r; } my ($build_requires, $configure_requires, $runtime_requires, $test_requires); if ($EUMM >= 6.6303) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{TEST_REQUIRES} ||= deps('test'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.5503) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build', 'test'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.52) { $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime', 'build', 'test'); } else { $WriteMakefileArgs{PREREQ_PM} ||= deps('configure', 'build', 'test', 'runtime'); } { my ($minperl) = reverse sort( grep defined && /^[0-9]+(\.[0-9]+)?$/, map $meta->{prereqs}{$_}{requires}{perl}, qw( configure build runtime ) ); if (defined($minperl)) { die "Installing $meta->{name} requires Perl >= $minperl" unless $] >= $minperl; $WriteMakefileArgs{MIN_PERL_VERSION} ||= $minperl if $EUMM >= 6.48; } } sub FixMakefile { return unless -d 'inc'; my $file = shift; local *MAKEFILE; open MAKEFILE, "< $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; my $makefile = do { local $/; }; close MAKEFILE or die $!; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; open MAKEFILE, "> $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; print MAKEFILE $makefile or die $!; close MAKEFILE or die $!; } my $mm = WriteMakefile(%WriteMakefileArgs); FixMakefile($mm->{FIRST_MAKEFILE} || 'Makefile'); exit(0); README000664001750001750 4760612416504253 12333 0ustar00taitai000000000000Moops-0.034NAME Moops - Moops Object-Oriented Programming Sugar SYNOPSIS use Moops; role NamedThing { has name => (is => "ro", isa => Str); } class Person with NamedThing; class Company with NamedThing; class Employee extends Person { has job_title => (is => "rwp", isa => Str); has employer => (is => "rwp", isa => InstanceOf["Company"]); method change_job ( Object $employer, Str $title ) { $self->_set_job_title($title); $self->_set_employer($employer); } method promote ( Str $title ) { $self->_set_job_title($title); } } STATUS Unstable. Until version 1.000, stuff might change, but not without good reason. Planned Changes * Support for using Function::Parameters to handle method signatures is likely to be dropped. * Parameterized class and parameterized role support is planned. * The internals for parsing `class`, `role`, `namespace`, and `library` may change to use Parse::Keyword rather than Keyword::Simple. This will likely break any extensions that rely on subclassing or adding traits to the Moops::Parser or Moops::Keyword classes. DESCRIPTION Moops is sugar for declaring and using roles and classes in Perl. The syntax is inspired by MooseX::Declare, and Stevan Little's p5-mop-redux project (which is in turn partly inspired by Perl 6). Moops has fewer than half of the dependencies as MooseX::Declare, loads in about 25% of the time, and the classes built with it run significantly faster. Moops does not use Devel::Declare, instead using Perl's pluggable keyword API; *this requires Perl 5.14 or above*. Moops uses Moo to build classes and roles by default, but allows you to use Moose if you desire. (And Mouse experimentally.) Classes The `class` keyword declares a class: class Foo { # ... } A version number can be provided: class Foo 1.2 { # ... } If no version is provided, your class' $VERSION variable is set to the empty string; this helps the package be seen by Class::Load. If your class extends an existing class through inheritance, or consumes one or more roles, these can also be provided when declaring the class. class Foo::Bar 1.2 extends Foo 1.1 with Magic::Monkeys { # ... } If you use Moops within a package other than `main`, then package names used within the declaration are "qualified" by that outer package, unless they contain "::". So for example: package Quux; use Moops; class Foo { } # declares Quux::Foo class Xyzzy::Foo # declares Xyzzy::Foo extends Foo { } # ... extending Quux::Foo class ::Baz { } # declares Baz If you wish to use Moose or Mouse instead of Moo; include that in the declaration: class Foo using Moose { # ... } It's also possible to create classes `using Tiny` (Class::Tiny), but there's probably little point in it, because Moops uses Moo internally, so the more capable Moo is already loaded and in memory. (The `using` option is exempt from the package qualification rules mentioned earlier.) Moops uses MooseX::MungeHas in your classes so that the `has` keyword supports some Moo-specific features, even when you're using Moose or Mouse. Specifically, it supports `is => 'rwp'`, `is => 'lazy'`, `builder => 1`, `clearer => 1`, `predicate => 1`, and `trigger => 1`. If you're using Moo, the MooX::late extension is enabled too, which allows Moose-isms in Moo too. With the combination of these features, there should be very little difference between Moo, Mouse and Moose `has` keywords. Moops uses Lexical::Accessor to provide you with private (lexical) attributes - that is, attributes accessed via a coderef method in a lexical variable. class Foo { lexical_has foo => ( isa => Int, accessor => \(my $_foo), default => 0, ); method increment_foo () { $self->$_foo( 1 + $self->$_foo ); } method get_foo () { return $self->$_foo; } } my $x = Foo->new; $x->increment_foo(); # ok say $x->get_foo(); # says "1" $x->$_foo(42); # dies; $_foo does not exist in this scope Moose classes are automatically accelerated using MooseX::XSAccessor if it's installed. Note that it is possible to declare a class with an empty body; use a trailing semicolon. class Employee extends Person with Employment; If using Moose or Mouse, classes are automatically made immutable. namespace::autoclean is automatically used in all classes. Between the class declaration and its body, Attribute::Handlers-style attributes may be provided: class Person :mutable { # ... } class Employee extends Person with Employment :mutable; The following attributes are defined for classes: * `:assertions` - enables assertion checking (see below) * `:dirty` - suppresses namespace::autoclean * `:fp` - use Function::Parameters instead of Kavorka * `:mutable` - suppresses making Moose classes immutable * `:ro` - make attributes declared with `has` default to 'ro' * `:rw` - make attributes declared with `has` default to 'rw' * `:rwp` - make attributes declared with `has` default to 'rwp' Roles Roles can be declared similarly to classes, but using the `role` keyword. role Stringable using Moose # we know you meant Moose::Role { # ... } Roles do not support the `extends` option. Roles can be declared to be `using` Moo, Moose, Mouse or Tiny. (Note that if you're mixing and matching role frameworks, there are limitations to which class builders can consume which roles. Mouse is generally the least compatible; Moo and Moose classes should be able to consume each others' roles; Moo can also consume Role::Tiny roles.) If roles use Moo, the MooX::late extension is enabled. namespace::autoclean is automatically used in all roles. Roles take similar Attribute::Handlers-style attributes to classes, but don't support `:mutable`. A note on consuming roles In a standard: class MyClass with MyRole { ...; } You should note that role composition is delayed to happen at the *end* of the class declaration. This is usually what you want. However the interaction between method modifiers and roles is complex, and *sometimes* you'll want the role to be applied to the class part-way through the declaration. In this case you can use a `with` statement *inside* the class declaration: class MyClass { ...; with "MyRole"; ...; } Namespaces The `namespace` keyword works as above, but declares a package without any class-specific or role-specific semantics. namespace Utils { # ... } namespace::autoclean is not automatically used in namespaces. Attribute::Handlers-style attributes are supported for namespaces, but most of the built-in attributes make any sense without class/role semantics. (`:assertions` does.) Traits written as Moops extensions may support namespaces. Functions and Methods Moops uses Kavorka to declare functions and methods within classes and roles. Kavorka provides the `fun` and `method` keywords. class Person { use Scalar::Util 'refaddr'; has name => (is => 'rwp'); # Moo attribute method change_name ( Str $newname ) { $self->_set_name( $newname ) unless $newname eq 'Princess Consuela Banana-Hammock'; } fun is_same_as ( Object $x, Object $y ) { refaddr($x) == refaddr($y) } } my $phoebe = Person->new(name => 'Phoebe'); my $ursula = Person->new(name => 'Ursula'); Person::is_same_as($phoebe, $ursula); # false Note function signatures use type constraints from Types::Standard; MooseX::Types and MouseX::Types type constraints should also work, *provided you use their full names, including their package*. The `is_same_as` function above could have been written as a class method like this: class Person { # ... method is_same_as ( $class: Object $x, Object $y ) { refaddr($x) == refaddr($y) } } # ... Person->is_same_as($phoebe, $ursula); # false The `method` keyword is not provided within packages declared using `namespace`; only within classes and roles. See also Kavorka::Manual::Methods and Kavorka::Manual::Functions. Within Moose classes and roles, the MooseX::KavorkaInfo module is loaded, to allow access to method signatures via the meta object protocol. (This is currently broken for `around` method modifiers.) In Moops prior to 0.025, Function::Parameters was used instead of Kavorka. If you wish to continue to use Function::Parameters in a class you can use the `:fp` attribute: class Person :fp { ...; } Or to do so for all classes in a lexical scope: use Moops function_parameters_everywhere => 1; class Person { ...; } Or the environment variable `MOOPS_FUNCTION_PARAMETERS_EVERYWHERE` can be set to true to enable it globally, but this feature is likely to be removed eventually. Method Modifiers Within classes and roles, `before`, `after` and `around` keywords are provided for declaring method modifiers. These use the same syntax as `method`. If your class or role is using Moose or Mouse, then you also get `augment` and `override` keywords. See also Kavorka::Manual::MethodModifiers. Multi Methods Moops uses Kavorka to implement multi subs and multi methods. See also Kavorka::Manual::MultiSubs. Type Constraints The Types::Standard type constraints are exported to each package declared using Moops. This allows the standard type constraints to be used as barewords. Type constraints can be used in attribute definitions (`isa`) and method signatures. Because Types::Standard is based on Type::Tiny, the same type constraints may be used whether you build your classes and roles with Moo, Moose our Mouse. Alternative libraries can be imported using the `types` option; a la: class Document types Types::XSD::Lite { has title => (is => 'rw', isa => NormalizedString); } Note that if an alternative type constraint library is imported, then Types::Standard is *not* automatically loaded, and needs to be listed explicitly: class Document types Types::Standard, Types::XSD::Lite { # ... } Type libraries built with Type::Library, MooseX::Types and MouseX::Types should all work. Bear in mind that type constraints from, say, a MooseX::Types library won't be usable in, say, Moo attribute definitions. However, it's possible to wrap them with Type::Tiny, and make them usable: class Foo types MooseX::Types::Common::Numeric using Moo { use Types::TypeTiny qw( to_TypeTiny ); has favourite_number => ( is => 'rwp', isa => to_TypeTiny(PositiveInt) ); } Type Libraries You can use the `library` keyword to declare a new type library: library MyTypes extends Types::Standard declares EmptyString, NonEmptyString { declare EmptyString, as Str, where { length($_) == 0 }; declare NonEmptyString, as Str, where { length($_) > 0 }; } class StringChecker types MyTypes { method check ( Str $foo ) { return "empty" if EmptyString->check($foo); return "non-empty" if NonEmptyString->check($foo); return "impossible?!"; } } Libraries declared this way can extend existing type libraries written with Type::Library, MooseX::Types or MouseX::Types. Note that this also provides a solution to the previously mentioned problem of using MooseX::Types type libraries in Moo classes: library MyWrapper extends MooseX::Types::Common::Numeric; class Foo types MyWrapper using Moo { has favourite_number => ( is => 'rwp', isa => PositiveInt, ); } Constants The useful constants `true` and `false` are imported into all declared packages. (Within classes and roles, namespace::autoclean will later remove them from the symbol table, so they don't form part of your package's API.) These constants can help make attribute declarations more readable. has name => (is => 'ro', isa => Str, required => true); Further constants can be declared using the `define` keyword (see PerlX::Define): namespace Maths { define PI = 3.2; } Constants declared this way will *not* be swept away by namespace::autoclean, and are considered part of your package's API. Assertions Declared packages can contain assertions (see PerlX::Assert). These are normally optimized away at compile time, but you can force them to be checked using the `:assertions` attribute. class Foo { assert(false); # not checked; optimized away } class Bar :assertions { assert(false); # checked; fails; throws exception } More Sugar strict and FATAL warnings are imported into all declared packages. However the `uninitialized`, `void`, `once` and `numeric` warning categories are explicitly excluded, as are any warnings categories added to Perl after version 5.14. Perl 5.14 features, including the `state` and `say` keywords, and sane Unicode string handling are imported into all declared packages. Try::Tiny is imported into all declared packages. Scalar::Util's `blessed` and Carp's `confess` are imported into all declared packages. Outer Sugar The "outer" package, where the `use Moops` statement appears also gets a little sugar: strict, the same warnings as "inner" packages, and Perl 5.14 features are all switched on. true is loaded, so you don't need to do this at the end of your file: 1; Custom Sugar It is possible to inject other functions into all inner packages using: use Moops imports => [ 'List::Util' => [qw( first reduce )], 'List::MoreUtils' => [qw( any all none )], ]; This is by far the easiest way to extend Moops with project-specific extras. There is a shortcut for injecting strictures into all inner packages: use Moops -strict; EXTENDING Moops is written to hopefully be fairly extensible. Extending Moops via imports The easiest way to extend Moops is to inject additional imports into the inner packages using the technique outlined in "Custom Sugar" above. You can wrap all that up in a module: package MoopsX::Lists; use base 'Moops'; use List::Util (); use List::MoreUtils (); sub import { my ($class, %opts) = @_; push @{ $opts{imports} ||= [] }, ( 'List::Util' => [qw( first reduce )], 'List::MoreUtils' => [qw( any all none )], ); $class->SUPER::import(%opts); } 1; Now people can do `use MoopsX::Lists` instead of `use Moops`. Extending Moops via keyword traits Roles in the `Moops::TraitFor::Keyword` namespace are automatically loaded and applied to keyword objects when a corresponding Attribute::Handlers-style attribute is seen. For examples extending Moops this way, see the Moops::TraitFor::Keyword::dirty, Moops::TraitFor::Keyword::mutable, Moops::TraitFor::Keyword::ro, Moops::TraitFor::Keyword::rw and Moops::TraitFor::Keyword::rwp traits. Extending Moops via parser traits For more complex needs, you can create a trait which will be applied to Moops::Parser. Parser traits might want to override: * The `keywords` class method, which returns the list of keywords the parser can handle. * The `class_for_keyword` object method, which returns the name of a subclass of Moops::Keyword which will be used for translating the result of parsing the keyword into a string using Perl's built-in syntax. Hopefully you'll be able to avoid overriding the `parse` method itself, as it has a slightly messy API. Your `class_for_keyword` subclass can either be a direct subclass of Moops::Keyword, or of Moops::Keyword::Class or Moops::Keyword::Role. The keyword subclass might want to override: * The `known_relationships` class method, which returns a list of valid inter-package relationships such as `extends` and `using` for the current keyword. * The `qualify_relationship` class method, which, when given the name of an inter-package relationship, indicates whether it should be subjected to package qualification rules (like `extends` and `with` are, but `using` is not). * The `version_relationship` class method, which, when given the name of an inter-package relationship, indicates whether it should accept a version number. * The `generate_package_setup` object method which returns a list of strings to inject into the package. * The `arguments_for_function_parameters` object method which is used by the default `generate_package_setup` method to set up the arguments to be passed to Function::Parameters. * The `check_prerequisites` method which performs certain pre-flight checks and may throw an exception. Hopefully you'll be able to avoid overriding the `generate_code` method. You can apply your trait using: use Moops traits => [ 'Moops::TraitFor::Parser::FooKeyword', 'Moops::TraitFor::Parser::BarKeyword', ]; BUGS Please report any other bugs to . SUPPORT IRC: support is available through in the *#moops* channel on irc.perl.org . For general Moose/Moo queries which don't seem to be related to Moops' syntactic sugar, your question may be answered more quickly in the *#moose* channel. Web: if you ask a question on PerlMonks in Seekers of Perl Wisdom with "Moops" in the subject line, it should be answered pretty quickly. There is a moops tag on StackOverflow. SEE ALSO Similar: MooseX::Declare, . Main functionality exposed by this module: Moo/MooX::late, Kavorka, Try::Tiny, Types::Standard, namespace::autoclean, true, PerlX::Assert. Internals fueled by: Keyword::Simple, Module::Runtime, Import::Into, Attribute::Handlers. . AUTHOR Toby Inkster . COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. SIGNATURE000664001750001750 1414212416504256 12727 0ustar00taitai000000000000Moops-0.034This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.73. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SHA1 2c58ee185f18eb84f812bdc11e79bf3615a05a17 COPYRIGHT SHA1 6051a28932d064b052ecc8d2850ec5a9cbade7c8 CREDITS SHA1 15ddd93213da8c0320cdab1fb4fab8d264ff9144 Changes SHA1 778e63aaaa913ee92351d9f7c8353883969ef64c INSTALL SHA1 34f5e12514b91055de4b164a1f2327ef5c30ba53 LICENSE SHA1 06df8ab6e2778ee85cb495ead9a187ac10c733bd MANIFEST SHA1 c1e1dc1848c12dc5028f98a3a2e2dc860142f1d4 META.json SHA1 09dbcc27eff51f73026610e8adaca5a391532a3e META.yml SHA1 b5e9bbe76ee47a1b89347f0f9d705051dbd5680a Makefile.PL SHA1 2e247c60b5520dfa63fcee51aafb934005b229a7 README SHA1 a1de9e1386567b9f2d16b830fac353cf8b0ce888 dist.ini SHA1 0104a0c077955ec85197c71af7213d86a7672b66 doap.ttl SHA1 327c3931098a4aabacf484977bffe8af64bcac6c examples/bench.pl SHA1 f93ec33dbded76078df892fe8a76bcf277fce309 examples/calculator.pl SHA1 4c8cf95ea28826e3a3363be2bec79e751d541faf examples/class-versus-object-method.pl SHA1 5c33f9df66bbbf0aaa6e5f0477aab0a1daf40ea5 examples/cli-app.pl SHA1 e1ad650d5fe58dfa57a6e3445852068b1ccd4c1f examples/extending-moops.pl SHA1 08c658b3e06cf364d4f6f8c00e54c34475fa49f5 examples/lib/MoopsX/Keyword/Exception.pm SHA1 666df19166e0e54b5eed2bc9e7f90d6748551eed examples/lib/MoopsX/TraitFor/Parser/ExceptionKeyword.pm SHA1 67671b263a97d7f34a81d8aabf5492b5cc406c16 examples/multimethods.pl SHA1 797b9a9e22b785b9f62510e16ea2300bb0e1f4d7 examples/using-moops-with-method-signatures.pl SHA1 7ffa5a1438c744e564877933571a806efe50be30 examples/using-moosextypes-in-moo.pl SHA1 7ebeb5a5cf81321e1d16776dc2abacf65abfbb8e lib/Moops.pm SHA1 f50f76a6f380a756de21a0c0509f925089de1bfa lib/Moops/ImportSet.pm SHA1 d593298beb796f846ca0ab25624353014139d2c4 lib/Moops/Keyword.pm SHA1 301c7856c7d0b09127dd0c64d95df83befef3c10 lib/Moops/Keyword/Class.pm SHA1 35d85977903dadbea0346b8c470c8695a08e501e lib/Moops/Keyword/Library.pm SHA1 1f7e402b68bb43993b16ba79f56dee931b4d0688 lib/Moops/Keyword/Role.pm SHA1 5e65850b5f1f9530510afc09487dc249f1580658 lib/Moops/Manual/Objects101.pod SHA1 279ceede8577228664d85ea8ee1257f7ce15908b lib/Moops/MethodModifiers.pm SHA1 a2b0a932a4c2eb3aa439946b3c616bb4005beb2f lib/Moops/Parser.pm SHA1 0f6b4e83056a43a0a33f755ac4d45b69daf3e8c6 lib/Moops/TraitFor/Keyword/assertions.pm SHA1 32ebacf6194513264a7db09ab7a0ec5eb52ed82f lib/Moops/TraitFor/Keyword/dirty.pm SHA1 481624130d5e99b31eb5b6a7d1e739c6380782d1 lib/Moops/TraitFor/Keyword/fp.pm SHA1 7d09986b12290597570571eaf3aa04d7cf1ac45e lib/Moops/TraitFor/Keyword/mutable.pm SHA1 8cbad5059ab1f22bef2bed195a9c987c80fe7267 lib/Moops/TraitFor/Keyword/ro.pm SHA1 22f4e8f1f998f8a98a900b2d06118b8361417784 lib/Moops/TraitFor/Keyword/rw.pm SHA1 983b76236f8006cf692ab937fbf43eb89c7fcec6 lib/Moops/TraitFor/Keyword/rwp.pm SHA1 8b26ad7b56350b52abf4d2fa268df402a09129bf lib/MooseX/FunctionParametersInfo.pm SHA1 86c251e0455fe3e469d5104e56e6bd2b0b759899 lib/PerlX/Define.pm SHA1 7792a0666b5fc7cc2c60d7f4c4d0ed9bd70cedb1 t/01basic.t SHA1 01af441b4fda437f5b7baf423894af23e7f2b881 t/02outer.t SHA1 7bfef609016082ab0c98d14e8863f1b07e50129b t/03lines.t SHA1 5f37101b6ff5e4e51ee69f379dbcbab8a776dcc0 t/04composition.t SHA1 142aeaf292a05b4457ca2f48034d75e51f12f641 t/05true.t SHA1 291f0c19e702c870ed2f3b0a009ccac53af6da88 t/11class-moose.t SHA1 a8d24b36863562f8bebea18d6eb3a916b77dea22 t/11class-mouse.t SHA1 345d368cbcc6ffe039979cfef72b705aa694b3ab t/11class-tiny.t SHA1 465a54c19771ddcf7851b7a569e6bc525b224bce t/11class.t SHA1 df63e529408d611963a03ceb7816e459485ec52c t/12role-moose.t SHA1 f42c8a9071a449b4a6d03395fb0a22d1435d023c t/12role-mouse.t SHA1 270b2d7a1f2a6c532eb87046e507f4ed805c5037 t/12role-tiny.t SHA1 fb296c126242e51be0c778c3c6b796f6a6e70e38 t/12role.t SHA1 968e6256291aa249c25fab3395dea4a2f84f2b04 t/13namespace.t SHA1 4e83a90cbb895ab8ba924b8706584556867629f3 t/14versions.t SHA1 cc43d2fb6da18bb1379eeaf2d25dd6256e0a51e8 t/21fun.t SHA1 0796381a890576f767c9e3283e8ec63077388e41 t/22method-moose.t SHA1 ed0a332f831b2a0376338f12e95ce88aaa1840e9 t/22method.t SHA1 a94a1bcaeae7a9602210c542b64ccc4532a912ae t/23modifiers-moose.t SHA1 02773a6137411251846f002fe491a63d0cf81b5d t/23modifiers.t SHA1 ff75df407642cf69975b865ecf1598ce1266162b t/31types-moose.t SHA1 7d13130304194ab7199ab41e9a6df1846c9b5bd1 t/31types-moosextypes-imported.t SHA1 9cf57f4e4fe8feebfe5d7ebfbd7e967d0c06d6b6 t/31types-moosextypes-moo.t SHA1 7d7960782a42883c80d95df8602d1fb2ed8c76c1 t/31types-moosextypes.t SHA1 9ec5c19b89ee72c61269d6b319ea74950ac8ea68 t/31types-mouse.t SHA1 f03fc3694d1398a588f24467cf1fe056870c5ea8 t/31types.t SHA1 ff2e343fb71c7db1a7b503819fc89b61a2972a40 t/32typeimport-moosextypes.t SHA1 e47ffedb6bec74232a7e3bc8134486c5a6da730e t/32typeimport.t SHA1 6084fe9098f52e69577210fd445f2652648d2a12 t/33type-timing.t SHA1 f259bc78937fc15bcdb4c1332e6f9606e6719851 t/41constants.t SHA1 87843a816ee0c713844aa26d2fbc2662516be2e4 t/51moresugar.t SHA1 a2a447dc2c57c49efc6554d6434a7242261cf40c t/52customsugar.t SHA1 0f520be366940bcc870848fef90aeea3421053c7 t/53warnings.t SHA1 8d5a9d173bf18491cdbaa267f3afbc48ce997f11 t/71library-moosextypes.t SHA1 8504fe493608a1c5bd0e52015179f6a90352bb78 t/71library.t SHA1 7dfba69b6e93ee70a6a46caa8f1adbf9322cc528 t/91traits.t SHA1 5589eb1fc8553acb56f4c02ea26f5d167e29f80f t/92trait-dirty.t SHA1 0208e554b3f82d3db5401d13004ef9001cadc88c t/93trait-mutable.t SHA1 3c316ede34e88b2cac64c826bcfa7dd55317ac5f t/94trait-ro-rw-rwp.t SHA1 eabf4c8a36478d04a1ab8a0805aea93b9e8407a4 t/99threads.t SHA1 ab93a79d322143a2694cba527f87c2d2965aa021 t/QuuxDie.pm SHA1 cb6c25e22ce924d3eaf3854df40af0518c02e0a1 t/ReturnsTrue.pm SHA1 f49ca0306bfc38fe0d46e4129f0c90bc9388f856 t/ReturnsTrueAgain.pm -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlQ6iK4ACgkQzr+BKGoqfTlBEACfbFD0xKMKIpJO2KdbCTb2imZK occAniaqufEyyPNgQ+g2kqOQLyWQQRSf =hKle -----END PGP SIGNATURE----- dist.ini000664001750001750 14212416504253 13037 0ustar00taitai000000000000Moops-0.034; Configuration file for Dist::Inkt ; ;; class = 'Dist::Inkt::Profile::TOBYINK' ;; name = 'Moops' doap.ttl000664001750001750 11035612416504256 13137 0ustar00taitai000000000000Moops-0.034@prefix dc: . @prefix doap: . @prefix doap-bugs: . @prefix doap-changeset: . @prefix doap-deps: . @prefix foaf: . @prefix rdfs: . @prefix xsd: . dc:title "the same terms as the perl 5 programming language system itself". a doap:Project; dc:contributor ; doap-deps:develop-requires [ doap-deps:on "bareword::filehandles"^^doap-deps:CpanId; ], [ doap-deps:on "indirect"^^doap-deps:CpanId ], [ doap-deps:on "multidimensional"^^doap-deps:CpanId ]; doap-deps:feature [ doap-deps:runtime-suggestion [ doap-deps:on "MooX::HandlesVia"^^doap-deps:CpanId ]; doap-deps:x_default true; doap:name "Moo"; doap:shortdesc "allow classes and roles to be built with Moo"; ], [ doap-deps:runtime-recommendation [ doap-deps:on "MooseX::XSAccessor"^^doap-deps:CpanId; ]; doap-deps:runtime-requirement [ doap-deps:on "Moose 2.0600"^^doap-deps:CpanId ]; doap-deps:test-suggestion [ doap-deps:on "MooseX::Types::Common::Numeric"^^doap-deps:CpanId; ]; doap-deps:x_default false; doap:name "Moose"; doap:shortdesc "allow classes and roles to be built with Moose"; ], [ doap-deps:runtime-requirement [ doap-deps:on "Mouse 1.00"^^doap-deps:CpanId ]; doap-deps:x_default false; doap:name "Mouse"; doap:shortdesc "allow classes and roles to be built with Mouse"; ], [ doap-deps:runtime-requirement [ doap-deps:on "Role::Tiny 1.000000"^^doap-deps:CpanId; ], [ doap-deps:on "Class::Tiny::Antlers"^^doap-deps:CpanId; ]; doap-deps:x_default false; doap:name "Tiny"; doap:shortdesc "allow classes and roles to be built with Class::Tiny/Role::Tiny"; ]; doap-deps:runtime-conflict [ doap-deps:on "MooseX::Types::Common == 0.001011"^^doap-deps:CpanId; ], [ doap-deps:on "MooseX::Types::URI == 0.04"^^doap-deps:CpanId; ]; doap-deps:runtime-recommendation [ doap-deps:on "Keyword::Simple 0.02"^^doap-deps:CpanId; rdfs:comment "Improved line number accounting."; ]; doap-deps:runtime-requirement [ doap-deps:on "Moo 1.006000"^^doap-deps:CpanId ], [ doap-deps:on "MooX::late 0.015"^^doap-deps:CpanId ], [ doap-deps:on "MooseX::MungeHas 0.007"^^doap-deps:CpanId; ], [ doap-deps:on "Parse::Keyword 0.006"^^doap-deps:CpanId; ], [ doap-deps:on "PerlX::Assert 0.902"^^doap-deps:CpanId; ], [ doap-deps:on "Scalar::Util 1.40"^^doap-deps:CpanId ], [ doap-deps:on "Variable::Magic"^^doap-deps:CpanId ], [ doap-deps:on "Type::Utils 1.000000"^^doap-deps:CpanId; ], [ doap-deps:on "Try::Tiny 0.12"^^doap-deps:CpanId ], [ doap-deps:on "namespace::autoclean 0.20"^^doap-deps:CpanId; ], [ doap-deps:on "true 0.18"^^doap-deps:CpanId ], [ doap-deps:on "perl 5.014"^^doap-deps:CpanId ], [ doap-deps:on "Exporter::Tiny 0.040"^^doap-deps:CpanId; ], [ doap-deps:on "Import::Into 1.000000"^^doap-deps:CpanId; ], [ doap-deps:on "Kavorka 0.034"^^doap-deps:CpanId ], [ doap-deps:on "Keyword::Simple 0.01"^^doap-deps:CpanId; ], [ doap-deps:on "Lexical::Accessor 0.008"^^doap-deps:CpanId; ], [ doap-deps:on "Module::Runtime 0.013"^^doap-deps:CpanId; ]; doap-deps:test-recommendation [ doap-deps:on "Test::Warnings"^^doap-deps:CpanId ]; doap-deps:test-requirement [ doap-deps:on "Test::More 0.96"^^doap-deps:CpanId ], [ doap-deps:on "Test::Requires"^^doap-deps:CpanId ], [ doap-deps:on "Test::Fatal"^^doap-deps:CpanId ]; doap-deps:test-suggestion [ doap-deps:on "Types::XSD::Lite 0.003"^^doap-deps:CpanId; ]; doap:bug-database ; doap:created "2013-06-30"^^xsd:date; doap:developer ; doap:download-page ; doap:homepage ; doap:license ; doap:maintainer ; doap:name "Moops"; doap:programming-language "Perl"; doap:release , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ; doap:repository [ a doap:GitRepository; doap:browse ; ]; doap:shortdesc "Moops Object-Oriented Programming Sugar". a doap:Version; rdfs:label "Initial release"; dc:identifier "Moops-0.001"^^xsd:string; dc:issued "2013-07-01"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.001"^^xsd:string. a doap:Version; dc:identifier "Moops-0.002"^^xsd:string; dc:issued "2013-07-17"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Misc internal refactoring."; ], [ a doap-changeset:Addition; rdfs:label "use MooX::late 0.014."; ], [ a doap-changeset:Update; rdfs:label "use Moo 1.003000."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.002"^^xsd:string. a doap:Version; dc:identifier "Moops-0.003"^^xsd:string; dc:issued "2013-08-13"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Misc internal refactoring."; ], [ a doap-changeset:Update; rdfs:label "use Function::Parameters 1.0201, because it has configurable type constraint reification."; ], [ a doap-changeset:Packaging; rdfs:label "use Dist::Inkt."; ], [ a doap-changeset:Addition; rdfs:label "New keyword `namespace`."; ], [ a doap-changeset:Change; rdfs:label "Re-implement relative package names, in a new, saner way."; ], [ a doap-changeset:Change; rdfs:label "Don't export Try::Tiny to the outer scope, as it's not lexical."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.003"^^xsd:string. a doap:Version; dc:identifier "Moops-0.004"^^xsd:string; dc:issued "2013-08-14"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Implement `define` keyword to declare constants."; ], [ a doap-changeset:Removal; rdfs:label "Drop the `exporter` keyword; it is better to explicitly create a class extending Exporter::TypeTiny or Exporter."; ], [ a doap-changeset:Removal; rdfs:label "Drop the `classmethod` keyword; it's better to use `method` and give the invocant an explicit variable name."; ], [ a doap-changeset:Change; rdfs:label "The `method` keyword is only available in classes and roles; not plain namespaces."; ], [ a doap-changeset:Addition; rdfs:label "Implement `before`, `after` and `around` method modifiers."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.004"^^xsd:string. a doap:Version; dc:identifier "Moops-0.005"^^xsd:string; dc:issued "2013-08-14"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Massive amounts of refactoring to simplify maintenance and make subclassing easier."; ], [ a doap-changeset:Change; rdfs:label "Improvements handling comments when parsing."; ], [ a doap-changeset:Regression; rdfs:label "Broke `namespace` keyword."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.005"^^xsd:string. a doap:Version; dc:identifier "Moops-0.006"^^xsd:string; dc:issued "2013-08-16"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Rename MooX::Aspartame -> Moops."; ], [ a doap-changeset:Change; rdfs:label "Call __PACKAGE__->meta->make_immutable on Moose/Mouse classes."; ], [ a doap-changeset:Documentation; rdfs:label "Much improved documentation."; ], [ a doap-changeset:Packaging; rdfs:label "Some test suite improvements; more to come."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.006"^^xsd:string. a doap:Version; dc:identifier "Moops-0.007"^^xsd:string; dc:issued "2013-08-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "More test suite improvements; still more to do."; ], [ a doap-changeset:Packaging; rdfs:label "Dependency - runtime suggestion for MooX::HandlesVia."; ], [ a doap-changeset:Change; rdfs:label "Help Class::Load (and thus Moose) notice that empty roles are loaded by setting $VERSION to an empty string when no version is specified."; ], [ a doap-changeset:Bugfix; rdfs:label "Fix parsing for the `namespace` keyword that was broken in 0.005."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.007"^^xsd:string. a doap:Version; dc:identifier "Moops-0.008"^^xsd:string; dc:issued "2013-08-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Add Mouse and Moose as 'runtime suggests' dependencies."; ], [ a doap-changeset:Packaging; rdfs:label "Add Perl 5.14 as an explicit dependency."; ], [ a doap-changeset:Bugfix; rdfs:label "Found a remaining hard-coded list of keywords that was breaking extensibility mechanism."; ], [ a doap-changeset:Documentation; rdfs:label "Bundle an example showing how to extend Moops."; ], [ a doap-changeset:Bugfix; rdfs:label "Fix custom imports feature."; ], [ a doap-changeset:Bugfix; rdfs:label "Stop using constant.pm (though it's still required via Moo); this allows `true` and `false` to be correcting swept by namespace::sweep."; ], [ a doap-changeset:Packaging; rdfs:label "More test suite improvements; still more to do."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.008"^^xsd:string. a doap:Version; dc:identifier "Moops-0.009"^^xsd:string; dc:issued "2013-08-19"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "The test suite is now in a reasonable state."; ], [ a doap-changeset:Bugfix; rdfs:label "Fix at-runtime hook (used for method modifiers)."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.009"^^xsd:string. a doap:Version; dc:identifier "Moops-0.010"^^xsd:string; dc:issued "2013-08-19"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Parse Attribute::Handlers-style attributes attached to package declarations; treat these as traits for the code generator."; ], [ a doap-changeset:Change; rdfs:label "Rename Moops::CodeGenerator -> Moops::Keyword."; ], [ a doap-changeset:Change; rdfs:label "Much refactoring."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.010"^^xsd:string. a doap:Version; dc:identifier "Moops-0.011"^^xsd:string; dc:issued "2013-08-20"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Support classes built `using Class::Tiny`."; ], [ a doap-changeset:Addition; rdfs:label "Class::Tiny::Antlers"; ], [ a doap-changeset:Documentation; rdfs:label "Document Attribute::Handlers-style attributes as an extensibility mechanism."; ], [ a doap-changeset:Addition; rdfs:label "Moops::TraitFor::Keyword::dirty"; ], [ a doap-changeset:Addition; rdfs:label "Moops::TraitFor::Keyword::mutable"; ], [ a doap-changeset:Addition; rdfs:label "Moops::TraitFor::Keyword::ro"; ], [ a doap-changeset:Addition; rdfs:label "Moops::TraitFor::Keyword::rw"; ], [ a doap-changeset:Addition; rdfs:label "Moops::TraitFor::Keyword::rwp"; ], [ a doap-changeset:Change; rdfs:label "Moose classes will now `use Moose::XSAccessor` if possible."; ], [ a doap-changeset:Change; rdfs:label "Use MooseX::MungeHas to 0.002 smooth over more differences between Moo, Mouse and Moose."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.011"^^xsd:string. a doap:Version; dc:identifier "Moops-0.012"^^xsd:string; dc:issued "2013-08-20"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Rename Moops::DefineKeyword -> PerlX::Define."; ], [ a doap-changeset:Addition; rdfs:label "PerlX::Assert"; ], [ a doap-changeset:Documentation; rdfs:label "Various documentation improvements."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.012"^^xsd:string. a doap:Version; dc:identifier "Moops-0.013"^^xsd:string; dc:issued "2013-08-20"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix test that uses Role::Tiny and Class::Tiny without declaring them (Test::Requires)."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.013"^^xsd:string. a doap:Version; dc:identifier "Moops-0.014"^^xsd:string; dc:issued "2013-08-21"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "MooseX::FunctionParametersInfo"; ], [ a doap-changeset:Documentation; rdfs:label "Document Class::Tiny::Antlers."; ], [ a doap-changeset:Change; rdfs:label "Class::Tiny::Antlers now supports has \\@attrs like Moose."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.014"^^xsd:string. a doap:Version; dc:identifier "Moops-0.015"^^xsd:string; dc:issued "2013-08-21"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Load feature.pm so that it's consistently exported to the outer scope."; ], [ a doap-changeset:Bugfix; rdfs:label "Fix a reference to Moops::DefineKeyword which will only work if you happen to have installed Moops over the top of a pre-0.012 version of Moops."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.015"^^xsd:string. a doap:Version; dc:identifier "Moops-0.016"^^xsd:string; dc:issued "2013-08-21"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Provide a `types` option for loading type constraint libraries into classes, roles and namespaces."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.016"^^xsd:string. a doap:Version; dc:identifier "Moops-0.017"^^xsd:string; dc:issued "2013-08-21"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Support Class::Tiny 0.004."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.017"^^xsd:string. a doap:Version; dc:identifier "Moops-0.018"^^xsd:string; dc:issued "2013-08-27"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Add a `library` keyword for declaring type libraries."; ], [ a doap-changeset:Change; rdfs:label "Declared packages now get an implied BEGIN {...} block around themselves."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.018"^^xsd:string. a doap:Version; dc:identifier "Moops-0.019"^^xsd:string; dc:issued "2013-08-30"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Removal; rdfs:label "Removed Class::Tiny::Antlers; this is now a separate CPAN distribution."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.019"^^xsd:string. a doap:Version; dc:identifier "Moops-0.020"^^xsd:string; dc:issued "2013-09-11"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "List Moose/Mouse/Moo/Class::Tiny dependencies as optional_features in META.json."; ], [ a doap-changeset:Change; rdfs:label "Improve Moops' extensibility via parser traits."; ], [ a doap-changeset:BackCompat; rdfs:label "Moops->import now takes a hash of options (including the `imports` option) rather than an arrayref of modules to import."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.020"^^xsd:string. a doap:Version; dc:identifier "Moops-0.021"^^xsd:string; dc:issued "2013-09-12"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Allow version numbers to be specified for the `with`, `extends` and `types` options."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.021"^^xsd:string. a doap:Version; dc:identifier "Moops-0.022"^^xsd:string; dc:issued "2013-09-16"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Minor updates to work with Function::Parameters 1.0301."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.022"^^xsd:string. a doap:Version; dc:identifier "Moops-0.023"^^xsd:string; dc:issued "2013-09-26"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Bundle an example of using Moops with Method::Signatures."; ], [ a doap-changeset:Bugfix; rdfs:label "Much improved (though not completely perfect) line number accounting."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.023"^^xsd:string. a doap:Version; dc:identifier "Moops-0.024"^^xsd:string; dc:issued "2013-09-27"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Tests; rdfs:label "Keyword::Simple 0.02 has been released; no longer need to skip t/03lines.t."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.024"^^xsd:string. a doap:Version; dc:identifier "Moops-0.025"^^xsd:string; dc:issued "2013-10-09"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Use Exporter::Tiny."; ], [ a doap-changeset:Documentation; rdfs:label "Note that a future version of Moops may replace Function::Parameters with Kavorka."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.025"^^xsd:string. a doap:Version; dc:identifier "Moops-0.026"^^xsd:string; dc:issued "2013-11-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Replace Function::Parameters with Kavorka."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.026"^^xsd:string. a doap:Version; dc:identifier "Moops-0.027"^^xsd:string; dc:issued "2013-12-16"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Private attributes via Lexical::Accessor."; ], [ a doap-changeset:Change; rdfs:label "Moose/Mouse classes/roles now have override/augment method modifier keywords."; ], [ a doap-changeset:Documentation; rdfs:label "Include an example using multi methods to implement a class method and object method with the same name as each other."; ], [ a doap-changeset:Addition, doap-changeset:Documentation; rdfs:label "Moops::Manual::Objects101."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.027"^^xsd:string. a doap:Version; dc:identifier "Moops-0.028"^^xsd:string; dc:issued "2013-12-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Indicate conflict with MooseX::Types::Common 0.001011."; ], [ a doap-changeset:Packaging; rdfs:label "Indicate conflict with MooseX::Types::URI 0.05."; ], [ a doap-changeset:Documentation; rdfs:label "Demonstrate `is override` trait in Moops::Manual::Objects101."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.028"^^xsd:string. a doap:Version; dc:identifier "Moops-0.029"^^xsd:string; dc:issued "2014-01-04"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix availability of Lexical::Accessor within class {} blocks."; ], [ a doap-changeset:Documentation; rdfs:label "Copyright 2014."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.029"^^xsd:string. a doap:Version; dc:identifier "Moops-0.030"^^xsd:string; dc:issued "2014-01-30"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Require at least version 0.027 of Kavorka; this resolves a conflict using Moops with MooX::Options."; ], [ a doap-changeset:Change; rdfs:label "Hard-code a list of warnings categories to fatalize; this means that warnings categories added to future versions of Perl will not magically become fatal in Moops."; ], [ a doap-changeset:Addition, doap-changeset:Documentation; rdfs:label "Include an example using Moops to write a command-line app."; doap-changeset:blame ; rdfs:seeAlso ; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.030"^^xsd:string. a doap:Version; dc:identifier "Moops-0.031"^^xsd:string; dc:issued "2014-03-23"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "The new import parameter `-strict` enables loading strictures.pm within Moops scopes."; ], [ a doap-changeset:Change; rdfs:label "Avoid returning 0 from `assert` statements (PerlX::Assert)."; ], [ a doap-changeset:Documentation; rdfs:label "Use the `true` constant instead of the number 1 in the cli-app.pl example."; ], [ a doap-changeset:Change; rdfs:label "Use Parse::Keyword instead of Devel::Pragma in order to establish the currently compiling package name. Devel::Pragma has issues under ithreads."; doap-changeset:thanks ; ], [ a doap-changeset:Tests; rdfs:label "Test Moops in threaded Perls."; doap-changeset:blame ; ], [ a doap-changeset:Documentation; rdfs:label "Fix typo in manual."; doap-changeset:fixes ; doap-changeset:thanks ; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.031"^^xsd:string. a doap:Version; dc:identifier "Moops-0.032"^^xsd:string; dc:issued "2014-08-13"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "PerlX::Assert is no longer bundled with Moops; it has been split out into a separate distribution."; ], [ a doap-changeset:BackCompat; rdfs:label "Role composition is now delayed to the end of a class declaration."; doap-changeset:thanks ; ], [ a doap-changeset:Documentation; rdfs:label "Fix a typo in Moops::Manual::Objects101."; doap-changeset:fixes ; doap-changeset:thanks ; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.032"^^xsd:string. a doap:Version; dc:identifier "Moops-0.033"^^xsd:string; dc:issued "2014-08-16"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix bugs introduced in 0.032 with role application via guards."; ], [ a doap-changeset:Update; rdfs:label "Take advantage of improvements in Type::Library/Type::Registry 1.000000."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.033"^^xsd:string. a doap:Version; dc:identifier "Moops-0.034"^^xsd:string; dc:issued "2014-10-12"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Bundle a multimethod example (stolen from MooseX:MultiMethods)."; ], [ a doap-changeset:Documentation; rdfs:label "Improvements to the SUPPORT and SEE ALSO sections of the documentation."; ], [ a doap-changeset:Tests; rdfs:label "Test that `use true` is imported by Moops."; ], [ a doap-changeset:Packaging; rdfs:label "Remove outdated dependency on Sub::Name from packaging metadata."; ], [ a doap-changeset:Update; rdfs:label "namespace::autoclean now supports Moo enough that we can start using it instead of namespace::sweep."; ], [ a doap-changeset:Documentation; rdfs:label "Warn about some planned changes."; ], [ a doap-changeset:Bugfix; rdfs:label "Fix enormous memory leak leading to segfault caused when a role application in a scope guard threw an exception."; doap-changeset:fixes , ; doap-changeset:thanks , , ; rdfs:comment "Ben Goldberg supplied a nice implementation of scope guards using Variable::Magic."; rdfs:seeAlso ; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.034"^^xsd:string. a foaf:Person; foaf:name "Lukas Atkinson"; foaf:nick "AMON"; foaf:page . a foaf:Person; foaf:name "Ben Goldberg"; foaf:nick "GOLDBB"; foaf:page . a foaf:Person; foaf:mbox ; foaf:name "Maurice Mengel"; foaf:nick "MMAURICE"; foaf:page . a foaf:Person; foaf:name "Matt S Trout"; foaf:nick "MSTROUT"; foaf:page . a foaf:Person; foaf:name "Piers Cawley"; foaf:nick "PDCAWLEY"; foaf:page . a foaf:Person; foaf:name "Ron Savage"; foaf:nick "RSAVAGE"; foaf:page . a foaf:Person; foaf:name "Søren Døssing"; foaf:nick "SAUBER"; foaf:page . a foaf:Person; foaf:name "Aaron James Trevena"; foaf:nick "TEEJAY"; foaf:page . a foaf:Person; foaf:mbox ; foaf:name "Toby Inkster"; foaf:nick "TOBYINK"; foaf:page . a doap-bugs:Issue; doap-bugs:id "93553"^^xsd:string; doap-bugs:page . a doap-bugs:Issue; doap-bugs:id "99389"^^xsd:string; doap-bugs:page . a doap-bugs:Issue; doap-bugs:id "99409"^^xsd:string; doap-bugs:page . a doap-bugs:Issue; doap-bugs:id "99438"^^xsd:string; doap-bugs:page . bench.pl000664001750001750 552712416504253 14661 0ustar00taitai000000000000Moops-0.034/examples=pod =head1 PURPOSE The following test case benchmarks performance between L and the more established L by defining equilavent classes using each. The benchmarked code includes object construction and destruction, accessor calls, method calls and type constraint checks. Typical results (run on a fairly underpowered netbook) are: Rate MXD Moops MXD 9.26/s -- -98% Moops 487/s 5157% -- If L is available, Moops becomes yet faster: Rate MXD Moops MXD 9.26/s -- -99% Moops 637/s 6779% -- =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 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. =cut use strict; use warnings; use Benchmark ':all'; use Test::More; use Test::Fatal; use IO::Callback; # Declare class using Moops and Moose # { use Moops; class Foo::Moops using Moose { has n => (is => 'ro', writer => '_set_n', isa => Int, default => 0); method add (Int $x) { $self->_set_n( $self->n + $x ); } } } # Declare equivalent class using MooseX::Declare # { use MooseX::Declare; class Foo::MXD { has n => (is => 'ro', writer => '_set_n', isa => 'Int', default => 0); method add (Int $x) { $self->_set_n( $self->n + $x ); } } } # Test each class works as expected # for my $class ('Foo::Moops', 'Foo::MXD') { like( exception { $class->new(n => 1.1) }, qr{(Validation failed for 'Int')|(did not pass type constraint "Int")}, "Class '$class' throws error on incorrect constructor call", ); my $o = $class->new(n => 0); like( exception { $o->add(1.1) }, qr{(^Validation failed)|(did not pass type constraint "Int")}, "Objects of class '$class' throw error on incorrect method call", ); $o->add(40); $o->add(2); is($o->n, 42, "Objects of class '$class' function correctly"); } # Ensure benchmarks run with TAP-friendly output. # my $was = select( 'IO::Callback'->new('>', sub { my $data = shift; $data =~ s/^/# /g; print STDOUT $data; }) ); # Actually run benchmarks. cmpthese(-1, { Moops => q{ my $sum = 'Foo::Moops'->new(n => 0); $sum->add($_) for 0..100; }, MXD => q{ my $sum = 'Foo::MXD'->new(n => 0); $sum->add($_) for 0..100; }, }); select($was); done_testing; __END__ ok 1 - Class 'Foo::Moops' throws error on incorrect constructor call ok 2 - Objects of class 'Foo::Moops' throw error on incorrect method call ok 3 - Objects of class 'Foo::Moops' function correctly ok 4 - Class 'Foo::MXD' throws error on incorrect constructor call ok 5 - Objects of class 'Foo::MXD' throw error on incorrect method call ok 6 - Objects of class 'Foo::MXD' function correctly # Rate MXD Moops # MXD 9.26/s -- -99% # Moops 637/s 6779% -- 1..6 calculator.pl000664001750001750 30712416504253 15702 0ustar00taitai000000000000Moops-0.034/examplesuse Moops; class Calculator { define PI = 3.2; method circular_area (Num :$r) { return PI * $r**2; } } my $calc = Calculator->new; say "The circle's area is ", $calc->circular_area(r => 1.0); class-versus-object-method.pl000664001750001750 35612416504253 20731 0ustar00taitai000000000000Moops-0.034/examplesuse Moops; class Foo { multi method xxx (ClassName $class: Int $x) { say "CLASS METHOD - value $x"; } multi method xxx (Object $self: Int $x) { say "OBJECT METHOD - value $x"; } } Foo->xxx(1); my $foo = Foo->new; $foo->xxx(2); cli-app.pl000664001750001750 57412416504253 15104 0ustar00taitai000000000000Moops-0.034/examples#!/usr/bin/env perl use Moops; use Carp 'verbose'; class UsrBinCat { use MooX::Options; option filename => ( is => 'ro', format => 's', required => true, doc => 'the file to display' ); method BUILD { open my $fh, "<", $self->filename or die "cannot open ${\ $self->filename }: $!"; print while <$fh>; } } UsrBinCat->new_with_options; extending-moops.pl000664001750001750 276612416504253 16724 0ustar00taitai000000000000Moops-0.034/examples=pod =head1 PURPOSE An example of extending Moops to add an C keyword. MoopsX::TraitFor::Parser::ExceptionKeyword is a trait for L, adding support for parsing the C keyword, and injects the MoopsX::Keyword::Exception class when it is encountered. MoopsX::Keyword::Exception is a simple subclass of L and simply adds L 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 C, C and C 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). =head1 DEPENDENCIES Requires the L role which is available from CPAN. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 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. =cut use FindBin qw($Bin); use lib "$Bin/lib"; use Moops traits => [ 'MoopsX::TraitFor::Parser::ExceptionKeyword', ]; exception FileError { has filename => (is => 'ro', isa => Str); } namespace Demonstration { fun go () { try { FileError->throw(filename => 'not-exists.txt'); } catch { say "Caught exception: ", $_->filename; }; } } Demonstration::go(); multimethods.pl000664001750001750 152112416504253 16306 0ustar00taitai000000000000Moops-0.034/examplesuse Moops; class Scissors; class Paper; class Rock; class Lizard; class Spock; class Game { use Kavorka qw( multi method ); multi method play (Paper $x, Rock $y) { 1 } multi method play (Paper $x, Spock $y) { 1 } multi method play (Scissors $x, Paper $y) { 1 } multi method play (Scissors $x, Lizard $y) { 1 } multi method play (Rock $x, Scissors $y) { 1 } multi method play (Rock $x, Lizard $y) { 1 } multi method play (Lizard $x, Paper $y) { 1 } multi method play (Lizard $x, Spock $y) { 1 } multi method play (Spock $x, Rock $y) { 1 } multi method play (Spock $x, Scissors $y) { 1 } multi method play (Any $x, Any $y) { 0 } } my $game = Game->new; say $game->play(Paper->new, Rock->new); say $game->play(Spock->new, Paper->new); say $game->play(Spock->new, Scissors->new); using-moops-with-method-signatures.pl000664001750001750 63412416504253 22445 0ustar00taitai000000000000Moops-0.034/examplesuse Moops; role Moops::TraitFor::Keyword::MS { around generate_package_setup () { return map { /\Ause Function::Parameters/ ? 'use Method::Signatures;' : $_ } $self->${^NEXT}, q[use experimental "smartmatch";]; } } # Now this class uses Method::Signatures! class Foo :MS { method foo ( Int $score where [0..10] ) { say "Got: $score"; } } Foo->foo(3); # says 'Got: 3' Foo->foo(12); # dies using-moosextypes-in-moo.pl000664001750001750 37412416504253 20473 0ustar00taitai000000000000Moops-0.034/examplesuse Moops; library MyWrapper extends MooseX::Types::Common::Numeric; class Foo types MyWrapper using Moo { has favourite_number => ( is => 'rwp', isa => PositiveInt, ); } Foo->new(favourite_number => 42); Foo->new(favourite_number => -5); Moops.pm000664001750001750 5470512416504253 13652 0ustar00taitai000000000000Moops-0.034/libuse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Exporter::Tiny qw(mkopt); use Keyword::Simple qw(); use Parse::Keyword qw(); use Module::Runtime qw(use_package_optimistically); use feature qw(); use true qw(); # Disable 'experimental' warning categories because these lead to # inconsistencies between the different Perl versions supported by # Moops. # # Disable 'void', 'once', 'uninitialized' and 'numeric' because # they are annoying. # # New warnings categories provided by new releases of Perl will not # be added here (but they may be added to a @NONFATAL_WARNINGS array). # our @FATAL_WARNINGS = ( 'ambiguous', 'bareword', 'closed', 'closure', 'debugging', 'deprecated', 'digit', 'exec', 'exiting', # 'experimental', # 'experimental::lexical_subs', # 'experimental::lexical_topic', # 'experimental::regex_sets', # 'experimental::smartmatch', 'glob', 'illegalproto', 'imprecision', 'inplace', 'internal', 'io', 'layer', 'malloc', 'misc', 'newline', 'non_unicode', 'nonchar', # 'numeric', # 'once', 'overflow', 'pack', 'parenthesis', 'pipe', 'portable', 'precedence', 'printf', 'prototype', 'qw', 'recursion', 'redefine', 'regexp', 'reserved', 'semicolon', 'severe', 'signal', 'substr', 'surrogate', 'syntax', 'taint', 'threads', # 'uninitialized', 'unopened', 'unpack', 'untie', 'utf8', # 'void', ); # Don't tamper please! Internals::SvREADONLY(@FATAL_WARNINGS, 1); sub class_for_import_set { require Moops::ImportSet; 'Moops::ImportSet'; } sub class_for_parser { require Moops::Parser; 'Moops::Parser'; } sub unimport { my $class = shift; Keyword::Simple::undefine($_) for $class->class_for_parser->keywords; } sub import { my $class = shift; my %opts = ( ref($_[0]) eq 'ARRAY' ? (imports => $_[0]) : (!ref($_[0]) and $_[0] eq -strict) ? (imports => ['strictures']) : @_ ); my $imports = ref($opts{imports}) eq 'ARRAY' ? $class->class_for_import_set->new(imports => mkopt($opts{imports})) : undef; 'strict'->import(); 'warnings'->unimport(); 'warnings'->import(FATAL => @FATAL_WARNINGS); 'feature'->import(':5.14'); 'true'->import(); my $parser_class = $opts{traits} ? do { require Moo::Role; 'Moo::Role'->create_class_with_roles($class->class_for_parser, @{$opts{traits}}) } : $class->class_for_parser; for my $kw ($parser_class->keywords) { Keyword::Simple::define $kw => sub { my $ref = $_[0]; my $parser = $parser_class->new( keyword => $kw, ref => $ref, ccstash => Parse::Keyword::compiling_package(), ); $parser->parse; my %attrs; $attrs{imports} = $imports if defined $imports; my $kw = $parser->keyword_object(%attrs); if ($opts{function_parameters_everywhere} or $ENV{'MOOPS_FUNCTION_PARAMETERS_EVERYWHERE'}) { require Moo::Role; 'Moo::Role'->apply_roles_to_object($kw, 'Moops::TraitFor::Keyword::fp'); } $kw->check_prerequisites; my $code = $kw->generate_code; substr($$ref, 0, 0) = ($parser->is_empty ? "BEGIN { $code }" : "BEGIN { $code "); }; } } sub at_runtime { my $class = shift; my ($pkg) = @_; for my $task (@{ $Moops::AT_RUNTIME{$pkg} }) { my ($code, @args) = @$task; eval "package $pkg; \$code->(\@args)"; } } sub _true { !!1 }; sub _false { !!0 }; 1; __END__ =pod =encoding utf-8 =for stopwords featureful ro rw rwp superset =head1 NAME Moops - Moops Object-Oriented Programming Sugar =head1 SYNOPSIS use Moops; role NamedThing { has name => (is => "ro", isa => Str); } class Person with NamedThing; class Company with NamedThing; class Employee extends Person { has job_title => (is => "rwp", isa => Str); has employer => (is => "rwp", isa => InstanceOf["Company"]); method change_job ( Object $employer, Str $title ) { $self->_set_job_title($title); $self->_set_employer($employer); } method promote ( Str $title ) { $self->_set_job_title($title); } } =head1 STATUS Unstable. Until version 1.000, stuff might change, but not without good reason. =head2 Planned Changes =over =item * Support for using Function::Parameters to handle method signatures is likely to be dropped. =item * Parameterized class and parameterized role support is planned. =item * The internals for parsing C, C, C, and C may change to use L rather than L. This will likely break any extensions that rely on subclassing or adding traits to the L or L classes. =back =head1 DESCRIPTION Moops is sugar for declaring and using roles and classes in Perl. The syntax is inspired by L, and Stevan Little's p5-mop-redux project (which is in turn partly inspired by Perl 6). Moops has fewer than half of the dependencies as MooseX::Declare, loads in about 25% of the time, and the classes built with it run significantly faster. Moops does not use Devel::Declare, instead using Perl's pluggable keyword API; I<< this requires Perl 5.14 or above >>. Moops uses L to build classes and roles by default, but allows you to use L if you desire. (And L experimentally.) =head2 Classes The C keyword declares a class: class Foo { # ... } A version number can be provided: class Foo 1.2 { # ... } If no version is provided, your class' C<< $VERSION >> variable is set to the empty string; this helps the package be seen by L. If your class extends an existing class through inheritance, or consumes one or more roles, these can also be provided when declaring the class. class Foo::Bar 1.2 extends Foo 1.1 with Magic::Monkeys { # ... } If you use Moops within a package other than C
, then package names used within the declaration are "qualified" by that outer package, unless they contain "::". So for example: package Quux; use Moops; class Foo { } # declares Quux::Foo class Xyzzy::Foo # declares Xyzzy::Foo extends Foo { } # ... extending Quux::Foo class ::Baz { } # declares Baz If you wish to use Moose or Mouse instead of Moo; include that in the declaration: class Foo using Moose { # ... } It's also possible to create classes C<< using Tiny >> (L), but there's probably little point in it, because Moops uses Moo internally, so the more capable Moo is already loaded and in memory. (The C option is exempt from the package qualification rules mentioned earlier.) Moops uses L in your classes so that the C keyword supports some Moo-specific features, even when you're using Moose or Mouse. Specifically, it supports C<< is => 'rwp' >>, C<< is => 'lazy' >>, C<< builder => 1 >>, C<< clearer => 1 >>, C<< predicate => 1 >>, and C<< trigger => 1 >>. If you're using Moo, the L extension is enabled too, which allows Moose-isms in Moo too. With the combination of these features, there should be very little difference between Moo, Mouse and Moose C keywords. Moops uses L to provide you with private (lexical) attributes - that is, attributes accessed via a coderef method in a lexical variable. class Foo { lexical_has foo => ( isa => Int, accessor => \(my $_foo), default => 0, ); method increment_foo () { $self->$_foo( 1 + $self->$_foo ); } method get_foo () { return $self->$_foo; } } my $x = Foo->new; $x->increment_foo(); # ok say $x->get_foo(); # says "1" $x->$_foo(42); # dies; $_foo does not exist in this scope Moose classes are automatically accelerated using L if it's installed. Note that it is possible to declare a class with an empty body; use a trailing semicolon. class Employee extends Person with Employment; If using Moose or Mouse, classes are automatically made immutable. L is automatically used in all classes. Between the class declaration and its body, L-style attributes may be provided: class Person :mutable { # ... } class Employee extends Person with Employment :mutable; The following attributes are defined for classes: =over =item * C<< :assertions >> - enables assertion checking (see below) =item * C<< :dirty >> - suppresses namespace::autoclean =item * C<< :fp >> - use L instead of L =item * C<< :mutable >> - suppresses making Moose classes immutable =item * C<< :ro >> - make attributes declared with C default to 'ro' =item * C<< :rw >> - make attributes declared with C default to 'rw' =item * C<< :rwp >> - make attributes declared with C default to 'rwp' =back =head2 Roles Roles can be declared similarly to classes, but using the C keyword. role Stringable using Moose # we know you meant Moose::Role { # ... } Roles do not support the C option. Roles can be declared to be C<< using >> Moo, Moose, Mouse or Tiny. (Note that if you're mixing and matching role frameworks, there are limitations to which class builders can consume which roles. Mouse is generally the least compatible; Moo and Moose classes should be able to consume each others' roles; Moo can also consume Role::Tiny roles.) If roles use Moo, the L extension is enabled. L is automatically used in all roles. Roles take similar L-style attributes to classes, but don't support C<< :mutable >>. =head3 A note on consuming roles In a standard: class MyClass with MyRole { ...; } You should note that role composition is delayed to happen at the I of the class declaration. This is usually what you want. However the interaction between method modifiers and roles is complex, and I you'll want the role to be applied to the class part-way through the declaration. In this case you can use a C statement I the class declaration: class MyClass { ...; with "MyRole"; ...; } =head2 Namespaces The C keyword works as above, but declares a package without any class-specific or role-specific semantics. namespace Utils { # ... } L is not automatically used in namespaces. L-style attributes are supported for namespaces, but most of the built-in attributes make any sense without class/role semantics. (C<< :assertions >> does.) Traits written as Moops extensions may support namespaces. =head2 Functions and Methods Moops uses L to declare functions and methods within classes and roles. Kavorka provides the C and C keywords. class Person { use Scalar::Util 'refaddr'; has name => (is => 'rwp'); # Moo attribute method change_name ( Str $newname ) { $self->_set_name( $newname ) unless $newname eq 'Princess Consuela Banana-Hammock'; } fun is_same_as ( Object $x, Object $y ) { refaddr($x) == refaddr($y) } } my $phoebe = Person->new(name => 'Phoebe'); my $ursula = Person->new(name => 'Ursula'); Person::is_same_as($phoebe, $ursula); # false Note function signatures use type constraints from L; L and L type constraints should also work, I<< provided you use their full names, including their package >>. The C function above could have been written as a class method like this: class Person { # ... method is_same_as ( $class: Object $x, Object $y ) { refaddr($x) == refaddr($y) } } # ... Person->is_same_as($phoebe, $ursula); # false The C keyword is not provided within packages declared using C; only within classes and roles. See also L and L. Within Moose classes and roles, the L module is loaded, to allow access to method signatures via the meta object protocol. (This is currently broken for C method modifiers.) In Moops prior to 0.025, L was used instead of Kavorka. If you wish to continue to use Function::Parameters in a class you can use the C<< :fp >> attribute: class Person :fp { ...; } Or to do so for all classes in a lexical scope: use Moops function_parameters_everywhere => 1; class Person { ...; } Or the environment variable C can be set to true to enable it globally, but this feature is likely to be removed eventually. =head2 Method Modifiers Within classes and roles, C, C and C keywords are provided for declaring method modifiers. These use the same syntax as C. If your class or role is using Moose or Mouse, then you also get C and C keywords. See also L. =head2 Multi Methods L uses L to implement multi subs and multi methods. See also L. =head2 Type Constraints The L type constraints are exported to each package declared using Moops. This allows the standard type constraints to be used as barewords. Type constraints can be used in attribute definitions (C) and method signatures. Because Types::Standard is based on L, the same type constraints may be used whether you build your classes and roles with Moo, Moose our Mouse. Alternative libraries can be imported using the C option; a la: class Document types Types::XSD::Lite { has title => (is => 'rw', isa => NormalizedString); } Note that if an alternative type constraint library is imported, then L is I automatically loaded, and needs to be listed explicitly: class Document types Types::Standard, Types::XSD::Lite { # ... } Type libraries built with L, L and L should all work. Bear in mind that type constraints from, say, a L library won't be usable in, say, Moo attribute definitions. However, it's possible to wrap them with Type::Tiny, and make them usable: class Foo types MooseX::Types::Common::Numeric using Moo { use Types::TypeTiny qw( to_TypeTiny ); has favourite_number => ( is => 'rwp', isa => to_TypeTiny(PositiveInt) ); } =head2 Type Libraries You can use the C keyword to declare a new type library: library MyTypes extends Types::Standard declares EmptyString, NonEmptyString { declare EmptyString, as Str, where { length($_) == 0 }; declare NonEmptyString, as Str, where { length($_) > 0 }; } class StringChecker types MyTypes { method check ( Str $foo ) { return "empty" if EmptyString->check($foo); return "non-empty" if NonEmptyString->check($foo); return "impossible?!"; } } Libraries declared this way can extend existing type libraries written with L, L or L. Note that this also provides a solution to the previously mentioned problem of using L type libraries in L classes: library MyWrapper extends MooseX::Types::Common::Numeric; class Foo types MyWrapper using Moo { has favourite_number => ( is => 'rwp', isa => PositiveInt, ); } =head2 Constants The useful constants C and C are imported into all declared packages. (Within classes and roles, namespace::autoclean will later remove them from the symbol table, so they don't form part of your package's API.) These constants can help make attribute declarations more readable. has name => (is => 'ro', isa => Str, required => true); Further constants can be declared using the C keyword (see L): namespace Maths { define PI = 3.2; } Constants declared this way will I be swept away by namespace::autoclean, and are considered part of your package's API. =head2 Assertions Declared packages can contain assertions (see L). These are normally optimized away at compile time, but you can force them to be checked using the C<< :assertions >> attribute. class Foo { assert(false); # not checked; optimized away } class Bar :assertions { assert(false); # checked; fails; throws exception } =head2 More Sugar L and FATAL L are imported into all declared packages. However the C, C, C and C warning categories are explicitly excluded, as are any warnings categories added to Perl after version 5.14. Perl 5.14 features, including the C and C keywords, and sane Unicode string handling are imported into all declared packages. L is imported into all declared packages. L's C and L's C are imported into all declared packages. =head2 Outer Sugar The "outer" package, where the C<< use Moops >> statement appears also gets a little sugar: strict, the same warnings as "inner" packages, and Perl 5.14 features are all switched on. L is loaded, so you don't need to do this at the end of your file: 1; =head2 Custom Sugar It is possible to inject other functions into all inner packages using: use Moops imports => [ 'List::Util' => [qw( first reduce )], 'List::MoreUtils' => [qw( any all none )], ]; This is by far the easiest way to extend Moops with project-specific extras. There is a shortcut for injecting L into all inner packages: use Moops -strict; =head1 EXTENDING Moops is written to hopefully be fairly extensible. =head2 Extending Moops via imports The easiest way to extend Moops is to inject additional imports into the inner packages using the technique outlined in L above. You can wrap all that up in a module: package MoopsX::Lists; use base 'Moops'; use List::Util (); use List::MoreUtils (); sub import { my ($class, %opts) = @_; push @{ $opts{imports} ||= [] }, ( 'List::Util' => [qw( first reduce )], 'List::MoreUtils' => [qw( any all none )], ); $class->SUPER::import(%opts); } 1; Now people can do C<< use MoopsX::Lists >> instead of C<< use Moops >>. =head2 Extending Moops via keyword traits Roles in the C namespace are automatically loaded and applied to keyword objects when a corresponding Attribute::Handlers-style attribute is seen. For examples extending Moops this way, see the L, L, L, L and L traits. =head2 Extending Moops via parser traits For more complex needs, you can create a trait which will be applied to Moops::Parser. Parser traits might want to override: =over =item * The C class method, which returns the list of keywords the parser can handle. =item * The C object method, which returns the name of a subclass of Moops::Keyword which will be used for translating the result of parsing the keyword into a string using Perl's built-in syntax. =back Hopefully you'll be able to avoid overriding the C method itself, as it has a slightly messy API. Your C subclass can either be a direct subclass of Moops::Keyword, or of Moops::Keyword::Class or Moops::Keyword::Role. The keyword subclass might want to override: =over =item * The C class method, which returns a list of valid inter-package relationships such as C and C for the current keyword. =item * The C class method, which, when given the name of an inter-package relationship, indicates whether it should be subjected to package qualification rules (like C and C are, but C is not). =item * The C class method, which, when given the name of an inter-package relationship, indicates whether it should accept a version number. =item * The C object method which returns a list of strings to inject into the package. =item * The C object method which is used by the default C method to set up the arguments to be passed to L. =item * The C method which performs certain pre-flight checks and may throw an exception. =back Hopefully you'll be able to avoid overriding the C method. You can apply your trait using: use Moops traits => [ 'Moops::TraitFor::Parser::FooKeyword', 'Moops::TraitFor::Parser::BarKeyword', ]; =head1 BUGS Please report any other bugs to L. =head1 SUPPORT B<< IRC: >> support is available through in the I<< #moops >> channel on L. For general Moose/Moo queries which don't seem to be related to Moops' syntactic sugar, your question may be answered more quickly in the I<< #moose >> channel. B<< Web: >> if you ask a question on PerlMonks in L with "Moops" in the subject line, it should be answered pretty quickly. There is a L on StackOverflow. =head1 SEE ALSO Similar: L, L. Main functionality exposed by this module: L/L, L, L, L, L, L, L. Internals fueled by: L, L, L, L. L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =head1 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. 01basic.t000664001750001750 106612416504253 13273 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Test that Moops compiles. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use_ok('Moops'); my $fp = $ENV{MOOPS_FUNCTION_PARAMETERS_EVERYWHERE}; $fp = '' unless defined $fp; diag "MOOPS_FUNCTION_PARAMETERS_EVERYWHERE = '$fp'"; done_testing; 02outer.t000664001750001750 105612416504253 13350 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Test that Moops imports Perl 5.14 features into the outer scope. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Moops; my $x; sub xyz { state $foo = $x; return $foo; } $x = 42; xyz(); $x = 99; is(xyz(), 42); done_testing; 03lines.t000664001750001750 152712416504253 13330 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Test that Moops does not make line numbers insane! =head1 DEPENDENCIES Keyword::Simple 0.02, otherwise this test is skipped. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut #line 27 use strict; use warnings; use Test::More; use Test::Requires { 'Keyword::Simple' => '0.02' }; use Moops; #line 35 class Bar; BEGIN { ::is(__LINE__, 36) } #line 39 class Foo { namespace TraitFor { role Baz { ::is(__LINE__, 41) } } } #line 46 class Quux extends Foo { namespace TraitFor { role Quuux with Foo::TraitFor::Baz { ::is(__LINE__, 59) } } } done_testing; 04composition.t000664001750001750 116612416504253 14561 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Simple test composing a role into a class. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 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. =cut use Test::More; use Moops; role Local::Role1 { requires "method1"; method method2 { 666; } } class Local::Class1 with Local::Role1 { method method1 { 42; } } is( Local::Class1->new->method1, 42 ); is( Local::Class1->new->method2, 666 ); done_testing; 05true.t000664001750001750 177512416504253 13204 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that Moops-based modules automatically return a true value. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 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. =cut use strict; use warnings; use lib qw( t ../t ); use Test::More; use Test::Fatal; subtest "module ending in an explicit false statement returns true" => sub { my $retval; my $exception = exception { $retval = do { require ReturnsTrue } }; is($exception, undef, 'no exception'); ok($retval, 'require returned true'); new_ok('ReturnsTrue'); }; subtest "module ending in no explicit statement returns true" => sub { my $retval; my $exception = exception { $retval = do { require ReturnsTrueAgain } }; is($exception, undef, 'no exception'); ok($retval, 'require returned true'); new_ok('ReturnsTrueAgain'); }; done_testing; 11class-moose.t000664001750001750 300412416504253 14432 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works with L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Test::Requires { 'Moose' => '2.0600' }; use Moops; class Foo using Moose { has aaa => (is => 'ro'); class Bar { has bbb => (is => 'ro'); } class Baz #comment! extends Bar #comment! using Moose { has ccc => (is => 'ro'); } class ::Quux { has ddd => (is => 'ro'); } class Quux::Quux using Moose { has eee => (is => 'ro'); } class ::Quux::Quux::Quux { has fff => (is => 'ro'); } } ok( 'Foo'->can('aaa'), "Foo->can('aaa')"); ok(!'Foo'->can('bbb'), "not Foo->can('bbb')"); ok(!'Foo'->can('ccc'), "not Foo->can('ccc')"); ok(!'Foo::Bar'->can('aaa'), "not Foo::Bar->can('aaa')"); ok( 'Foo::Bar'->can('bbb'), "Foo::Bar->can('bbb')"); ok(!'Foo::Bar'->can('ccc'), "not Foo::Bar->can('ccc')"); ok(!'Foo::Baz'->can('aaa'), "not Foo::Baz->can('aaa')"); ok( 'Foo::Baz'->can('bbb'), "Foo::Baz->can('bbb')"); ok( 'Foo::Baz'->can('ccc'), "Foo::Baz->can('ccc')"); ok('Quux'->can('ddd'), "Quux->can('ddd')"); ok('Quux::Quux'->can('eee'), "Quux::Quux->can('eee')"); ok('Quux::Quux::Quux'->can('fff'), "Quux::Quux::Quux->can('fff')"); isa_ok('Foo'->new, 'Moose::Object'); done_testing; 11class-mouse.t000664001750001750 300212416504253 14436 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works with L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Test::Requires { 'Mouse' => '1.00' }; use Moops; class Foo using Mouse { has aaa => (is => 'ro'); class Bar { has bbb => (is => 'ro'); } class Baz #comment! extends Bar #comment! using Mouse { has ccc => (is => 'ro'); } class ::Quux { has ddd => (is => 'ro'); } class Quux::Quux using Mouse { has eee => (is => 'ro'); } class ::Quux::Quux::Quux { has fff => (is => 'ro'); } } ok( 'Foo'->can('aaa'), "Foo->can('aaa')"); ok(!'Foo'->can('bbb'), "not Foo->can('bbb')"); ok(!'Foo'->can('ccc'), "not Foo->can('ccc')"); ok(!'Foo::Bar'->can('aaa'), "not Foo::Bar->can('aaa')"); ok( 'Foo::Bar'->can('bbb'), "Foo::Bar->can('bbb')"); ok(!'Foo::Bar'->can('ccc'), "not Foo::Bar->can('ccc')"); ok(!'Foo::Baz'->can('aaa'), "not Foo::Baz->can('aaa')"); ok( 'Foo::Baz'->can('bbb'), "Foo::Baz->can('bbb')"); ok( 'Foo::Baz'->can('ccc'), "Foo::Baz->can('ccc')"); ok('Quux'->can('ddd'), "Quux->can('ddd')"); ok('Quux::Quux'->can('eee'), "Quux::Quux->can('eee')"); ok('Quux::Quux::Quux'->can('fff'), "Quux::Quux::Quux->can('fff')"); isa_ok('Foo'->new, 'Mouse::Object'); done_testing; 11class-tiny.t000664001750001750 302712416504253 14300 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works with L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Test::Requires { 'Class::Tiny::Antlers' => '0' }; use Moops; class Foo using Tiny { has aaa => (is => 'ro'); class Bar { has bbb => (is => 'ro'); } class Baz #comment! extends Bar #comment! using Tiny { has ccc => (is => 'ro'); } class ::Quux { has ddd => (is => 'ro'); } class Quux::Quux using Tiny { has eee => (is => 'ro'); } class ::Quux::Quux::Quux { has fff => (is => 'ro'); } } ok( 'Foo'->can('aaa'), "Foo->can('aaa')"); ok(!'Foo'->can('bbb'), "not Foo->can('bbb')"); ok(!'Foo'->can('ccc'), "not Foo->can('ccc')"); ok(!'Foo::Bar'->can('aaa'), "not Foo::Bar->can('aaa')"); ok( 'Foo::Bar'->can('bbb'), "Foo::Bar->can('bbb')"); ok(!'Foo::Bar'->can('ccc'), "not Foo::Bar->can('ccc')"); ok(!'Foo::Baz'->can('aaa'), "not Foo::Baz->can('aaa')"); ok( 'Foo::Baz'->can('bbb'), "Foo::Baz->can('bbb')"); ok( 'Foo::Baz'->can('ccc'), "Foo::Baz->can('ccc')"); ok('Quux'->can('ddd'), "Quux->can('ddd')"); ok('Quux::Quux'->can('eee'), "Quux::Quux->can('eee')"); ok('Quux::Quux::Quux'->can('fff'), "Quux::Quux::Quux->can('fff')"); isa_ok('Foo'->new, 'Class::Tiny::Object'); done_testing; 11class.t000664001750001750 256512416504253 13325 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Moops; class Foo { has aaa => (is => 'ro'); class Bar { has bbb => (is => 'ro'); } class Baz #comment! extends Bar { has ccc => (is => 'ro'); } class ::Quux { has ddd => (is => 'ro'); } class Quux::Quux { has eee => (is => 'ro'); } class ::Quux::Quux::Quux { has fff => (is => 'ro'); } } ok( 'Foo'->can('aaa'), "Foo->can('aaa')"); ok(!'Foo'->can('bbb'), "not Foo->can('bbb')"); ok(!'Foo'->can('ccc'), "not Foo->can('ccc')"); ok(!'Foo::Bar'->can('aaa'), "not Foo::Bar->can('aaa')"); ok( 'Foo::Bar'->can('bbb'), "Foo::Bar->can('bbb')"); ok(!'Foo::Bar'->can('ccc'), "not Foo::Bar->can('ccc')"); ok(!'Foo::Baz'->can('aaa'), "not Foo::Baz->can('aaa')"); ok( 'Foo::Baz'->can('bbb'), "Foo::Baz->can('bbb')"); ok( 'Foo::Baz'->can('ccc'), "Foo::Baz->can('ccc')"); ok('Quux'->can('ddd'), "Quux->can('ddd')"); ok('Quux::Quux'->can('eee'), "Quux::Quux->can('eee')"); ok('Quux::Quux::Quux'->can('fff'), "Quux::Quux::Quux->can('fff')"); done_testing; 12role-moose.t000664001750001750 220212416504253 14266 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works with L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Test::Requires { 'Moose' => '2.0600' }; use Moops; role Foo using Moose { method xyzzy () { 42 } } role Bar with Foo; role Baz; class Quux with Bar, Baz using Moose; class Quuux with Bar with Baz; ok( 'Quux'->does('Foo'), "Quux->does('Foo')" ); ok( 'Quux'->does('Bar'), "Quux->does('Bar')" ); ok( 'Quux'->does('Baz'), "Quux->does('Baz')" ); ok( 'Quux'->can('xyzzy'), "Quux->can('xyzzy')" ); is( 'Quux'->xyzzy, 42, "Quux->xyzzy == 42" ); ok( 'Quuux'->does('Foo'), "Quuux->does('Foo')" ); ok( 'Quuux'->does('Bar'), "Quuux->does('Bar')" ); ok( 'Quuux'->does('Baz'), "Quuux->does('Baz')" ); ok( 'Quuux'->can('xyzzy'), "Quuux->can('xyzzy')" ); is( 'Quuux'->xyzzy, 42, "Quuux->xyzzy == 42" ); done_testing; 12role-mouse.t000664001750001750 224412416504253 14302 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works with L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Test::Requires { 'Mouse' => '1.00' }; use Moops; role Foo using Mouse { method xyzzy () { 42 } } role Bar with Foo using Mouse; role Baz using Mouse; class Quux with Bar, Baz using Mouse; class Quuux with Bar with Baz using Mouse; ok( 'Quux'->does('Foo'), "Quux->does('Foo')" ); ok( 'Quux'->does('Bar'), "Quux->does('Bar')" ); ok( 'Quux'->does('Baz'), "Quux->does('Baz')" ); ok( 'Quux'->can('xyzzy'), "Quux->can('xyzzy')" ); is( 'Quux'->xyzzy, 42, "Quux->xyzzy == 42" ); ok( 'Quuux'->does('Foo'), "Quuux->does('Foo')" ); ok( 'Quuux'->does('Bar'), "Quuux->does('Bar')" ); ok( 'Quuux'->does('Baz'), "Quuux->does('Baz')" ); ok( 'Quuux'->can('xyzzy'), "Quuux->can('xyzzy')" ); is( 'Quuux'->xyzzy, 42, "Quuux->xyzzy == 42" ); done_testing; 12role-tiny.t000664001750001750 221712416504253 14135 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works with L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Requires { 'Class::Tiny::Antlers' => '0' }; use Test::Fatal; use Moops; role Foo using Tiny { method xyzzy () { 42 } } role Bar with Foo; role Baz; class Quux with Bar, Baz using Tiny; class Quuux with Bar with Baz; ok( 'Quux'->does('Foo'), "Quux->does('Foo')" ); ok( 'Quux'->does('Bar'), "Quux->does('Bar')" ); ok( 'Quux'->does('Baz'), "Quux->does('Baz')" ); ok( 'Quux'->can('xyzzy'), "Quux->can('xyzzy')" ); is( 'Quux'->xyzzy, 42, "Quux->xyzzy == 42" ); ok( 'Quuux'->does('Foo'), "Quuux->does('Foo')" ); ok( 'Quuux'->does('Bar'), "Quuux->does('Bar')" ); ok( 'Quuux'->does('Baz'), "Quuux->does('Baz')" ); ok( 'Quuux'->can('xyzzy'), "Quuux->can('xyzzy')" ); is( 'Quuux'->xyzzy, 42, "Quuux->xyzzy == 42" ); done_testing; 12role.t000664001750001750 206012416504253 13150 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Moops; role Foo { method xyzzy () { 42 } } role Bar with Foo; role Baz; class Quux with Bar, Baz; class Quuux with Bar with Baz; ok( 'Quux'->does('Foo'), "Quux->does('Foo')" ); ok( 'Quux'->does('Bar'), "Quux->does('Bar')" ); ok( 'Quux'->does('Baz'), "Quux->does('Baz')" ); ok( 'Quux'->can('xyzzy'), "Quux->can('xyzzy')" ); is( 'Quux'->xyzzy, 42, "Quux->xyzzy == 42" ); ok( 'Quuux'->does('Foo'), "Quuux->does('Foo')" ); ok( 'Quuux'->does('Bar'), "Quuux->does('Bar')" ); ok( 'Quuux'->does('Baz'), "Quuux->does('Baz')" ); ok( 'Quuux'->can('xyzzy'), "Quuux->can('xyzzy')" ); is( 'Quuux'->xyzzy, 42, "Quuux->xyzzy == 42" ); done_testing; 13namespace.t000664001750001750 122312416504253 14144 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Moops; namespace Foo { namespace Bar { namespace Baz { fun quux () { return 42; } } } } ok !eval q{ use Moops; namespace Blammo using Moose { }; 1 }; like($@, qr{^Expected}); is(Foo::Bar::Baz::quux(), 42); done_testing; 14versions.t000664001750001750 136112416504253 14064 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that package versions can be specified. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use lib qw( t ../t ); use Test::More; use Test::Fatal; use Moops; class Foo 1.2; class Bar 1.1 extends Foo 1.1; role Baz 0.9; is(Foo->VERSION, 1.2); is(Bar->VERSION, 1.1); is(Baz->VERSION, 0.9); # To catch this error, we need to load it from an external file! like( exception { require QuuxDie }, qr{\ABaz version 1.0 required}, ); done_testing; 21fun.t000664001750001750 150412416504253 13001 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Moops; class Foo { fun foo (Int $a) { return $a * 2 } } role Bar { fun bar (Int $a) { return $a * 2 } } namespace Baz { fun baz (Int $a) { return $a * 2 } } is(Foo::foo(21), 42); is(Bar::bar(21), 42); is(Baz::baz(21), 42); like($_, qr{Undef did not pass type constraint "Int"}) for ( exception { Foo::foo(undef) }, exception { Bar::bar(undef) }, exception { Baz::baz(undef) }, ); done_testing; 22method-moose.t000664001750001750 211012416504253 14604 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works with L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Requires { 'Moose' => '2.0600' }; use Test::Fatal; use Moops; class Foo using Moose { method foo (Int $a) { return $a * 2 } } role Bar using Moose { method bar (Int $a) { return $a * 2 } } is(Foo->foo(21), 42); is(Bar->bar(21), 42); like($_, qr{Undef did not pass type constraint "Int"}) for ( exception { Foo->foo(undef) }, exception { Bar->bar(undef) }, ); my $method = Class::MOP::class_of('Foo')->get_method('foo'); my ($parm) = $method->can('positional_parameters') ? $method->positional_parameters : $method->signature->positional_params; is($parm->name, '$a'); isa_ok($parm->type, 'Type::Tiny'); is($parm->type->name, 'Int'); done_testing; 22method.t000664001750001750 152312416504253 13473 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C keyword works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Moops; class Foo { method foo (Int $a) { return $a * 2 } } role Bar { method bar (Int $a) { return $a * 2 } } is(Foo->foo(21), 42); is(Bar->bar(21), 42); like($_, qr{Undef did not pass type constraint "Int"}) for ( exception { Foo->foo(undef) }, exception { Bar->bar(undef) }, ); ok not eval q[ use Moops; namespace Baz { method baz (Int $a) { return $a * 2 } }; 1 ]; ok not 'Baz'->can('baz'); done_testing; 23modifiers-moose.t000664001750001750 424612416504253 15322 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C, C and C keywords work with L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; BEGIN { plan skip_all => "test does not support Function::Parameters" if $ENV{MOOPS_FUNCTION_PARAMETERS_EVERYWHERE}; }; use Test::Requires { 'Moose' => '2.0600' }; use Moops; class Parent using Moose { method process ( ScalarRef[Int] $n ) { $$n *= 3; } method xxx () { return 42; } } role Sibling using Moose { after process ( ScalarRef[Int] $n ) { $$n += 2; } override xxx () { return 666; } } class Child extends Parent using Moose { with 'Sibling'; before process ( ScalarRef[Int] $n ) { $$n += 5; } } my $thing_one = Child->new; my $n = 1; $thing_one->process(\$n); is($n, 20); class Grandchild extends Child using Moose { around process ( ScalarRef[Num] $x ) { my ($int, $rest) = split /\./, $$x; $rest ||= 0; $self->${^NEXT}(\$int); $$x = "$int\.$rest"; } } my $thing_two = Grandchild->new; my $m = '1.2345'; $thing_two->process(\$m); is($m, '20.2345'); { my $method = Class::MOP::class_of('Child')->get_method('process'); my ($parm) = $method->can('positional_parameters') ? $method->positional_parameters : $method->signature->positional_params; is($parm->name, '$n'); isa_ok($parm->type, 'Type::Tiny'); is($parm->type->display_name, 'ScalarRef[Int]'); } { local $TODO = '`around` method modifier currently breaks metadata'; my $method = Class::MOP::class_of('Grandchild')->get_method('process'); my ($parm) = $method->can('positional_parameters') ? $method->positional_parameters : $method->signature->positional_params; is($parm && $parm->name, '$n'); isa_ok($parm && $parm->type, 'Type::Tiny'); is($parm && $parm->type->display_name, 'ScalarRef[Int]'); } subtest "override works in Moose classes" => sub { is(Parent->xxx, 42); is(Child->xxx, 666); done_testing; }; done_testing; 23modifiers.t000664001750001750 205512416504253 14176 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that the C, C and C keywords work. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Moops; class Parent { method process ( ScalarRef[Int] $n ) { $$n *= 3; } } role Sibling { after process ( ScalarRef[Int] $n ) { $$n += 2; } } class Child extends Parent { with 'Sibling'; before process ( ScalarRef[Int] $n ) { $$n += 5; } } my $thing_one = Child->new; my $n = 1; $thing_one->process(\$n); is($n, 20); class Grandchild extends Child { around process ( ScalarRef[Num] $n ) { my ($int, $rest) = split /\./, $$n; $rest ||= 0; $self->${^NEXT}(\$int); $$n = "$int\.$rest"; } } my $thing_two = Grandchild->new; my $m = '1.2345'; $thing_two->process(\$m); is($m, '20.2345'); done_testing; 31types-moose.t000664001750001750 214212416504253 14475 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that type constraints work with L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Requires { 'Moose' => '2.0600' }; use Test::Fatal; use Moops; class Foo using Moose { has num => (is => 'rw', isa => Num); method add ( Num $addition ) { $self->num( $self->num + $addition ); } } my $foo = 'Foo'->new(num => 20); isa_ok($foo, 'Moose::Object'); is($foo->num, 20); is($foo->num(40), 40); is($foo->num, 40); is($foo->add(2), 42); is($foo->num, 42); like( exception { $foo->num("Hello") }, qr{Value "Hello" did not pass type constraint "Num"}, ); like( exception { $foo->add("Hello") }, qr{Value "Hello" did not pass type constraint "Num"}, ); like( exception { 'Foo'->new(num => "Hello") }, qr{Value "Hello" did not pass type constraint "Num"}, ); done_testing; 31types-moosextypes-imported.t000664001750001750 235312416504253 17577 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that type constraints work with L and L, using imported type constraint constants. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Requires { 'Moose' => '2.0600' }; use Test::Requires { 'MooseX::Types::Common::Numeric' => '0.001008' }; use Test::Fatal; use Moops; class Foo using Moose { use MooseX::Types::Common::Numeric 'PositiveInt'; has num => (is => 'rw', isa => PositiveInt); method add ( (PositiveInt) $addition ) { $self->num( $self->num + $addition ); } } my $foo = 'Foo'->new(num => 20); isa_ok($foo, 'Moose::Object'); is($foo->num, 20); is($foo->num(40), 40); is($foo->num, 40); is($foo->add(2), 42); is($foo->num, 42); like( exception { $foo->num("Hello") }, qr{Must be a positive integer}, ); like( exception { $foo->add("Hello") }, qr{Must be a positive integer}, ); like( exception { 'Foo'->new(num => "Hello") }, qr{Must be a positive integer}, ); done_testing; 31types-moosextypes-moo.t000664001750001750 262612416504253 16551 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that type constraints work I<< with L >> and L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Requires { 'Moose' => '2.0600' }; use Test::Requires { 'MooseX::Types::Common::Numeric' => '0.001008' }; use Test::Fatal; BEGIN { 'MooseX::Types::Common::Numeric'->VERSION eq '0.001011' and plan skip_all => 'MooseX::Types::Common::Numeric 0.001011 is broken'; }; use Moops; class Foo using Moo { use Types::TypeTiny 'to_TypeTiny'; has num => (is => 'rw', isa => to_TypeTiny(MooseX::Types::Common::Numeric::PositiveInt)); method add ( MooseX::Types::Common::Numeric::PositiveInt $addition ) { $self->num( $self->num + $addition ); } } my $foo = 'Foo'->new(num => 20); ok(not $foo->isa('Moose::Object')); is($foo->num, 20); is($foo->num(40), 40); is($foo->num, 40); is($foo->add(2), 42); is($foo->num, 42); like( exception { $foo->num("Hello") }, qr{Must be a positive integer}, ); like( exception { $foo->add("Hello") }, qr{Must be a positive integer}, ); like( exception { 'Foo'->new(num => "Hello") }, qr{Must be a positive integer}, ); done_testing; 31types-moosextypes.t000664001750001750 261212416504253 15754 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that type constraints work with L and L, using fully-qualified type constraint names. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Requires { 'Moose' => '2.0600' }; use Test::Requires { 'MooseX::Types::Common::Numeric' => '0.001008' }; use Test::Fatal; BEGIN { 'MooseX::Types::Common::Numeric'->VERSION eq '0.001011' and plan skip_all => 'MooseX::Types::Common::Numeric 0.001011 is broken'; }; use Moops; class Foo using Moose { has num => (is => 'rw', isa => MooseX::Types::Common::Numeric::PositiveInt); method add ( MooseX::Types::Common::Numeric::PositiveInt $addition ) { $self->num( $self->num + $addition ); } } my $foo = 'Foo'->new(num => 20); isa_ok($foo, 'Moose::Object'); is($foo->num, 20); is($foo->num(40), 40); is($foo->num, 40); is($foo->add(2), 42); is($foo->num, 42); like( exception { $foo->num("Hello") }, qr{Must be a positive integer}, ); like( exception { $foo->add("Hello") }, qr{Must be a positive integer}, ); like( exception { 'Foo'->new(num => "Hello") }, qr{Must be a positive integer}, ); done_testing; 31types-mouse.t000664001750001750 214012416504253 14501 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that type constraints work with L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Requires { 'Mouse' => '1.00' }; use Test::Fatal; use Moops; class Foo using Mouse { has num => (is => 'rw', isa => Num); method add ( Num $addition ) { $self->num( $self->num + $addition ); } } my $foo = 'Foo'->new(num => 20); isa_ok($foo, 'Mouse::Object'); is($foo->num, 20); is($foo->num(40), 40); is($foo->num, 40); is($foo->add(2), 42); is($foo->num, 42); like( exception { $foo->num("Hello") }, qr{Value "Hello" did not pass type constraint "Num"}, ); like( exception { $foo->add("Hello") }, qr{Value "Hello" did not pass type constraint "Num"}, ); like( exception { 'Foo'->new(num => "Hello") }, qr{Value "Hello" did not pass type constraint "Num"}, ); done_testing; 31types.t000664001750001750 177412416504253 13367 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that type constraints work. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Moops; class Foo { has num => (is => 'rw', isa => Num); method add ( Num $addition ) { $self->num( $self->num + $addition ); } } my $foo = 'Foo'->new(num => 20); is($foo->num, 20); is($foo->num(40), 40); is($foo->num, 40); is($foo->add(2), 42); is($foo->num, 42); like( exception { $foo->num("Hello") }, qr{Value "Hello" did not pass type constraint "Num"}, ); like( exception { $foo->add("Hello") }, qr{Value "Hello" did not pass type constraint "Num"}, ); like( exception { 'Foo'->new(num => "Hello") }, qr{Value "Hello" did not pass type constraint "Num"}, ); done_testing; 32typeimport-moosextypes.t000664001750001750 263412416504253 17031 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that type constraints can be imported using the C option. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Requires { 'MooseX::Types::Common' => '0.001000' }; use Test::Fatal; use Moops; class NummyNummy types MooseX::Types::Common::Numeric using Moose :rwp :dirty { has i => (isa => PositiveInt); method set_by_int ( PositiveInt $i ) { $self->_set_i($i); } method set_by_num ( PositiveNum $n ) { $self->_set_i($n); } } my $nummy = NummyNummy->new(i => 127); like( exception { $nummy->_set_i(-4) }, qr{Must be a positive integer}, ); is($nummy->i, 127); $nummy->set_by_num(64); is($nummy->i, 64); like( exception { $nummy->set_by_int("Hello") }, qr{Must be a positive integer}, ); $nummy->set_by_num(42); is($nummy->i, 42); like( exception { $nummy->set_by_num('World') }, qr{Must be a positive number}, ); like( exception { $nummy->set_by_num("3.2") }, qr{Must be a positive integer}, "a value that slides by the method's type constraint, but not the attribute's" ); ok exists(&NummyNummy::PositiveInt); ok !exists(&NummyNummy::FileHandle); done_testing; 32typeimport.t000664001750001750 316212416504253 14431 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that type constraints can be imported using the C option. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Requires { 'Types::XSD::Lite' => '0.003' }; use Test::Fatal; use Moops; class BiteyBitey types Types::XSD::Lite :rwp :dirty { has byte => (isa => UnsignedByte); method set_by_number ( UnsignedByte $i ) { $self->_set_byte($i); } method set_by_character ( (String[length=>1]) $c ) { $self->_set_byte(ord $c); } method _known_type (Str $name) { try { Type::Registry->for_me->lookup($name) }; } } my $bitey = BiteyBitey->new(byte => 127); like( exception { $bitey->_set_byte(300) }, qr{^Value "300" did not pass type constraint "UnsignedByte"}, ); is($bitey->byte, 127); $bitey->set_by_number(64); is($bitey->byte, 64); ok( exception { $bitey->set_by_number(-1) }, ); $bitey->set_by_character('*'); is($bitey->byte, 42); ok( exception { $bitey->set_by_character('XXXX') }, ); like( exception { $bitey->set_by_character("\x{2639}") }, qr{^Value "9785" did not pass type constraint "UnsignedByte"}, "a value that slides by the method's type constraint, but not the attribute's" ); ok exists(&BiteyBitey::UnsignedByte); ok !exists(&BiteyBitey::FileHandle); ok !!BiteyBitey->_known_type('UnsignedByte'); ok !BiteyBitey->_known_type('MonkeyBizness'); done_testing; 33type-timing.t000664001750001750 216112416504253 14462 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that Moops gives us sufficient tools to declare and use a type constraint library in the same file. Compile time versus run time might be an issue. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Test::TypeTiny; use Moops; namespace MyTypes { use Type::Library -base, -declare => qw( RainbowColour ); use Type::Utils -all; BEGIN { extends 'Types::Standard' }; declare RainbowColour, as Enum[qw/ red orange yellow green blue indigo violet /]; } should_pass('indigo', MyTypes::RainbowColour); should_fail('magenta', MyTypes::RainbowColour); class MyClass types MyTypes { method capitalize_colour ( $class: RainbowColour $r ) { return uc($r); } } is('MyClass'->capitalize_colour('indigo'), 'INDIGO'); ok exception { 'MyClass'->capitalize_colour('magenta') }; done_testing; 41constants.t000664001750001750 150012416504253 14223 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that defining constants works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Moops; class MyClass { define PI => 3.2; method get_true () { true; } method get_false () { false; } } ok not 'MyClass'->can('true'); ok not 'MyClass'->can('false'); ok 'MyClass'->can('get_true'); ok 'MyClass'->can('get_false'); ok 'MyClass'->can('PI'); ok( 'MyClass'->get_true); ok(not 'MyClass'->get_false); is(MyClass::PI, 3.2); is(MyClass::PI(), 3.2); is('MyClass'->PI, 3.2); done_testing; 51moresugar.t000664001750001750 222512416504253 14221 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that L, C and C are imported into packages, and work as expected, but get cleaned away by L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Moops; class Foo; class Bar { our $last_err; method assert_blessed ($x) { state $errstr = "ERROR: "; blessed($x) or confess($errstr . $x); } method check_blessed ($x) { my $check = 0; try { $self->assert_blessed($x); $check++; } catch { my @lines = split /\n/; $last_err = $lines[0]; }; return $check; } } my $bar = 'Bar'->new; is($bar->check_blessed('Foo'), 0); like($Bar::last_err, qr{\AERROR: Foo at}); is($bar->check_blessed('Foo'->new), 1); ok(not 'Bar'->can('try')); ok(not 'Bar'->can('catch')); ok(not 'Bar'->can('finally')); ok(not 'Bar'->can('blessed')); ok(not 'Bar'->can('confess')); done_testing; 52customsugar.t000664001750001750 135312416504253 14573 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that Moops can be called with a list of additional functions to import into each package. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Moops [ 'List::Util' => ['sum'], ]; class Calculator { method add (@numbers) { return sum @numbers; } method double ($x) { return sum($x, $x); } } my $calc = Calculator->new; is( $calc->double($calc->add(1..6)), 42, ); ok not $calc->can('sum'); done_testing; 53warnings.t000664001750001750 134612416504253 14052 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that we don't get a warning from using smart match. (This is because the warning was added in Perl 5.18, and the warnings categories imported by Moops should be consistent from Perl 5.14 going forwards.) =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 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. =cut use Test::More; use Test::Requires { 'Test::Warnings' => 0 }; use Test::Warnings; use Moops; class Foo { method xxx ($val) { $val ~~ 1; } } ok( Foo->xxx(1) ); ok( not Foo->xxx(2) ); done_testing; 71library-moosextypes.t000664001750001750 220612416504253 16257 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Declare type libraries with Moops, extending L type libraries. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Test::Requires { 'MooseX::Types::Common::Numeric' => '0' }; use Test::TypeTiny; use Moops; library MyTypes extends MooseX::Types::Common::Numeric declares RainbowColour { declare RainbowColour, as Enum[qw/ red orange yellow green blue indigo violet /]; } should_pass('indigo', MyTypes::RainbowColour); should_fail('magenta', MyTypes::RainbowColour); should_pass('9', MyTypes::SingleDigit); should_fail('10', MyTypes::SingleDigit); class MyClass types MyTypes using Moose { method capitalize_colour ( $class: RainbowColour $r ) { return uc($r); } } is('MyClass'->capitalize_colour('indigo'), 'INDIGO'); ok exception { 'MyClass'->capitalize_colour('magenta') }; done_testing; 71library.t000664001750001750 165612416504253 13672 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Declare type libraries with Moops. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Test::TypeTiny; use Moops; library MyTypes extends Types::Standard declares RainbowColour { declare RainbowColour, as Enum[qw/ red orange yellow green blue indigo violet /]; } should_pass('indigo', MyTypes::RainbowColour); should_fail('magenta', MyTypes::RainbowColour); class MyClass types MyTypes { method capitalize_colour ( $class: RainbowColour $r ) { return uc($r); } } is('MyClass'->capitalize_colour('indigo'), 'INDIGO'); ok exception { 'MyClass'->capitalize_colour('magenta') }; done_testing; 91traits.t000664001750001750 137612416504253 13535 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Test Moop extensibility via traits. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Moops; BEGIN { role Moops::TraitFor::Keyword::Quux { has quux_n => (is => 'ro', default => 0); around generate_package_setup { my $n = $self->quux_n + 0; return ($self->${^NEXT}, qq!sub quux_method { $n }!); } } } class Foo :Quux(n => 42); can_ok('Foo', 'quux_method'); is('Foo'->new->quux_method, 42, '... which works'); done_testing; 92trait-dirty.t000664001750001750 105112416504253 14472 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Test C<< :dirty >> trait. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Moops; class Foo :dirty { } class Bar { } can_ok('Foo', 'blessed', 'confess'); ok(not 'Bar'->can('blessed') || 'Bar'->can('confess')); done_testing; 93trait-mutable.t000664001750001750 144012416504253 14773 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Test C<< :mutable >> trait. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Requires { 'Moose' => '2.0600' }; use Test::Fatal; use Moops; class Foo using Moose :mutable; class Bar using Moose; 'Foo'->meta->add_attribute('foo', { is => 'ro' }); my $foo = 'Foo'->new(foo => 42); is($foo->foo, 42); like( exception { 'Bar'->meta->add_attribute('bar', { is => 'ro' }) }, qr{^The '?add_attribute'? method cannot be called on an immutable instance}, ); done_testing; 94trait-ro-rw-rwp.t000664001750001750 177712416504253 15234 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Test C<< :ro >>, C<< :rw >> and C<< :rwp >> traits. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use strict; use warnings; use Test::More; use Test::Fatal; use Moops; class Foo :ro { has xyz => (); } my $foo = Foo->new(xyz => 40); ok exception { $foo->xyz( $foo->xyz + 2 ) }; is($foo->xyz, 40); ok not $foo->can("_set_xyz"); class Bar :rw { has xyz => (); } my $bar = Bar->new(xyz => 40); ok not exception { $bar->xyz( $bar->xyz + 2 ) }; is($bar->xyz, 42); ok not $bar->can("_set_xyz"); class Baz :rwp { has xyz => (); } my $baz = Baz->new(xyz => 40); ok exception { $baz->xyz( $baz->xyz + 2 ) }; is($baz->xyz, 40); ok $baz->can("_set_xyz"); ok not exception { $baz->_set_xyz( $baz->xyz + 2 ) }; is($baz->xyz, 42); done_testing; 99threads.t000664001750001750 250012416504253 13657 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Check that Moops can be used on threaded Perls. Doesn't test much actual functionality under threading; merely that Moops can be loaded, that threads can be created, and that they can see classes created by Moops back in the main thread. =head1 AUTHOR Toby Inkster, but adapted from a test script for L by Aaron James Trevena Eteejay@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 by Aaron James Trevena. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut use strict; use warnings; use Test::More; use Config; BEGIN { plan skip_all => "your perl does not support ithreads" unless $Config{useithreads}; }; use threads; { package ThreadedExample; use Moops; class Foo; } my $subref = sub { my $id = shift; note("id:$id"); return "ARGH[$id]" unless 'ThreadedExample::Foo'->can('new'); return $id; }; my @threads; my @idents = qw/bar1 bar2 bar3 bar4 bar5 bar6/; foreach my $foo_id (@idents) { push @threads, threads->create($subref, $foo_id); } my @results; for my $thread (@threads) { note("joining thread $thread"); push @results, $thread->join; } is_deeply( [ sort @results ], [ sort @idents ], 'expected return values', ); done_testing; QuuxDie.pm000664001750001750 123112416504253 13600 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Class C used by 14versions.t. This class needs to be defined externally because its definition is supposed to throw an exception at compile-time. The exception is thrown because the class tries to consume role C<< Baz 1.0 >>, but 14versions.t defines C<< Baz 0.9 >>. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =cut use Moops; class QuuxDie 1.0 extends Foo 1.0 with Baz 1.0; ReturnsTrue.pm000664001750001750 110612416504253 14517 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Class C used by 05true.t. This class needs to be defined externally because we are testing whether Moops-based modules automatically return a true value. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 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. =cut use Moops; class ReturnsTrue { method foo { 42 } } 0; # should be an implicit "1;" here ReturnsTrueAgain.pm000664001750001750 111412416504253 15456 0ustar00taitai000000000000Moops-0.034/t=pod =encoding utf-8 =head1 PURPOSE Class C used by 05true.t. This class needs to be defined externally because we are testing whether Moops-based modules automatically return a true value. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2014 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. =cut use Moops; class ReturnsTrueAgain { method foo { 42 } } # should be an implicit "1;" here ImportSet.pm000664001750001750 174412416504253 15553 0ustar00taitai000000000000Moops-0.034/lib/Moopsuse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::ImportSet; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo; use Module::Runtime qw(use_package_optimistically); use namespace::autoclean; has imports => (is => 'ro'); has ident => (is => 'ro', init_arg => undef, default => sub { state $x = 0; ++$x }); our %SAVED; sub BUILD { my $self = shift; $SAVED{ $self->ident } = $self->imports; } sub do_imports { shift; my ($package, $ident) = @_; my $imports = $SAVED{$ident}; require Import::Into; for my $import (@$imports) { my ($module, $params) = @$import; use_package_optimistically($module)->import::into( $package, (ref($params) eq q(HASH) ? %$params : ref($params) eq q(ARRAY) ? @$params : ()), ); } } sub generate_code { my $self = shift; my ($pkg) = @_; my $class = ref $self; my $ident = $self->ident; return "BEGIN { '$class'->do_imports(q[$pkg], $ident) };"; } 1; Keyword.pm000664001750001750 726512416504253 15255 0ustar00taitai000000000000Moops-0.034/lib/Moopsuse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::Keyword; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo; use B qw(perlstring); use Devel::GlobalDestruction; use Module::Runtime qw(module_notional_filename use_package_optimistically); use namespace::autoclean; has 'keyword' => (is => 'ro'); has 'ccstash' => (is => 'ro'); has 'package' => (is => 'ro'); has 'version' => (is => 'ro', predicate => 'has_version'); has 'relations' => (is => 'ro'); has 'is_empty' => (is => 'ro'); has 'imports' => (is => 'ro', predicate => 'has_imports'); has 'version_checks' => (is => 'ro'); has '_guarded' => (is => 'lazy', default => sub { [] }); sub should_support_methods { 0 } sub BUILD { my $self = shift; @{ $self->relations->{types} ||= [] } or push @{$self->relations->{types}}, 'Types::Standard'; } sub generate_code { my $self = shift; my $class = ref $self; my $package = $self->package; # Create the package declaration and version my $inject = "package $package;"; $inject .= ( $self->has_version ? "BEGIN { our \$VERSION = '${\ $self->version }' };" : "BEGIN { our \$VERSION = '' };" ); $inject .= "BEGIN { \$INC{${\ perlstring module_notional_filename $package }} = __FILE__ };"; # Standard imports $inject .= join q[], $self->generate_package_setup; # Additional imports $inject .= $self->imports->generate_code($package) if $self->has_imports; # Stuff that must happen at runtime rather than compile time $inject .= "'Moops'->at_runtime('$package');"; my @guarded = @{ $self->_guarded }; state $i = 0; if (@guarded) { $inject .= sprintf( 'my $__GUARD__%d_%d = "Moops::Keyword"->scope_guard(sub { %s });', ++$i, 100_000 + int(rand 899_000), join(q[;], @guarded), ); } return $inject; } sub generate_package_setup { my $self = shift; return ( $self->generate_type_constraint_setup, $self->generate_package_setup_oo, ) if $self->is_empty; return ( 'use Carp qw(confess);', 'use PerlX::Assert;', 'use PerlX::Define;', 'use Scalar::Util qw(blessed);', 'use Try::Tiny;', 'BEGIN { (*true, *false) = (\&Moops::_true, \&Moops::_false) };', $self->generate_type_constraint_setup, $self->generate_package_setup_oo, $self->generate_package_setup_methods, 'use v5.14;', 'use strict;', 'no warnings;', 'use warnings FATAL => @Moops::FATAL_WARNINGS;', ); } sub generate_package_setup_oo { return; } sub generate_package_setup_methods { my $self = shift; my @args = $self->arguments_for_kavorka($self->package); return "use Kavorka qw(@args);"; } sub generate_type_constraint_setup { my $self = shift; return map { my $lib = use_package_optimistically($_); $lib->isa('Type::Library') ? "use $lib -types;" : $lib->can('type_names') ? do { require Type::Registry; "use $lib ('$lib'->type_names); BEGIN { 'Type::Registry'->for_me->add_types(q[$lib]) };" } : do { require Carp; Carp::croak("'$lib' is not a recognized type constraint library") }; } @{ $self->relations->{types} || [] }; } sub arguments_for_kavorka { return qw/ multi fun /; } sub known_relationships { return qw/ types /; } sub qualify_relationship { 1; } sub version_relationship { 1; } sub check_prerequisites { my $self = shift; for my $prereq (@{$self->version_checks}) { &use_package_optimistically(@$prereq) if defined $prereq->[1]; } } sub _mk_guard { my $self = shift; push @{$self->_guarded}, @_; } use Variable::Magic qw(wizard cast); sub scope_guard { shift; state $wiz = wizard( data => sub { $_[1] }, free => sub { $_[1]() }, ); cast my($magic), $wiz, $_[0]; \$magic; } 1; MethodModifiers.pm000664001750001750 324712416504253 16707 0ustar00taitai000000000000Moops-0.034/lib/Moopsuse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::MethodModifiers; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Attribute::Handlers; sub handle { my ($pkg, $glob, $code, $modifier) = @_; my ($subname) = ("${\*$glob}" =~ /(\w+)$/); sweep($pkg, $subname); my $installer = find_installer($pkg, $subname, $code, $modifier) or Carp::croak("No '$modifier' method modifier for package '$pkg'; stopped"); my @at_runtime = ($installer, $subname, wrap_method($pkg, $subname, $code, $modifier)); push @{ $Moops::AT_RUNTIME{$pkg} }, \@at_runtime; } # stolen from namespace::sweep, # which stole it from namespace::clean. sub sweep { my $package = shift; my $ps = 'Package::Stash'->new($package); my @symbols = map { my $name = $_ . $_[0]; my $def = $ps->get_symbol( $name ); defined($def) ? [$name, $def] : () } '$', '@', '%', ''; $ps->remove_glob( $_[0] ); $ps->add_symbol( @$_ ) for @symbols; } sub find_installer { my ($pkg, undef, undef, $modifier) = @_; no strict 'refs'; \&{$pkg.'::'.lc($modifier)}; } sub wrap_method { my ($pkg, undef, $code, $modifier) = @_; if (lc($modifier) eq 'around') { my $wrapped = eval qq{ sub { package $pkg; local \${^NEXT} = shift(\@_); \$code->(\@_); } }; # XXX - this doesn't work!!! $MooseX::FunctionParametersInfo::WRAPPERS{"$wrapped"} = $code; return $wrapped; } return $code; } sub UNIVERSAL::Before :ATTR(BEGIN) { goto \&Moops::MethodModifiers::handle; } sub UNIVERSAL::After :ATTR(BEGIN) { goto \&Moops::MethodModifiers::handle; } sub UNIVERSAL::Around :ATTR(BEGIN) { goto \&Moops::MethodModifiers::handle; } 1; Parser.pm000664001750001750 1557712416504253 15112 0ustar00taitai000000000000Moops-0.034/lib/Moopsuse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::Parser; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo; use Keyword::Simple (); use Module::Runtime qw($module_name_rx); use namespace::autoclean; # I'm just going to assume that 0.01 is the only version that is ever going # to have that problem... use PerlX::Define _RT88970 => (Keyword::Simple->VERSION == 0.01) ? 1 : 0; has 'keyword' => (is => 'ro'); has 'ccstash' => (is => 'ro'); has 'ref' => (is => 'ro'); # Not set in constructor; set by parse method. has 'package' => (is => 'rwp', init_arg => undef); has 'version' => (is => 'rwp', init_arg => undef, predicate => 'has_version'); has 'relations' => (is => 'rwp', init_arg => undef, default => sub { +{} }); has 'version_checks' => (is => 'rwp', init_arg => undef, default => sub { [] }); has 'traits' => (is => 'rwp', init_arg => undef, default => sub { +{} }); has 'is_empty' => (is => 'rwp', init_arg => undef, default => sub { 0 }); has 'done' => (is => 'rwp', init_arg => undef, default => sub { 0 }); has 'lines' => (is => 'rw', init_arg => undef, default => sub { 0 }); has 'class_for_keyword' => ( is => 'lazy', builder => 1, handles => { known_relationships => 'known_relationships', qualify_relationship => 'qualify_relationship', version_relationship => 'version_relationship', }, ); sub _eat { my $self = shift; my ($bite) = @_; my $ref = $self->{ref}; if (ref($bite) and $$ref =~ /\A($bite)/sm) { my $r = $1; substr($$ref, 0, length($r)) = ''; return $r; } elsif (!ref($bite)) { substr($$ref, 0, length($bite)) eq $bite or Carp::croak("Expected $bite; got $$ref"); substr($$ref, 0, length($bite)) = ''; return $bite; } Carp::croak("Expected $bite; got $$ref"); } sub _eat_space { my $self = shift; my $ref = $self->{ref}; my $X; while ( ($$ref =~ m{\A( \s+ )}x and $X = 1) or ($$ref =~ m{\A\#} and $X = 2) ) { $X==2 ? $self->_eat(qr{\A\#.+?\n}sm) : $self->_eat($1); $self->{lines} += $X==2 ? 1 : (my @tmp = split /\n/, $1, -1)-1; } return; } sub _peek { my $self = shift; my $re = $_[0]; my $ref = $self->{ref}; return scalar($$ref =~ m{\A$re}); } sub _eat_package { my $self = shift; my ($rel) = @_; my $pkg = $self->_eat(qr{(?:::)?$module_name_rx}); return $self->qualify_module_name($pkg, $rel); } sub _eat_package_and_version { my $self = shift; my ($rel) = @_; my $pkg = $self->_eat(qr{(?:::)?$module_name_rx}); $self->_eat_space; my $ver = $self->_peek_version ? $self->_eat_version : undef; return ( $self->qualify_module_name($pkg, $rel), $ver, ); } { my $v_re = qr{v?[0-9._]+}; sub _peek_version { shift->_peek($v_re) } sub _eat_version { shift->_eat($v_re) } } sub _eat_relations { my $self = shift; my $RELS = join '|', map quotemeta, $self->known_relationships; $RELS = qr/\A($RELS)/sm; my (%relationships, @vchecks); while ($self->_peek($RELS)) { my $rel = $self->_eat($RELS); $self->_eat_space; my $with_version = $self->version_relationship($rel); my ($pkg, $ver) = $with_version ? $self->_eat_package_and_version($rel) : $self->_eat_package($rel); my @modules = $pkg; push @vchecks, [$pkg, $ver] if $ver; $self->_eat_space; while ($self->_peek(qr/\A,/)) { $self->_eat(','); $self->_eat_space; my ($pkg, $ver) = $with_version ? $self->_eat_package_and_version($rel) : $self->_eat_package($rel); push @modules, $pkg; push @vchecks, [$pkg, $ver] if $ver; $self->_eat_space; } push @{ $relationships{$rel}||=[] }, @modules; } wantarray ? (\%relationships, \@vchecks) : \%relationships; } sub _eat_traits { my $self = shift; my %traits; while ($self->_peek(qr/[A-Za-z]\w+/)) { my $trait = $self->_eat(qr/[A-Za-z]\w+/); $self->_eat_space; if ($self->_peek(qr/\(/)) { require Text::Balanced; my $code = Text::Balanced::extract_codeblock(${$self->ref}, '()'); my $ccstash = $self->ccstash; # stolen from Attribute::Handlers my $evaled = eval("package $ccstash; no warnings; no strict; local \$SIG{__WARN__}=sub{die}; +{ $code }"); $traits{$trait} = $evaled; $self->_eat_space; } else { $traits{$trait} = undef; } if ($self->_peek(qr/:/)) { $self->_eat(':'); $self->_eat_space; } } \%traits; } sub parse { my $self = shift; return if $self->done; $self->_eat_space; $self->_set_package( $self->_eat_package ); $self->_eat_space; $self->_set_version( $self->_eat_version ) if $self->_peek_version; $self->_eat_space; if ($self->known_relationships) { my ($rels, $vchecks) = $self->_eat_relations; $self->_set_relations( $rels ); $self->_set_version_checks( $vchecks ); } $self->_eat_space; if ($self->_peek(qr/:/)) { $self->_eat(':'); $self->_eat_space; $self->_set_traits($self->_eat_traits); $self->_eat_space; } $self->_peek(qr/;/) ? $self->_set_is_empty(1) : $self->_eat('{'); # We subtract 1 to work around RT#88970 when possible. # This obviously won't solve anything if lines == 0 substr(${$self->{ref}}, 0, 0, ("\n" x ($self->{lines} - _RT88970))); # But we can try. ${$self->{ref}} =~ s/\A[\t\r\x20]*\n//ms if _RT88970 && !$self->{lines}; $self->_set_done(1); } sub keywords { qw/ class role namespace library /; } sub qualify_module_name { my $self = shift; my ($bareword, $rel) = @_; my $caller = $self->ccstash; return $1 if $bareword =~ /^::(.+)$/; return $bareword if $caller eq 'main'; return $bareword if $bareword =~ /::/; return "$caller\::$bareword" if !defined($rel) || $self->qualify_relationship($rel); return $bareword; } sub _build_class_for_keyword { my $self = shift; my $kw = $self->keyword; if ($kw eq 'class') { require Moops::Keyword::Class; return 'Moops::Keyword::Class'; } elsif ($kw eq 'role') { require Moops::Keyword::Role; return 'Moops::Keyword::Role'; } elsif ($kw eq 'library') { require Moops::Keyword::Library; return 'Moops::Keyword::Library'; } require Moops::Keyword; return 'Moops::Keyword'; } sub keyword_object { my $self = shift; my (%attrs) = @_; my $class = $self->class_for_keyword; if (my %traits = %{$self->traits || {}}) { require Moo::Role; $class = 'Moo::Role'->create_class_with_roles( $self->class_for_keyword, map("Moops::TraitFor::Keyword::$_", keys %traits), ); for my $trait (keys %traits) { next unless defined $traits{$trait}; $attrs{sprintf('%s_%s', lc($trait), $_)} = $traits{$trait}{$_} for keys %{$traits{$trait}}; } } $class->new( package => $self->package, (version => $self->version) x!!($self->has_version), relations => $self->relations, is_empty => $self->is_empty, keyword => $self->keyword, ccstash => $self->ccstash, version_checks => $self->version_checks, %attrs, ); } 1; FunctionParametersInfo.pm000664001750001750 1340312416504253 20402 0ustar00taitai000000000000Moops-0.034/lib/MooseXuse 5.008; use strict; use warnings; use Moose (); use Function::Parameters (); use Function::Parameters::Info (); my $dummy = 'Function::Parameters::Info'->new( keyword => 'sub', slurpy => 'Function::Parameters::Param'->new(type => undef, name => '@_'), invocant => undef, _positional_required => [], _named_required => [], _positional_optional => [], _named_optional => [], ); { package MooseX::FunctionParametersInfo; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; sub _unwrap { my $coderef = shift; $MooseX::FunctionParametersInfo::WRAPPERS{"$coderef"} || $coderef; } sub import { my $meta = Class::MOP::class_of(scalar caller); Moose::Util::MetaRole::apply_metaroles( for => $meta, role_metaroles => { method => ['MooseX::FunctionParametersInfo::Trait::Method'], }, class_metaroles => { method => ['MooseX::FunctionParametersInfo::Trait::Method'], wrapped_method => ['MooseX::FunctionParametersInfo::Trait::WrappedMethod'], }, ); } } { package MooseX::FunctionParametersInfo::Trait::Method; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moose::Role; has _info => ( is => 'ro', lazy => 1, builder => '_build_info', handles => { declaration_keyword => 'keyword', slurpy_parameter => 'slurpy', invocant_parameter => 'invocant', positional_required_parameters => 'positional_required', named_required_parameters => 'named_required', positional_optional_parameters => 'positional_optional', named_optional_parameters => 'named_optional', minimum_parameters => 'args_min', maximum_parameters => 'args_max', }, ); sub _build_info { my $self = shift; Function::Parameters::info( MooseX::FunctionParametersInfo::_unwrap($self->body) ) or $dummy; } sub positional_parameters { my $self = shift; ( $self->positional_required_parameters, $self->positional_optional_parameters ); } sub named_parameters { my $self = shift; ( $self->named_required_parameters, $self->named_optional_parameters ); } } { package MooseX::FunctionParametersInfo::Trait::WrappedMethod; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moose::Role; with 'MooseX::FunctionParametersInfo::Trait::Method'; around _build_info => sub { my $orig = shift; my $self = shift; Function::Parameters::info( MooseX::FunctionParametersInfo::_unwrap($self->get_original_method->body) ) or $dummy; }; } 1; __END__ =pod =encoding utf-8 =for stopwords invocant =head1 NAME MooseX::FunctionParametersInfo - make Function::Parameters::info() data available within the meta object protocol =head1 SYNOPSIS package Foo { use Function::Parameters; use Moose; use MooseX::FunctionParametersInfo; method bar (Str $x, Int $y) { ...; } } my $method = Class::MOP::class_of('Foo')->get_method('bar'); printf("%s %s\n", $_->type, $_->name) for $method->positional_parameters; __END__ Str $x Int $y =head1 DESCRIPTION L provides declarative sugar for processing arguments to subs, and provides a small API to query the declarations. L provides a comprehensive introspection API for Perl classes. MooseX::FunctionParametersInfo marries them together, injecting information from Function::Parameters into Moose's meta objects. MooseX::FunctionParametersInfo is currently distributed as part of L, but is fairly independent of the rest of it, and may be spun off as a separate release in the future. =head2 Methods MooseX::FunctionParametersInfo adds the following methods to the L objects for your class. If your method is wrapped, it is the info from the original (wrapped) method that is reported; not the info from the wrapper. If your method was not declared via Function::Parameters (e.g. it was declared using the Perl built-in C<< sub >> keyword) then we make a best guess. Methods that return parameters, return L objects, which have C and C methods. The type (if any) will be a blessed type constraint object, such as a L or L object. =over =item C Returns the name of the keyword used to declare the method; e.g. C<< "sub" >> or C<< "method" >>. =item C The array parameter into which additional arguments will be slurped, or undef. =item C The parameter which is the method's invocant (typically, C<< $self >> or C<< $class >>), or undef. =item C, C C, C Returns the appropriate parameters as a list. =item C, C A list of the required parameters followed by optional parameters. =item C, C The minimum and maximum number of parameters the method can take. =back =head1 BUGS Please report any bugs to L. =head1 SEE ALSO L, L, L. L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =head1 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. Define.pm000664001750001750 401112416504253 14742 0ustar00taitai000000000000Moops-0.034/lib/PerlXuse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package PerlX::Define; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use B (); use Keyword::Simple (); sub import { shift; if (@_) { my ($name, $value) = @_; my $caller = caller; local $@; ref($value) ? eval qq[ package $caller; sub $name () { \$value }; 1; ] : eval qq[ package $caller; sub $name () { ${\ B::perlstring($value) } }; 1; ]; $@ ? die($@) : return; } Keyword::Simple::define('define' => sub { my $line = shift; my ($whitespace1, $name, $whitespace2, $equals) = ( $$line =~ m{\A([\n\s]*)(\w+)([\n\s]*)(=\>?)}s ) or Carp::croak("Syntax error near 'define'"); my $len = length($whitespace1. $name. $whitespace2. $equals); substr($$line, 0, $len) = "; use PerlX::Define $name => "; }); } 1; __END__ =pod =encoding utf-8 =head1 NAME PerlX::Define - cute syntax for defining constants =head1 SYNOPSIS use PerlX::Define; define PI = 3.2; =head1 DESCRIPTION PerlX::Define is a yet another module for defining constants. Constants defined this way, aren't "better" than the constants defined any other way, but the syntax is cute. PerlX::Define is currently distributed as part of L, but is fairly independent of the rest of it, and may be spun off as a separate release in the future. =head1 BUGS Please report any bugs to L. =head1 SEE ALSO L. L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013-2014 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. =head1 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. Class.pm000664001750001750 364412416504253 16317 0ustar00taitai000000000000Moops-0.034/lib/Moops/Keyworduse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::Keyword::Class; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo; use B 'perlstring'; extends qw( Moops::Keyword::Role ); my %using = ( Moo => 'use Moo; use MooX::late;', Moose => 'use Moose; use MooseX::KavorkaInfo;', Mouse => 'use Mouse;', Tiny => 'use Class::Tiny; use Class::Tiny::Antlers;', ); sub generate_package_setup_oo { my $self = shift; my $using = $self->relations->{using}[0] // $self->default_oo_implementation; exists($using{$using}) or Carp::croak("Cannot create a package using $using; stopped"); my @lines = ( 'use namespace::autoclean -also => "has";', 'use Lexical::Accessor;', ); push @lines, "use MooseX::MungeHas qw(@{[ $self->arguments_for_moosex_mungehas ]});" if $using =~ /^Mo/; if ($using eq 'Moose') { state $has_xs = !!eval('require MooseX::XSAccessor'); push @lines, 'use MooseX::XSAccessor;' if $has_xs; } my @return = ( $using{$using}, $self->generate_package_setup_relationships, @lines, ); # Note that generate_package_setup_relationships typically adds # `with` statements for composing roles, so we need to add this # make_immutable *after* calling it. $self->_mk_guard('__PACKAGE__->meta->make_immutable;') if $self->should_make_immutable; return @return; } sub should_make_immutable { my $self = shift; my $using = $self->relations->{using}[0] // $self->default_oo_implementation; ($using eq 'Moose' or $using eq 'Mouse'); } around generate_package_setup_relationships => sub { my $orig = shift; my $self = shift; my @classes = @{ $self->relations->{extends} || [] }; return ( @classes ? sprintf("extends(%s);", join ",", map perlstring($_), @classes) : (), $self->$orig(@_), ); }; around known_relationships => sub { my $next = shift; my $self = shift; return($self->$next(@_), qw/ extends /); }; 1; Library.pm000664001750001750 214012416504253 16644 0ustar00taitai000000000000Moops-0.034/lib/Moops/Keyworduse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::Keyword::Library; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo; extends 'Moops::Keyword'; use namespace::autoclean; around generate_package_setup => sub { my $orig = shift; my $self = shift; return ( $self->$orig(@_), $self->generate_type_library_setup, ); }; sub generate_type_library_setup { my $self = shift; my $use_type_library = "use Type::Library -base"; if (@{ $self->relations->{declares} || [] }) { my @types = @{$self->relations->{declares}}; $use_type_library .= ", -declare => qw(@types)"; } my $extends; if (@{ $self->relations->{extends} || [] }) { my @parents = @{$self->relations->{extends}}; $extends = "BEGIN { extends qw(@parents) }"; } return ( "$use_type_library;", "use Type::Utils -all;", ($extends ? "$extends;" : ()), ); } sub known_relationships { return qw/ extends declares /; } sub qualify_relationship { $_[1] eq 'extends'; } sub version_relationship { $_[1] eq 'extends' or $_[1] eq 'types'; } 1; Role.pm000664001750001750 412712416504253 16150 0ustar00taitai000000000000Moops-0.034/lib/Moops/Keyworduse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::Keyword::Role; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo; use B qw(perlstring); extends qw( Moops::Keyword ); sub should_support_methods { 1 } sub arguments_for_moosex_mungehas { shift; return qw(eq_1); } my %using = ( Moo => 'use Moo::Role; use MooX::late;', Moose => 'use Moose::Role; use MooseX::KavorkaInfo;', Mouse => 'use Mouse::Role;', Tiny => 'use Role::Tiny;', ( map { $_ => "use $_;" } qw/ Role::Basic Role::Tiny Moo::Role Mouse::Role Moose::Role / ), ); sub default_oo_implementation { 'Moo'; } sub generate_package_setup_oo { my $self = shift; my $using = $self->relations->{using}[0] // $self->default_oo_implementation; exists($using{$using}) or Carp::croak("Cannot create a package using $using; stopped"); my @lines = ( 'use namespace::autoclean -also => ["has", "lexical_has"];', 'use Lexical::Accessor;', ); push @lines, "use MooseX::MungeHas qw(@{[ $self->arguments_for_moosex_mungehas ]});" if $using =~ /^Mo/; return ( $using{$using}, $self->generate_package_setup_relationships, @lines, ); } sub generate_package_setup_relationships { my $self = shift; my @roles = @{ $self->relations->{with} || [] }; $self->_mk_guard( sprintf("with(%s);", join(",", map perlstring($_), @roles)) ) if @roles; return; } around known_relationships => sub { my $next = shift; my $self = shift; return($self->$next(@_), qw/ with using /); }; around qualify_relationship => sub { my $next = shift; my $self = shift; $_[0] eq 'using' ? !!0 : $self->$next(@_); }; around version_relationship => sub { my $next = shift; my $self = shift; $_[0] eq 'using' ? !!0 : $self->$next(@_); }; around arguments_for_kavorka => sub { my $next = shift; my $self = shift; my @keywords = qw/ method before after around /; my $using = $self->relations->{using}[0] // $self->default_oo_implementation; push @keywords, qw/ override augment / if $using =~ /^Mo[ou]se\b/; return ( $self->$next(@_), @keywords, ); }; 1; Objects101.pod000664001750001750 2272512416504253 17045 0ustar00taitai000000000000Moops-0.034/lib/Moops/Manual=pod =encoding utf-8 =for stopwords textboxes =head1 NAME Moops::Manual::Objects101 - an introduction to object oriented programming using Moops =head1 SYNOPSIS This tutorial assumes some knowledge of procedural programming in Perl, and provides a gentle introduction to the object oriented programming paradigm. =head1 DESCRIPTION Object oriented programming is a programming paradigm based around programming I, and manipulating instances of those classes called I. These can be objects that appear on the screen (e.g., pictures, textboxes, etc.) or are part of the programming (e.g. actors, connections, particles, etc.). =head2 Classes I are very similar to I in that they collect data together. However, classes extend this idea and are made from two different things: =over =item I Things that the object stores data in, similar to variables. =item I Functions and Procedures attached to an Object and allowing the object to perform actions. =back Let's take a look at the following example: use Moops; class Car { lexical_has max_speed => ( is => 'rw', accessor => \(my $max_speed), isa => Int, default => 90, ); has fuel => ( is => 'rw', isa => Int, ); has speed => ( is => 'rw', isa => Int, trigger => method ($new, $old?) { confess "Cannot travel at a speed of $new; too fast" if $new > $self->$max_speed; }, ); method refuel (Int $x) { say "Pumping gas!"; $self->fuel( $self->fuel + $x ); } method drive () { $self->fuel( $self->fuel - 1 ); } } You can see that the class is called Car and it has: =over =item * Three attributes: C<< $max_speed >> (which is a lexical/private attribute), C, and C; =item * Two methods: C and C. =back Remember this is a class and therefore only a template, we need to "create" it using an object. =head3 Attributes These store information about the object. In the example above we store the C, C, and C<< $max_speed >>. The attributes are attached to the class, and if there are several instances (objects) of the class then each will store its own version of these variables. Unlike many other programming languages, Perl has no native concept of attributes. The C keyword instead sets up some extra methods for your class, called "accessors", which allow you to access the data for the attributes. C<< $max_speed >> has a lexical accessor, stored in a lexical (C) variable, so cannot be directly accessed outside the scope where it was declared. =head3 Methods Unlike structures, OOP allows you to attach functions and procedures to your code. This means that not only can you store details about you car (the attributes), you can also allow for subroutines such as C and C, which are attached to each class. =head2 OO - PIIE When talking about OOP you must remember I (yummy pie!) =over =item B Object Orientation =item B Polymorphism, Inheritance, Instantiation, and Encapsulation =back =head3 Instantiation As we have seen a class is a template for something; you can't actually execute a class; you must instantiate it: that is create an instance of an class in the form of an object. my $polo = Car->new; my $escort = Car->new; The code above creates objects called C<< $polo >> and C<< $escort >>, both of class type Car (which we declared earlier). We can now use all the public attributes and methods: $polo->refuel(100); # assuming fuel starts at 0 $polo->drive(); $polo->drive(); $escort->refuel(50); # assuming fuel starts at 0 for my $x (1 .. 20) { $escort->drive(); $polo->drive(); } $polo->refuel(10); say "polo: ", $polo->fuel; say "escort: ", $escort->fuel; This would output the following: Pumping gas! Pumping gas! Pumping gas! polo: 88 escort: 30 =head3 Encapsulation You noticed that we used C to declare C instead of C. What this means is that these attributes are not directly accessible from outside the definition of the class. Let's take our polo class as an example: $polo->fuel(100); # this directly alters the fuel level of $polo In the example we access the C attribute of the polo class and give the car 100 units of fuel. Because C is declared as public, there are no restrictions in accessing it. However, when we try the following we run into trouble: $polo->$max_speed(100); The reason that this wouldn't work is because we have declared the C<$max_speed> attribute lexically. If something is declared lexically you can't access it externally, but how do you access it? The only way to access a lexical (private) attribute is to use a public method. In the Car code example we could have: method get_top_speed () { return $self->$max_speed; } Because this method is public we can call it from outside the class. And because C is declared inside the Car class, it can have access to all the private attributes and methods. =head3 Inheritance Building on the car example above, what would happen if we wanted to declare an electric car? Well we'd probably want to store some information on the number of batteries that it has: use Moops imports => ['Lexical::Accessor']; class ElectricCar { lexical_has max_speed => ( is => 'rw', accessor => \(my $max_speed), isa => Int, default => 90, ); has num_batteries => ( is => 'rw', isa => Int, default => 8, ); has fuel => ( is => 'rw', isa => Int, ); has speed => ( is => 'rw', isa => Int, trigger => method ($new, $old?) { confess "Cannot travel at a speed of $new; too fast" if $new > $self->$max_speed; }, ); method refuel (Int $x) { # HOLD ON! } } This seems like a very long and tedious task rewriting all the same code again. You're right! It would be far better if we only had to declare all the new stuff we wanted to add. OOP allows for inheritance, where a new class can inherit the attributes and methods of a parent class: class ElectricCar extends Car { has num_batteries => ( is => 'ro', isa => Int, default => 8, ); } This means that everything that C declared is now accessible from C, as well as the new C attribute. Let's instantiate this example and see what's possible: my $gwiz = ElectricCar->new(num_batteries => 6, fuel => 100); say $gwiz->num_batteries; # defined in ElectricCar say $gwiz->fuel; # defined in Car Using inheritance makes creating new classes very quick and easy. It also allows for a modular approach to creating classes, where you might never use the base class at all, but only as a means of creating other child classes. Rather than having to rewrite the same functionality for similar objects, OOP allows you to reuse attributes and methods from parent classes. =head3 Polymorphism When you were young you might have watched the I<< Mighty Morphin' Power Rangers >>. These guys could morph from regular people into their power suits. Sadly polymorphism isn't that exciting, but it does allow you to change the function of attributes and methods when you are inheriting from a parent class. Consider our car example again. When we created the C object we inherited from C and added the C attribute and methods. But what happens when we try and refuel, let's take a look at the code: method refuel (Int $x) { say "Pumping gas!"; $self->fuel( $self->fuel + $x ); } Well this just won't do! We are creating an electric car and we don't want to say that we are pumping gas; what would our sandal-socked yoghurt eating friends say?! So for the C class, we want to inherit everything from C, but we want to morph(change) the C method. To do that we I the method inherited from the superclass: class ElectricCar extends Car { has num_batteries => ( is => 'ro', isa => Int, default => 8, ); override refuel (Int $x) is override { say "Pure renewable energy!"; $self->fuel( $self->fuel + $x ); } } =head1 BUGS Please report any other bugs to L. =head1 SEE ALSO L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE, plus the authors credited at: L (as of 15 December 2013). =head1 COPYRIGHT AND LICENCE Copyright 2013-2014 Toby Inkster and others. Text is available under the Creative Commons Attribution/Share-Alike License. L. =head1 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. Exception.pm000664001750001750 40112416504253 21122 0ustar00taitai000000000000Moops-0.034/examples/lib/MoopsX/Keywordpackage MoopsX::Keyword::Exception; use Moo; extends 'Moops::Keyword::Class'; use Throwable (); sub BUILD { my $self = shift; unshift @{ $self->relations->{with} ||= [] }, 'Throwable'; } sub known_relationships { return qw(extends with using); } 1; assertions.pm000664001750001750 61612416504253 21152 0ustar00taitai000000000000Moops-0.034/lib/Moops/TraitFor/Keyworduse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::TraitFor::Keyword::assertions; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo::Role; around generate_package_setup => sub { my $next = shift; my $self = shift; return map { s/use PerlX::Assert;/use PerlX::Assert -check;/; $_ } $self->$next(@_); }; 1; dirty.pm000664001750001750 54612416504253 20115 0ustar00taitai000000000000Moops-0.034/lib/Moops/TraitFor/Keyworduse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::TraitFor::Keyword::dirty; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo::Role; around generate_package_setup => sub { my $next = shift; my $self = shift; grep !/^use namespace::autoclean/, $self->$next(@_); }; 1; fp.pm000664001750001750 375212416504253 17411 0ustar00taitai000000000000Moops-0.034/lib/Moops/TraitFor/Keyworduse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::TraitFor::Keyword::fp; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo::Role; use Moops::MethodModifiers (); around generate_package_setup_methods => sub { my $next = shift; my $self = shift; return ( "use Function::Parameters '${\ ref($self) }'->arguments_for_function_parameters(q[${\ $self->package }]);", ); }; around generate_package_setup_oo => sub { my $next = shift; my $self = shift; my @orig = $self->$next(@_); s/MooseX::KavorkaInfo/MooseX::FunctionParametersInfo/g for @orig; return @orig; }; sub arguments_for_function_parameters { my $class = shift; my ($pkg) = @_; state $reify = sub { state $guard = do { require Type::Utils }; Type::Utils::dwim_type($_[0], for => $_[1]); }; my $keywords = { fun => { name => 'optional', runtime => 0, default_arguments => 1, check_argument_count => 1, check_argument_types => 1, named_parameters => 1, types => 1, reify_type => $reify, }, }; if ($class->should_support_methods) { $keywords->{method} = { name => 'optional', runtime => 0, default_arguments => 1, check_argument_count => 1, check_argument_types => 1, named_parameters => 1, types => 1, reify_type => $reify, attrs => ':method', shift => '$self', invocant => 1, }; $keywords->{ lc($_) } = { name => 'required', runtime => 0, default_arguments => 1, check_argument_count => 1, check_argument_types => 1, named_parameters => 1, types => 1, reify_type => $reify, attrs => ":$_", shift => '$self', invocant => 1, } for qw( Before After Around ); } return $keywords; } 1; mutable.pm000664001750001750 41512416504253 20406 0ustar00taitai000000000000Moops-0.034/lib/Moops/TraitFor/Keyworduse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::TraitFor::Keyword::mutable; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo::Role; around should_make_immutable => sub { 0 }; 1; ro.pm000664001750001750 53112416504253 17374 0ustar00taitai000000000000Moops-0.034/lib/Moops/TraitFor/Keyworduse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::TraitFor::Keyword::ro; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo::Role; around arguments_for_moosex_mungehas => sub { my $next = shift; my $self = shift; return ('is_ro', $self->$next(@_)); }; 1; rw.pm000664001750001750 53112416504253 17404 0ustar00taitai000000000000Moops-0.034/lib/Moops/TraitFor/Keyworduse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::TraitFor::Keyword::rw; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo::Role; around arguments_for_moosex_mungehas => sub { my $next = shift; my $self = shift; return ('is_rw', $self->$next(@_)); }; 1; rwp.pm000664001750001750 53312416504253 17566 0ustar00taitai000000000000Moops-0.034/lib/Moops/TraitFor/Keyworduse v5.14; use strict; use warnings FATAL => 'all'; no warnings qw(void once uninitialized numeric); package Moops::TraitFor::Keyword::rwp; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.034'; use Moo::Role; around arguments_for_moosex_mungehas => sub { my $next = shift; my $self = shift; return ('is_rwp', $self->$next(@_)); }; 1; ExceptionKeyword.pm000664001750001750 62412416504253 24040 0ustar00taitai000000000000Moops-0.034/examples/lib/MoopsX/TraitFor/Parserpackage MoopsX::TraitFor::Parser::ExceptionKeyword; use Moo::Role; around keywords => sub { my $next = shift; my $self = shift; return ('exception', $self->$next(@_)); }; around class_for_keyword => sub { my $next = shift; my $self = shift; if ($self->keyword eq 'exception') { require MoopsX::Keyword::Exception; return 'MoopsX::Keyword::Exception'; } return $self->$next(@_); }; 1;