COPYRIGHT000644001750001750 246513622545321 13421 0ustar00taitai000000000000MooX-late-0.100Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: MooX-late Upstream-Contact: Toby Inkster (TOBYINK) Source: https://metacpan.org/release/MooX-late Files: README lib/MooX/late.pm t/01basic.t t/02inflation.t t/03invalid_tc.t t/04arrayofattrs.t Copyright: This software is copyright (c) 2012-2014, 2019 by Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: INSTALL LICENSE TODO examples/simple.pl Copyright: Unknown License: Unknown Files: t/05haveimissedanytypes.t t/06handlesvia.t t/07coerce1.t t/08doesrole.t Copyright: This software is copyright (c) 2013 by Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: Changes META.json META.yml doap.ttl Copyright: Copyright 2020 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: Makefile.PL dist.ini Copyright: Copyright 2013 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 License: Artistic-1.0 This software is Copyright (c) 2020 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) 2020 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000644001750001750 13713622545321 13120 0ustar00taitai000000000000MooX-late-0.100Maintainer: - Toby Inkster (TOBYINK) Thanks: - SHLOMIF Changes000644001750001750 570713622545321 13423 0ustar00taitai000000000000MooX-late-0.100MooX-late ========= Created: 2012-11-30 Home page: Bug tracker: Maintainer: Toby Inkster (TOBYINK) 0.100 2020-02-17 [ Packaging ] - Make Sub::HandlesVia a required dependency. [ Other ] - Use Sub::HandlesVia instead of MooX::HandlesVia; less translation needed because Sub::HandlesVia already understands Moose-like syntax; plus it covers more datatypes and methods. 0.016 2019-11-18 [ Test Suite ] - Get test suite passing and stuff. 0.015 2014-08-18 [ Documentation ] - Make the list of stuff this module does more concise. [ Test Suite ] - Improve test cases for class type constraints. [ Packaging ] - Depend on Moo 1.006000. - Depend on Type::Utils 1.000001. [ Other ] - Removed: Drop support for `coerce => 1` because Moo 1.006000 supports this natively now. 0.014 2013-07-16 - Added: Support `coerce => 1` for Type::Tiny type constraints and those providing a similar API. 0.013 2013-07-16 - Added: Support Moose attribute traits using MooX::HandlesVia. - Removed: Retire support for non-reference attribute defaults because Moo now does this natively. - Updated: Use Type::Utils::dwim_type to translate strings to type constraint expressions. 0.012 2013-06-28 - Updated: Use Type::Registry/Type::Parser to translate strings to type constraint expressions. 0.011 2013-04-27 [ Bug Fixes ] - Fix support for class types. SHLOMIF++ 0.010 2013-04-23 [ Bug Fixes ] - Fix support for Maybe[`a] type constraint. (It was being interpreted as an object blessed into package 'Maybe'.) SHLOMIF++ 0.009 2013-04-15 - Updated: Switch from MooX::Types::MooseLike::Base to Types::Standard. 0.008 2013-03-11 [ Documentation ] - Minor documentation updates. [ Packaging ] - Make MooX::Types::MooseLike::Base a required dependency (was optional). 0.007 2012-12-26 [ Documentation ] - Documentation for use with Moo::Role. SHLOMIF++ - Link to MooX::HandlesVia on github. 0.006 2012-12-11 [ Bug Fixes ] - Skip t/02inflation.t if no MooX::Types::MooseLike::Base. 0.005 2012-12-09 [ Bug Fixes ] - Cope with has \@attributes => (...). [ Documentation ] - Document test suite. [ Packaging ] - Bump required version of Moo to 1.000004. 0.004 2012-12-03 - Added: Issue warnings when type constraint cannot be interpreted correctly. Warning is not issued at the time the attribute is built, but the first time the type constraint is checked against. Don't attempt to inflate these type constraints when Moose is loaded. 0.003 2012-12-02 - Added: Inflation of type constraints to Moose. - General refactoring of type constraint code. - Use MooX::Types::MooseLike::Base for type checks. 0.002 2012-12-02 [ Bug Fixes ] - use re 'eval' on Perl 5.8 to fix regexp compilation problem 0.001 2012-12-01 Initial release INSTALL000644001750001750 165313622545321 13155 0ustar00taitai000000000000MooX-late-0.100 Installing MooX-late should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm MooX::late 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 MooX::late INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan MooX::late 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 MooX-late: % 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 LICENSE000644001750001750 4365513622545321 13161 0ustar00taitai000000000000MooX-late-0.100This software is copyright (c) 2020 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) 2020 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) 2020 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 MANIFEST000644001750001750 44613622545321 13234 0ustar00taitai000000000000MooX-late-0.100COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE TODO dist.ini doap.ttl examples/simple.pl lib/MooX/late.pm t/01basic.t t/02inflation.t t/03invalid_tc.t t/04arrayofattrs.t t/05haveimissedanytypes.t t/06handlesvia.t t/07coerce1.t t/08doesrole.t META.json000644001750001750 404313622545321 13541 0ustar00taitai000000000000MooX-late-0.100{ "abstract" : "easily translate Moose code to Moo", "author" : [ "Toby Inkster (TOBYINK) " ], "dynamic_config" : 0, "generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.024, CPAN::Meta::Converter version 2.150010", "keywords" : [], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "MooX-late", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "runtime" : { "requires" : { "Moo" : "2", "Sub::HandlesVia" : "0.013", "Type::Utils" : "1.000001", "perl" : "5.008003" }, "suggests" : { "MooX" : "0" } }, "test" : { "requires" : { "Test::Fatal" : "0.010", "Test::More" : "0.96", "Test::Requires" : "0.06" } } }, "provides" : { "MooX::late" : { "file" : "lib/MooX/late.pm", "version" : "0.100" }, "MooX::late::DefinitionContext" : { "file" : "lib/MooX/late.pm", "version" : "0.100" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://rt.cpan.org/Dist/Display.html?Queue=MooX-late" }, "homepage" : "https://metacpan.org/release/MooX-late", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/tobyink/p5-moox-late.git", "web" : "https://github.com/tobyink/p5-moox-late" }, "x_identifier" : "http://purl.org/NET/cpan-uri/dist/MooX-late/project" }, "version" : "0.100", "x_serialization_backend" : "JSON::PP version 2.27400_02", "x_static_install" : 1 } META.yml000644001750001750 230613622545321 13371 0ustar00taitai000000000000MooX-late-0.100--- abstract: 'easily translate Moose code to Moo' author: - 'Toby Inkster (TOBYINK) ' build_requires: Test::Fatal: '0.010' Test::More: '0.96' Test::Requires: '0.06' configure_requires: ExtUtils::MakeMaker: '6.17' dynamic_config: 0 generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.024, CPAN::Meta::Converter version 2.150010' keywords: [] license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: MooX-late no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: MooX::late: file: lib/MooX/late.pm version: '0.100' MooX::late::DefinitionContext: file: lib/MooX/late.pm version: '0.100' requires: Moo: '2' Sub::HandlesVia: '0.013' Type::Utils: '1.000001' perl: '5.008003' resources: Identifier: http://purl.org/NET/cpan-uri/dist/MooX-late/project bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=MooX-late homepage: https://metacpan.org/release/MooX-late license: http://dev.perl.org/licenses/ repository: git://github.com/tobyink/p5-moox-late.git version: '0.100' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' x_static_install: 1 Makefile.PL000644001750001750 1254113622545321 14114 0ustar00taitai000000000000MooX-late-0.100use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "easily translate Moose code to Moo", "author" => ["Toby Inkster (TOBYINK) "], "dynamic_config" => 0, "generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.024, CPAN::Meta::Converter version 2.150010", "keywords" => [], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "MooX-late", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } }, runtime => { requires => { "Moo" => 2, "perl" => 5.008003, "Sub::HandlesVia" => 0.013, "Type::Utils" => 1.000001, }, suggests => { MooX => 0 }, }, test => { requires => { "Test::Fatal" => "0.010", "Test::More" => 0.96, "Test::Requires" => 0.06, }, }, }, "provides" => { "MooX::late" => { file => "lib/MooX/late.pm", version => "0.100" }, "MooX::late::DefinitionContext" => { file => "lib/MooX/late.pm", version => "0.100" }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "http://rt.cpan.org/Dist/Display.html?Queue=MooX-late" }, homepage => "https://metacpan.org/release/MooX-late", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", url => "git://github.com/tobyink/p5-moox-late.git", web => "https://github.com/tobyink/p5-moox-late", }, x_identifier => "http://purl.org/NET/cpan-uri/dist/MooX-late/project", }, "version" => "0.100", "x_static_install" => 1, }; my %dynamic_config; 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); README000644001750001750 735213622545321 13006 0ustar00taitai000000000000MooX-late-0.100NAME MooX::late - easily translate Moose code to Moo SYNOPSIS package Foo; use Moo; use MooX::late; has bar => (is => "ro", isa => "Str", default => "MacLaren's Pub"); (Examples for Moo roles in section below.) DESCRIPTION Moo is a light-weight object oriented programming framework which aims to be compatible with Moose. It does this by detecting when Moose has been loaded, and automatically "inflating" its classes and roles to full Moose classes and roles. This way, Moo classes can consume Moose roles, Moose classes can extend Moo classes, and so forth. However, the surface syntax of Moo differs somewhat from Moose. For example the `isa` option when defining attributes in Moose must be either a string or a blessed Moose::Meta::TypeConstraint object; but in Moo must be a coderef. These differences in surface syntax make porting code from Moose to Moo potentially tricky. MooX::late provides some assistance by enabling a slightly more Moosey surface syntax. MooX::late does the following: 1. Supports `isa => $stringytype`. 2. Supports `does => $rolename` . 3. Supports `lazy_build => 1`. 4. Exports `blessed` and `confess` functions to your namespace. 5. Handles native attribute traits. Five features. It is not the aim of `MooX::late` to make every aspect of Moo behave exactly identically to Moose. It's just going after the low-hanging fruit. So it does five things right now, and I promise that future versions will never do more than seven. Previous releases of MooX::late added support for `coerce => 1` and `default => $nonref`. These features have now been added to Moo itself, so MooX::late no longer has to deal with them. Use in Moo::Roles MooX::late should work in Moo::Roles, with no particular caveats. package MyRole; use Moo::Role; use MooX::late; Package::Variant can be used to build the Moo equivalent of parameterized roles. MooX::late should work in roles built with Package::Variant. use Package::Variant importing => [ qw( Moo::Role MooX::late ) ], subs => [ qw( has with ) ]; Type constraints Type constraint strings are interpreted using Type::Parser, using the type constraints defined in Types::Standard. This provides a very slight superset of Moose's type constraint syntax and built-in type constraints. Any unrecognized string that looks like it might be a class name is interpreted as a class type constraint. Subclassing MooX::late is designed to be reasonably easy to subclass. There are comments in the source code explaining hooks for extensibility. BUGS Please report any bugs to . SEE ALSO `MooX::late` uses Types::Standard to check type constraints. `MooX::late` uses Sub::HandlesVia to provide native attribute traits support. The following modules bring additional Moose functionality to Moo, beyond what MooX::late offers: * MooX::Override - support override/super * MooX::Augment - support augment/inner MooX allows you to load Moo plus multiple MooX extension modules in a single line. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE This software is copyright (c) 2012-2014, 2019 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. SIGNATURE000644001750001750 515513622545321 13411 0ustar00taitai000000000000MooX-late-0.100This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.83. 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 SHA256 beac6359d2a8a70a0c42b71da2f09cdd48ef7bc7e1cc9e8f4509f9848b89ca8b COPYRIGHT SHA256 35795e85f02fc4eec1af1364cf51526995f8c5adea2d2e8ab3d611b8c70d99e6 CREDITS SHA256 922dd0a79bda733be98e002d8ee8afa1f51fdc329630d32c6ed30f80a7eb5b9f Changes SHA256 a98b2208794d53deb2af287f35deed21647371ae78af4cbf3f6cd945f6d90b22 INSTALL SHA256 1fb7395e76eabf94c421912d7d0a4f7fa745d49e1acb76b222c21d605b66bd25 LICENSE SHA256 e79950c0837b90af65b83fef54d7b9fb48021a7e52a31ccff04409c5b46e3da8 MANIFEST SHA256 cb6d92c86db9aec63c0cda643389ddb341aac22fa818213782888fc349a7bad4 META.json SHA256 05b0faa01e45f547a620df325e9f0312f5a97eb840540d8ec06edb47e7c8d4d0 META.yml SHA256 39e3410163b3fc231f90718c315a2bf8ecd7fbfd937ca3f6c30ad33df9d23067 Makefile.PL SHA256 896c783da68fe4bb358d2f9892853b5dc63ddea354233f72754a766e64bcfe0a README SHA256 ff79e4feb9cfeddbc099115b77be1abf2e240dba0f4ec554460173e0210da32f TODO SHA256 40039583fc614bf541b8baf55486d94d0657de005e6f65eddf2380cca65d66a4 dist.ini SHA256 675fc70a99f87e93a367e4ea5e3b9517a2487caa069586d32da3d00982d44bb2 doap.ttl SHA256 fd5a86026a4b9164df263f73105d3009c0b40a85add10dfe1758c98f64fcb0e8 examples/simple.pl SHA256 9df04acba5532dfb1cd70b42f5d5979cf8ee35a8c461d865ce581268e027536a lib/MooX/late.pm SHA256 90f11804e31842863805fc0fa7269e72e35fb70f32adc02d98345354a54db4a7 t/01basic.t SHA256 2e70beacdcf5c0c90a79e0983a22a43ca6a0ab149f21c1b56929a175820b9abc t/02inflation.t SHA256 6d5c652f9fa925fe24f706498368db6c5778e15c46fdfb6aad33d2c2fa95bc1b t/03invalid_tc.t SHA256 230ac3a8904b187263b8f612eec014b5c36d90c7e3e4192aa1a8eda51df046d1 t/04arrayofattrs.t SHA256 12f16b2870e2704ea6145e8de3e9b8b9a3c795347034bae58dfbf8624bf9c132 t/05haveimissedanytypes.t SHA256 519537ef84d80d1642f140596313765307e9e677940e5fd0c00f0b6fa6b03bd9 t/06handlesvia.t SHA256 b9aa6f1471d2c26c029379d22a13f975a73551ff6efa2811894f98ebef867fdb t/07coerce1.t SHA256 8ccdb0f39149ba22a08198b4dfc957b5b7cad3e1fc0674b748b5babdfc90b28a t/08doesrole.t -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQRVJKj/4+s6z4WzNujOv4Eoaip9OQUCXkrK0QAKCRDOv4Eoaip9 OQ4kAKCQ4ATGV9202bPxB295HoceMSpJUgCgiSEPZHRRwJS2aVwA1hEVbvEmAJE= =zDbo -----END PGP SIGNATURE----- TODO000644001750001750 22713622545321 12570 0ustar00taitai000000000000MooX-late-0.100- make (handles => $rolename) work for Moo classes consuming Moose roles. - mst has given me the go-ahead to do this in Moo directly rather than here dist.ini000644001750001750 14613622545321 13544 0ustar00taitai000000000000MooX-late-0.100; Configuration file for Dist::Inkt ; ;; class = 'Dist::Inkt::Profile::TOBYINK' ;; name = 'MooX-late' doap.ttl000644001750001750 3560713622545321 13622 0ustar00taitai000000000000MooX-late-0.100@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:runtime-requirement [ doap-deps:on "perl 5.008003"^^doap-deps:CpanId ], [ doap-deps:on "Moo 2"^^doap-deps:CpanId ], [ doap-deps:on "Type::Utils 1.000001"^^doap-deps:CpanId; ], [ doap-deps:on "Sub::HandlesVia 0.013"^^doap-deps:CpanId; ]; doap-deps:runtime-suggestion [ doap-deps:on "MooX"^^doap-deps:CpanId ]; doap-deps:test-requirement [ doap-deps:on "Test::More 0.96"^^doap-deps:CpanId ], [ doap-deps:on "Test::Requires 0.06"^^doap-deps:CpanId; ], [ doap-deps:on "Test::Fatal 0.010"^^doap-deps:CpanId ]; doap:bug-database ; doap:created "2012-11-30"^^xsd:date; doap:developer ; doap:download-page ; doap:homepage ; doap:license ; doap:maintainer ; doap:name "MooX-late"; doap:programming-language "Perl"; doap:release , , , , , , , , , , , , , , , , ; doap:repository [ a doap:GitRepository; doap:browse ; ]; doap:shortdesc "easily translate Moose code to Moo". a doap:Version; rdfs:label "Initial release"; dc:identifier "MooX-late-0.001"^^xsd:string; dc:issued "2012-12-01"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.001"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.002"^^xsd:string; dc:issued "2012-12-02"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "use re 'eval' on Perl 5.8 to fix regexp compilation problem"; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.002"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.003"^^xsd:string; dc:issued "2012-12-02"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Inflation of type constraints to Moose."; ], [ a doap-changeset:Change; rdfs:label "Use MooX::Types::MooseLike::Base for type checks."; ], [ a doap-changeset:Change; rdfs:label "General refactoring of type constraint code."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.003"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.004"^^xsd:string; dc:issued "2012-12-03"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Issue warnings when type constraint cannot be interpreted correctly. Warning is not issued at the time the attribute is built, but the first time the type constraint is checked against. Don't attempt to inflate these type constraints when Moose is loaded."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.004"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.005"^^xsd:string; dc:issued "2012-12-09"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Bump required version of Moo to 1.000004."; ], [ a doap-changeset:Documentation; rdfs:label "Document test suite."; ], [ a doap-changeset:Bugfix; rdfs:label "Cope with has \\@attributes => (...)."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.005"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.006"^^xsd:string; dc:issued "2012-12-11"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Skip t/02inflation.t if no MooX::Types::MooseLike::Base."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.006"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.007"^^xsd:string; dc:issued "2012-12-26"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Link to MooX::HandlesVia on github."; ], [ a doap-changeset:Documentation; rdfs:label "Documentation for use with Moo::Role."; doap-changeset:thanks ; rdfs:seeAlso ; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.007"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.008"^^xsd:string; dc:issued "2013-03-11"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Minor documentation updates."; ], [ a doap-changeset:Packaging; rdfs:label "Make MooX::Types::MooseLike::Base a required dependency (was optional)."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.008"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.009"^^xsd:string; dc:issued "2013-04-15"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Switch from MooX::Types::MooseLike::Base to Types::Standard."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.009"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.010"^^xsd:string; dc:issued "2013-04-23"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix support for Maybe[`a] type constraint. (It was being interpreted as an object blessed into package 'Maybe'.)"; doap-changeset:fixes [ doap-bugs:affects ; doap-bugs:reporter ; ]; doap-changeset:thanks ; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.010"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.011"^^xsd:string; dc:issued "2013-04-27"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Bugfix; rdfs:label "Fix support for class types."; doap-changeset:fixes [ doap-bugs:affects , ; doap-bugs:reporter ; ]; doap-changeset:thanks ; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.011"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.012"^^xsd:string; dc:issued "2013-06-28"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Use Type::Registry/Type::Parser to translate strings to type constraint expressions."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.012"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.013"^^xsd:string; dc:issued "2013-07-16"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Update; rdfs:label "Use Type::Utils::dwim_type to translate strings to type constraint expressions."; ], [ a doap-changeset:Addition; rdfs:label "Support Moose attribute traits using MooX::HandlesVia."; ], [ a doap-changeset:Removal; rdfs:label "Retire support for non-reference attribute defaults because Moo now does this natively."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.013"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.014"^^xsd:string; dc:issued "2013-07-16"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Support `coerce => 1` for Type::Tiny type constraints and those providing a similar API."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.014"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.015"^^xsd:string; dc:issued "2014-08-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Documentation; rdfs:label "Make the list of stuff this module does more concise."; ], [ a doap-changeset:Removal; rdfs:label "Drop support for `coerce => 1` because Moo 1.006000 supports this natively now."; ], [ a doap-changeset:Packaging; rdfs:label "Depend on Type::Utils 1.000001."; ], [ a doap-changeset:Packaging; rdfs:label "Depend on Moo 1.006000."; ], [ a doap-changeset:Tests; rdfs:label "Improve test cases for class type constraints."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.015"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.016"^^xsd:string; dc:issued "2019-11-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Tests; rdfs:label "Get test suite passing and stuff."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.016"^^xsd:string. a doap:Version; dc:identifier "MooX-late-0.100"^^xsd:string; dc:issued "2020-02-17"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Use Sub::HandlesVia instead of MooX::HandlesVia; less translation needed because Sub::HandlesVia already understands Moose-like syntax; plus it covers more datatypes and methods."; ], [ a doap-changeset:Packaging; rdfs:label "Make Sub::HandlesVia a required dependency."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.100"^^xsd:string. a foaf:Person; foaf:nick "SHLOMIF"; foaf:page . a foaf:Person; foaf:mbox ; foaf:name "Toby Inkster"; foaf:nick "TOBYINK"; foaf:page . simple.pl000644001750001750 20213622545321 15535 0ustar00taitai000000000000MooX-late-0.100/examplespackage Foo; use Moo; use MooX::late; has bar => (is => 'ro', isa => 'Str|ArrayRef[Int|Num]|Int'); Foo->new(bar => [1, '2o', 3]) 01basic.t000644001750001750 224313622545321 13772 0ustar00taitai000000000000MooX-late-0.100/t=head1 PURPOSE Check that basic usage of MooX::late works. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2012-2014, 2019 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; { package Local::Role; use Moo::Role; use MooX::late; has foo => (is => 'ro', isa => 'Str', default => 'foo'); } { package Local::Class; use Moo; use MooX::late; with 'Local::Role'; has bar => (is => 'ro', isa => 'Str', default => 'bar'); } my $o1 = Local::Class->new; is($o1->foo, 'foo'); is($o1->bar, 'bar'); my $o2 = Local::Class->new(foo => 'bar', bar => 'foo'); is($o2->foo, 'bar'); is($o2->bar, 'foo'); ok not eval { Local::Class->new(foo => []); }; ok not eval { Local::Class->new(bar => []); }; { package Local::Other; use Moo; use MooX::late; has foo => (is => 'ro', lazy_build => 1); sub _build_foo { 'foo' }; } my $o = Local::Other->new; ok( not $o->has_foo ); is( $o->foo, 'foo' ); ok( $o->has_foo ); $o->clear_foo; ok( not $o->has_foo ); done_testing; 02inflation.t000644001750001750 162213622545321 14675 0ustar00taitai000000000000MooX-late-0.100/t=head1 PURPOSE Check that our type constraints are correctly inflated to Moose type constraints. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2012-2014, 2019 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 { package Local::Class; use Moo; use MooX::late; has foo => (is => 'ro', isa => 'Str', default => 'foo'); }; my $isa = "Moo"->_constructor_maker_for("Local::Class")->all_attribute_specs->{foo}{isa}; note explain($isa); ok not eval { my $obj = "Local::Class"->new(foo => []) }; eval { require Moose; my $foo = "Local::Class"->meta->get_attribute('foo'); note explain($foo->type_constraint); is( $foo->type_constraint->name, 'Str', ); }; done_testing; 03invalid_tc.t000644001750001750 140113622545321 15022 0ustar00taitai000000000000MooX-late-0.100/t=head1 PURPOSE Check that we get error messages about unrecognisable type constraints. Test skipped on Perl < 5.14 because idek. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2012-2014, 2019 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 '5.014000'; use Test::Fatal; my $e; { package Foo; use Moo; use MooX::late; $e = ::exception { has foo => (is => 'ro', isa => 'X Y Z', required => 0); }; }; #diag($e); like( $e, qr{^Unexpected tail on type expression: Y Z}, 'error message looks ok', ); done_testing; 04arrayofattrs.t000644001750001750 176013622545321 15440 0ustar00taitai000000000000MooX-late-0.100/t=head1 PURPOSE Test that this works: has \@attributes => (...); Specifically we test is for C as that's a kinda interesting one. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2012-2014, 2019 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; { package Local::Role; use Moo::Role; use MooX::late; has [qw(foo1 foo2)] => (is => 'ro', isa => 'Str', lazy_build => 1); sub _build_foo1 { 'foo1' }; sub _build_foo2 { 'foo2' }; } { package Local::Class; use Moo; use MooX::late; with 'Local::Role'; has [qw(bar1 bar2)] => (is => 'ro', isa => 'Str', lazy_build => 1); sub _build_bar1 { 'bar1' }; sub _build_bar2 { 'bar2' }; } my $o1 = Local::Class->new; is($o1->foo1, 'foo1'); is($o1->foo2, 'foo2'); is($o1->bar1, 'bar1'); is($o1->bar2, 'bar2'); done_testing; 05haveimissedanytypes.t000644001750001750 371113622545321 17014 0ustar00taitai000000000000MooX-late-0.100/t=pod =head1 PURPOSE Test that all Moose's built-in type constraints are correctly parsed. =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 Test::More; require Moo; my @types_to_check = qw( Any Item Bool Maybe Maybe[Int] Undef Defined Value Str Num Int ClassName RoleName Ref ScalarRef ScalarRef[Int] ArrayRef ArrayRef[Int] HashRef HashRef[Int] CodeRef RegexpRef GlobRef FileHandle Object Int|ArrayRef[Int] ArrayRef[Int|HashRef[Int]] ArrayRef[HashRef[Int]|Int] ArrayRef[HashRef[Int]]|Int ); my @class_types_to_check = qw( Local::Test1 Local::Test::Two LocalTest3 ); my $count = 0; sub constraint_for { my $type = shift; # Note that this will cause Local::Test1 to exist. # We later use that in a @class_types_to_check test. # my $class = "Local::Test" . ++$count; eval qq{ package $class; use Moo; use MooX::late; has attr => (is => "ro", isa => "$type"); 1; } or diag($@); "Moo"->_constructor_maker_for($class)->all_attribute_specs->{attr}{isa}; } for my $type (@types_to_check) { my $got = constraint_for($type); isa_ok($got, "Type::Tiny", "constraint_for('$type')"); is("$got", "$type", "Type constraint returned for '$type' looks right."); } for my $type (@class_types_to_check) { my $got = constraint_for($type); isa_ok($got, "Type::Tiny::Class", "constraint_for('$type')"); is($got && $got->class, $type, "Type constraint returned for '$type' looks right."); } { my $type = 'ArrayRef[Local::Test1]'; my $got = constraint_for($type); isa_ok($got, "Type::Tiny", "constraint_for('$type')"); is( $got && $got->type_parameter && $got->type_parameter->class, "Local::Test1", "Type constraint returned for '$type' looks right" ); } done_testing; 06handlesvia.t000644001750001750 234513622545321 15037 0ustar00taitai000000000000MooX-late-0.100/t=head1 PURPOSE See if L support works. =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 Test::More; use Test::Requires { "MooX::HandlesVia" => "0.001004" }; { package Local::ThingyContainer; use Moo; use MooX::late; has _thingies => ( traits => ['Array'], is => 'ro', isa => 'ArrayRef[Str]', default => sub { [] }, handles => { all => 'elements', add => 'push', count => 'count', }, ); } { package Local::Foo; use Moo; use MooX::late; has code => ( traits => ['Code'], is => 'ro', isa => 'CodeRef', handles => { e => 'execute', em => 'execute_method', }, ); } my $c = 'Local::ThingyContainer'->new; is($c->count, 0); $c->add(qw/ Foo Bar Baz /); $c->add(qw/ Quux /); is($c->count, 4); is_deeply( [ $c->all ], [qw/ Foo Bar Baz Quux /], ); my $x = 'Local::Foo'->new(code => sub { [@_] }); is_deeply( $x->e(1..3), [1..3], ); is_deeply( $x->em(1..3), [$x, 1..3], ); done_testing; 07coerce1.t000644001750001750 145113622545321 14240 0ustar00taitai000000000000MooX-late-0.100/t=head1 PURPOSE See if C<< coerce => 1 >> works. =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 Test::More; use Test::Fatal; use Types::Standard qw( Int Num ); my $Int = Int->plus_coercions( Num, q{int($_)} ); { package Foo; use Moo; use MooX::late; has attr => (is => 'ro', isa => $Int, coerce => 1); } is( Foo->new(attr => 3.14159)->attr, 3, ); #like( # exception { # package Bar; # use Moo; use MooX::late; # has attr => (is => 'ro', isa => $Int->no_coercions, coerce => 1); # }, # qr{^Invalid coerce '1'}, #); done_testing; 08doesrole.t000644001750001750 143513622545321 14536 0ustar00taitai000000000000MooX-late-0.100/t=pod =encoding utf-8 =head1 PURPOSE See if C<< does => $rolename >> works. =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 Test::More; use Test::Fatal; { package Bar; use Moo::Role; } { package Foo::Bar; use Moo; with 'Bar'; } { package Foo::Baz; use Moo; } { package Quux; use Moo; use MooX::late; has xxx => (is => 'ro', does => 'Bar'); } is( exception { Quux->new(xxx => Foo::Bar->new) }, undef, ); like( exception { Quux->new(xxx => Foo::Baz->new) }, qr/did not pass type constraint/, ); done_testing; late.pm000644001750001750 1764113622545321 15063 0ustar00taitai000000000000MooX-late-0.100/lib/MooXuse 5.008; use strict; use warnings; package MooX::late; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.100'; use Moo qw( ); use Carp qw( carp croak ); use Scalar::Util qw( blessed ); use Module::Runtime qw( is_module_name ); BEGIN { package MooX::late::DefinitionContext; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.100'; use Moo; use overload ( q[""] => 'to_string', q[bool] => sub { 1 }, fallback => 1, ); has package => (is => 'ro'); has filename => (is => 'ro'); has line => (is => 'ro'); sub to_string { my $self = shift; sprintf( '%s:%d, package %s', $self->filename, $self->line, $self->package, ); } sub new_from_caller { my ($class, $level) = @_; $level = 0 unless defined $level; my ($p, $f, $c) = caller($level + 1); return $class->new( package => $p, filename => $f, line => $c, ); } }; # SUBCLASSING # This is a hook for people subclassing MooX::late. # It should be easy to tack on your own handlers # to the end of the list. A handler is only called # if exists($spec{$handler_name}) in the attribute # spec. # sub _handlers { qw( isa does lazy_build ); } # SUBCLASSING # Not really sure why you'd want to override # this. # sub _definition_context_class { "MooX::late::DefinitionContext"; } sub import { my $me = shift; my $caller = caller; require Sub::HandlesVia; require Sub::HandlesVia::Toolkit::Moo; 'Sub::HandlesVia::Toolkit::Moo'->setup_for($caller); my $install_tracked; { no warnings; if ($Moo::MAKERS{$caller}) { $install_tracked = \&Moo::_install_tracked; } elsif ($Moo::Role::INFO{$caller}) { $install_tracked = \&Moo::Role::_install_tracked; } else { croak "MooX::late applied to a non-Moo package" . "(need: use Moo or use Moo::Role)"; } } my $orig = $caller->can('has') # lolcat or croak "Could not locate 'has' function to alter"; my @handlers = $me->_handlers; # SUBCLASSING # MooX::late itself does not provide a # `_finalize_attribute` method. Your subclass # can, in which case it will be called right # before setting up the attribute. # my $finalize = $me->can("_finalize_attribute"); $install_tracked->( $caller, has => sub { my ($proto, %spec) = @_; my $context = $me->_definition_context_class->new_from_caller(0); for my $name (ref $proto ? @$proto : $proto) { my $spec = +{ %spec }; # shallow clone for my $option (@handlers) { next unless exists $spec->{$option}; my $handler = $me->can("_handle_$option"); # SUBCLASSING # Note that handlers are called as methods, and # get passed: # 1. the attribute name # 2. the attribute spec (hashref, modifiable) # 3. a context object # 4. the name of the caller class/role # $me->$handler($name, $spec, $context, $caller); } $me->$finalize($name, $spec, $context, $caller) if $finalize; $orig->($name, %$spec); } return; }, ); $me->_install_sugar($caller, $install_tracked); } # SUBCLASSING # This can be used to install additional functions # into the caller package. # sub _install_sugar { my $me = shift; my ($caller, $installer) = @_; $installer->($caller, blessed => \&Scalar::Util::blessed); $installer->($caller, confess => \&Carp::confess); } sub _handle_isa { my $me = shift; my ($name, $spec, $context, $class) = @_; return if ref $spec->{isa}; require Type::Utils; $spec->{isa} = Type::Utils::dwim_type($spec->{isa}, for => $class); return; } sub _handle_does { my $me = shift; my ($name, $spec, $context, $class) = @_; return unless defined $spec->{does}; require Types::Standard; $spec->{isa} = Types::Standard::ConsumerOf()->of($spec->{does}); return; } sub _handle_lazy_build { my $me = shift; my ($name, $spec, $context, $class) = @_; return unless delete $spec->{lazy_build}; $spec->{is} ||= "ro"; $spec->{lazy} ||= 1; $spec->{builder} ||= "_build_$name"; if ($name =~ /^_/) { $spec->{clearer} ||= "_clear$name"; $spec->{predicate} ||= "_has$name"; } else { $spec->{clearer} ||= "clear_$name"; $spec->{predicate} ||= "has_$name"; } return; } 1; __END__ =pod =encoding utf8 =for stopwords superset MooX =head1 NAME MooX::late - easily translate Moose code to Moo =head1 SYNOPSIS package Foo; use Moo; use MooX::late; has bar => (is => "ro", isa => "Str", default => "MacLaren's Pub"); (Examples for Moo roles in section below.) =head1 DESCRIPTION L is a light-weight object oriented programming framework which aims to be compatible with L. It does this by detecting when Moose has been loaded, and automatically "inflating" its classes and roles to full Moose classes and roles. This way, Moo classes can consume Moose roles, Moose classes can extend Moo classes, and so forth. However, the surface syntax of Moo differs somewhat from Moose. For example the C option when defining attributes in Moose must be either a string or a blessed L object; but in Moo must be a coderef. These differences in surface syntax make porting code from Moose to Moo potentially tricky. L provides some assistance by enabling a slightly more Moosey surface syntax. MooX::late does the following: =over =item 1. Supports C<< isa => $stringytype >>. =item 2. Supports C<< does => $rolename >> . =item 3. Supports C<< lazy_build => 1 >>. =item 4. Exports C and C functions to your namespace. =item 5. Handles native attribute traits. =back Five features. It is not the aim of C to make every aspect of Moo behave exactly identically to Moose. It's just going after the low-hanging fruit. So it does five things right now, and I promise that future versions will never do more than seven. Previous releases of MooX::late added support for C<< coerce => 1 >> and C<< default => $nonref >>. These features have now been added to Moo itself, so MooX::late no longer has to deal with them. =head2 Use in Moo::Roles MooX::late should work in Moo::Roles, with no particular caveats. package MyRole; use Moo::Role; use MooX::late; L can be used to build the Moo equivalent of parameterized roles. MooX::late should work in roles built with Package::Variant. use Package::Variant importing => [ qw( Moo::Role MooX::late ) ], subs => [ qw( has with ) ]; =head2 Type constraints Type constraint strings are interpreted using L, using the type constraints defined in L. This provides a very slight superset of Moose's type constraint syntax and built-in type constraints. Any unrecognized string that looks like it might be a class name is interpreted as a class type constraint. =head2 Subclassing MooX::late is designed to be reasonably easy to subclass. There are comments in the source code explaining hooks for extensibility. =head1 BUGS Please report any bugs to L. =head1 SEE ALSO C uses L to check type constraints. C uses L to provide native attribute traits support. The following modules bring additional Moose functionality to Moo, beyond what MooX::late offers: =over =item * L - support override/super =item * L - support augment/inner =back L allows you to load Moo plus multiple MooX extension modules in a single line. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2012-2014, 2019 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.