COPYRIGHT000644001750001750 264313564447041 15220 0ustar00taitai000000000000Class-Tiny-Antlers-0.024Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Class-Tiny-Antlers Upstream-Contact: Toby Inkster (TOBYINK) Source: https://metacpan.org/release/Class-Tiny-Antlers Files: t/01basic.t t/02ro-rw-rwp-bare.t t/03defaults.t t/04predicates-clearers.t t/05init_arg.t t/06required.t t/07extends.t t/08with.t t/09hygiene.t t/10modifiers.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 t/11types-moose.t t/11types-mouse.t t/11types-nano.t t/11types-specio.t t/11types.t Copyright: Copyright 2019 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: README lib/Class/Tiny/Antlers.pm Copyright: This software is copyright (c) 2013, 2019 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: INSTALL LICENSE Copyright: Unknown License: Unknown License: Artistic-1.0 This software is Copyright (c) 2019 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) 2019 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000644001750001750 7113564447040 14675 0ustar00taitai000000000000Class-Tiny-Antlers-0.024Maintainer: - Toby Inkster (TOBYINK) Changes000644001750001750 261413564447040 15215 0ustar00taitai000000000000Class-Tiny-Antlers-0.024Class-Tiny-Antlers ================== Created: 2013-08-29 Home page: Bug tracker: Maintainer: Toby Inkster (TOBYINK) 0.024 2019-11-18 - Added: Support for isa/coerce. 0.023 2014-09-18 [ Packaging ] - Add IRC link. - Add explicit dependency on Perl 5.6. - Rebuilt package with newer Dist::Inkt to resolve minor packaging issues. 0.022 2013-09-05 [ Packaging ] - Add 'test requires' dependency on Test::Requires - oh, the irony! - Demote Role::Tiny and Class::Method::Modifiers from 'runtime recommends' dependencies to 'runtime suggests', but 'test recommends'. 0.021 2013-09-05 - Actually inherit from Class::Tiny. This means that your class doesn't need to `use` both Class::Tiny and Class::Tiny::Antlers; just `use Class::Tiny::Antlers`. - Added: Optionally export `before`, `after` and `around` keywords, powered by an optional dependency on Class::Method::Modifiers. - Added: Provide a `get_all_attribute_specs_for` method for attribute introspection. - Make the dependency on Role::Tiny optional again. - Take advantage of Class::Tiny's new(ish) `create_attributes` method. - Updated: Requires Class::Tiny 0.006. 0.020 2013-08-30 - Eliminate dependency on Package::Stash. 0.019 2013-08-30 Initial release; split from Moops 0.018 INSTALL000644001750001750 173313564447040 14754 0ustar00taitai000000000000Class-Tiny-Antlers-0.024 Installing Class-Tiny-Antlers should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm Class::Tiny::Antlers 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 Class::Tiny::Antlers INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan Class::Tiny::Antlers 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 Class-Tiny-Antlers: % 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 4365513564447040 14761 0ustar00taitai000000000000Class-Tiny-Antlers-0.024This software is copyright (c) 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. 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) 2019 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) 2019 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 60213564447041 15027 0ustar00taitai000000000000Class-Tiny-Antlers-0.024COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE dist.ini doap.ttl lib/Class/Tiny/Antlers.pm t/01basic.t t/02ro-rw-rwp-bare.t t/03defaults.t t/04predicates-clearers.t t/05init_arg.t t/06required.t t/07extends.t t/08with.t t/09hygiene.t t/10modifiers.t t/11types-moose.t t/11types-mouse.t t/11types-nano.t t/11types-specio.t t/11types.t META.json000644001750001750 427113564447040 15344 0ustar00taitai000000000000Class-Tiny-Antlers-0.024{ "abstract" : "Moose-like sugar for Class::Tiny", "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" : "Class-Tiny-Antlers", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "runtime" : { "requires" : { "Class::Tiny" : "0.006", "perl" : "5.006" }, "suggests" : { "Class::Method::Modifiers" : "1.05", "Role::Tiny" : "1.000000" } }, "test" : { "recommends" : { "Class::Method::Modifiers" : "1.05", "Role::Tiny" : "1.000000", "Types::Standard" : "0" }, "requires" : { "Test::Fatal" : "0.003", "Test::More" : "0.96", "Test::Requires" : "0.06" } } }, "provides" : { "Class::Tiny::Antlers" : { "file" : "lib/Class/Tiny/Antlers.pm", "version" : "0.024" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://rt.cpan.org/Dist/Display.html?Queue=Class-Tiny-Antlers" }, "homepage" : "https://metacpan.org/release/Class-Tiny-Antlers", "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "type" : "git", "url" : "git://github.com/tobyink/p5-class-tiny-antlers.git", "web" : "https://github.com/tobyink/p5-class-tiny-antlers" }, "x_IRC" : "irc://irc.perl.org/#moops", "x_identifier" : "http://purl.org/NET/cpan-uri/dist/Class-Tiny-Antlers/project" }, "version" : "0.024", "x_serialization_backend" : "JSON::PP version 2.27400_02", "x_static_install" : 1 } META.yml000644001750001750 225013564447040 15167 0ustar00taitai000000000000Class-Tiny-Antlers-0.024--- abstract: 'Moose-like sugar for Class::Tiny' author: - 'Toby Inkster (TOBYINK) ' build_requires: Test::Fatal: '0.003' 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: Class-Tiny-Antlers no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: Class::Tiny::Antlers: file: lib/Class/Tiny/Antlers.pm version: '0.024' requires: Class::Tiny: '0.006' perl: '5.006' resources: IRC: irc://irc.perl.org/#moops Identifier: http://purl.org/NET/cpan-uri/dist/Class-Tiny-Antlers/project bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=Class-Tiny-Antlers homepage: https://metacpan.org/release/Class-Tiny-Antlers license: http://dev.perl.org/licenses/ repository: git://github.com/tobyink/p5-class-tiny-antlers.git version: '0.024' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' x_static_install: 1 Makefile.PL000644001750001750 1267613564447041 15726 0ustar00taitai000000000000Class-Tiny-Antlers-0.024use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "Moose-like sugar for Class::Tiny", "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" => "Class-Tiny-Antlers", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } }, runtime => { requires => { "Class::Tiny" => 0.006, "perl" => 5.006 }, suggests => { "Class::Method::Modifiers" => 1.05, "Role::Tiny" => "1.000000" }, }, test => { recommends => { "Class::Method::Modifiers" => 1.05, "Role::Tiny" => "1.000000", "Types::Standard" => 0, }, requires => { "Test::Fatal" => 0.003, "Test::More" => 0.96, "Test::Requires" => 0.06 }, }, }, "provides" => { "Class::Tiny::Antlers" => { file => "lib/Class/Tiny/Antlers.pm", version => 0.024 }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "http://rt.cpan.org/Dist/Display.html?Queue=Class-Tiny-Antlers", }, homepage => "https://metacpan.org/release/Class-Tiny-Antlers", license => ["http://dev.perl.org/licenses/"], repository => { type => "git", url => "git://github.com/tobyink/p5-class-tiny-antlers.git", web => "https://github.com/tobyink/p5-class-tiny-antlers", }, x_identifier => "http://purl.org/NET/cpan-uri/dist/Class-Tiny-Antlers/project", x_IRC => "irc://irc.perl.org/#moops", }, "version" => 0.024, "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 744013564447040 14604 0ustar00taitai000000000000Class-Tiny-Antlers-0.024NAME Class::Tiny::Antlers - Moose-like sugar for Class::Tiny SYNOPSIS { package Point; use Class::Tiny::Antlers; has x => (is => 'ro'); has y => (is => 'ro'); } { package Point3D; use Class::Tiny::Antlers; extends 'Point'; has z => (is => 'ro'); } DESCRIPTION Class::Tiny::Antlers provides Moose-like `has`, `extends`, `with`, `before`, `after` and `around` keywords for Class::Tiny. (The `with` keyword requires Role::Tiny; method modifiers require Class::Method::Modifiers.) Class::Tiny doesn't support all Moose's attribute options; `has` should throw you an error if you try to do something it doesn't support (like triggers). Class::Tiny::Antlers does however hack in support for `is => 'ro'` and Moo-style `is => 'rwp'`, clearers and predicates. From version 0.24, Class::Tiny::Antlers also adds support for `isa` and `coerce` using Type::Tiny. (I mean, this is a TOBYINK module, so what do you expect?!) Technically MooseX::Types, MouseX::Types, Specio, and Type::Nano should work, but these are less tested. Export By default, Class::Tiny::Antlers exports `has`, `with` and `extends`, and also imports strict into its caller. You can optionally also import `confess` and warnings: use Class::Tiny::Antlers qw( -default confess warnings ); And Class::Method::Modifiers keywords: use Class::Tiny::Antlers qw( -default before after around ); use Class::Tiny::Antlers qw( -default -cmm ); # same thing If you just want everything: use Class::Tiny::Antlers qw( -all ); Class::Tiny::Antlers also ensures that Class::Tiny's import method is called for your class. You can put a `no Class::Tiny::Antlers` statement at the end of your class definition to wipe the imported functions out of your namespace. (This does not unimport strict/warnings though.) To clean up your namespace more thoroughly, use something like namespace::sweep. Functions `has $attr, %spec` Create an attribute. The specification hash roughly supports `is`, `default`, `clearer` and `predicate` as per Moose and Moo. `extends @classes` Set the base class(es) for your class. `with @roles` Compose Role::Tiny roles with your class. `before $name, \&code` Install a `before` modifier using Class::Method::Modifiers. `after $name, \&code` Install a `after` modifier using Class::Method::Modifiers. `around $name, \&code` Install a `around` modifier using Class::Method::Modifiers. `confess $format, @list` `sprintf`-fueled version of Carp's `confess`. Methods Class::Tiny::Antlers inherits the `get_all_attributes_for` and `get_all_attribute_defaults_for` methods from Class::Tiny, and also provides: `Class::Tiny::Antlers->get_all_attribute_specs_for($class)` Gets Moose-style attribute specification hashes for all the class' attributes as a big hashref. (Includes inherited attributes.) BUGS Please report any bugs to . SEE ALSO Class::Tiny, Role::Tiny, Class::Method::Modifiers, Type::Tiny::Manual. Moose, Mouse, Moo. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE This software is copyright (c) 2013, 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 606113564447041 15207 0ustar00taitai000000000000Class-Tiny-Antlers-0.024This 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 f90153cd031649f80257ec9de85890fab70f200551a39ce79f32bfa56d6bca5a COPYRIGHT SHA256 7977c02e031153dc91d6db9d2e803671d586e59bca2c5c3dc6211f29c04d92d6 CREDITS SHA256 0d8d9b6b6a4a07c48413aea6268501a70f4998b63f7caffdf8acdf346ff89599 Changes SHA256 0180ef6a1ed1dd8e25a5cb593409e8314e778d7d52569f7ad3321e4c5a7aeb70 INSTALL SHA256 5c791221f0dde289392a38a5921b66d4a1be8248cc64ee6de15f3c2426892673 LICENSE SHA256 7065506e916467a217959ec92099123e6792f04f71779f2d456513100b44e57a MANIFEST SHA256 cd9441dbfbee5e979dc5b741f151fe6628f46d96e73e8cbab1effa47315e23d0 META.json SHA256 eda2e7a0db0a94859c4f510ebf6d6d9a802335400a7b67c3f343b9eaaf392496 META.yml SHA256 9c51205e2661651e2348f244d9ca15e8d3eef754e8184233896056c6cf6c53ac Makefile.PL SHA256 f250185e5e676d67f73d7a1d9f8ed52a0ab27c5b1d6e304cc7addf7d4a06e372 README SHA256 bfbb6b67a2a410792bd595a3678e2ab8df37b4dc254d8ccfb68a1ae7912a7c56 dist.ini SHA256 c95eacae8f4eb622f924a6f3187ef492e96497784951d350e5a7dbaf0db67d36 doap.ttl SHA256 2746c8ab648e5b08ca31202af513466d6bde0830c2f9b3c282e30bcad0277703 lib/Class/Tiny/Antlers.pm SHA256 7ab96573a3184156970b18a9bb0e1a3cd5dac77724fde767d772b8251258bf05 t/01basic.t SHA256 4a292e54c4b93f49448a2b8e89821c772c2c3d2931aa699cfbc907f071e43123 t/02ro-rw-rwp-bare.t SHA256 1ef0841cc7fb1811954b47eeaeaddb0ee5d2a86e660853b190afb694a8d930a2 t/03defaults.t SHA256 1458b7029d0527b74ca4199873b88ba4de71aa723b083b7811c12d8d43376717 t/04predicates-clearers.t SHA256 cb09b1fa5654f0b01b991970e318d61af52b682adc902f27b247ccb0c732de41 t/05init_arg.t SHA256 5c0e3c68698c92eccca6afd5e37d8d42b44b336466580aff46ee930698cde488 t/06required.t SHA256 f5c0f227a540a32e05a3886d4b164df15f1c81ebeeb2c9acfcf580273661bc2c t/07extends.t SHA256 4796953457a7fb39f6e58450ee61536662cccd402f89d284edd8e9e34ae469be t/08with.t SHA256 79d826bd617a167a13fefc4450e6e511489fc33f9dbf790a92f22d839009e3cf t/09hygiene.t SHA256 b8eb86e2062f3bf10e270cfd0c635ffe170127e30cc1bbf0afc55727f6ffd5bb t/10modifiers.t SHA256 1d6e41a4586382536078380c72cc1ebab1a436a8520485c20d2f52fce71874c1 t/11types-moose.t SHA256 fa1c490d6a8a90d7a724eabc4a39869fc62b3b406fb76e0cdb1d9accf360bce2 t/11types-mouse.t SHA256 7ce09b849bd46be448ba7851aebab69174cdd2b1b79852fb3f31518640b943f8 t/11types-nano.t SHA256 41c833efd0283ec658c813e78e678040a6f9d3a960fa77efc2657a5db82bb959 t/11types-specio.t SHA256 fd2996b18988a9895bb815c5f0d0fa8d97a38b71af2dcc46582bf329bd7fe944 t/11types.t -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQRVJKj/4+s6z4WzNujOv4Eoaip9OQUCXdJOIQAKCRDOv4Eoaip9 OboUAJ9RkXptQZvKcljDWCA5X/B95z4tZACdEKAV/JZ+oAwIfC1vD8DCycC8CpI= =zZOM -----END PGP SIGNATURE----- dist.ini000644001750001750 10413564447040 15336 0ustar00taitai000000000000Class-Tiny-Antlers-0.024;;class='Dist::Inkt::Profile::TOBYINK' ;;name='Class-Tiny-Antlers' doap.ttl000644001750001750 1633713564447040 15421 0ustar00taitai000000000000Class-Tiny-Antlers-0.024@prefix cpan-uri: . @prefix dc: . @prefix doap: . @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; cpan-uri:x_IRC ; dc:contributor ; doap-deps:runtime-requirement [ doap-deps:on "perl 5.006"^^doap-deps:CpanId ], [ doap-deps:on "Class::Tiny 0.006"^^doap-deps:CpanId ]; doap-deps:runtime-suggestion [ doap-deps:on "Role::Tiny 1.000000"^^doap-deps:CpanId; ], [ doap-deps:on "Class::Method::Modifiers 1.05"^^doap-deps:CpanId; ]; doap-deps:test-recommendation [ doap-deps:on "Role::Tiny 1.000000"^^doap-deps:CpanId; ], [ doap-deps:on "Class::Method::Modifiers 1.05"^^doap-deps:CpanId; ], [ doap-deps:on "Types::Standard"^^doap-deps:CpanId ]; doap-deps:test-requirement [ doap-deps:on "Test::More 0.96"^^doap-deps:CpanId ], [ doap-deps:on "Test::Fatal 0.003"^^doap-deps:CpanId ], [ doap-deps:on "Test::Requires 0.06"^^doap-deps:CpanId; ]; doap:bug-database ; doap:created "2013-08-29"^^xsd:date; doap:developer ; doap:download-page ; doap:homepage ; doap:license ; doap:maintainer ; doap:name "Class-Tiny-Antlers"; doap:programming-language "Perl"; doap:release , , , , , ; doap:repository [ a doap:GitRepository; doap:browse ; ]; doap:shortdesc "Moose-like sugar for Class::Tiny". a doap:Version; rdfs:label "Initial release; split from Moops 0.018"; dc:identifier "Class-Tiny-Antlers-0.019"^^xsd:string; dc:issued "2013-08-30"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.019"^^xsd:string. a doap:Version; dc:identifier "Class-Tiny-Antlers-0.020"^^xsd:string; dc:issued "2013-08-30"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Eliminate dependency on Package::Stash."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.020"^^xsd:string. a doap:Version; dc:identifier "Class-Tiny-Antlers-0.021"^^xsd:string; dc:issued "2013-09-05"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Make the dependency on Role::Tiny optional again."; ], [ a doap-changeset:Update; rdfs:label "Requires Class::Tiny 0.006."; ], [ a doap-changeset:Change; rdfs:label "Actually inherit from Class::Tiny. This means that your class doesn't need to `use` both Class::Tiny and Class::Tiny::Antlers; just `use Class::Tiny::Antlers`."; ], [ a doap-changeset:Addition; rdfs:label "Provide a `get_all_attribute_specs_for` method for attribute introspection."; ], [ a doap-changeset:Addition; rdfs:label "Optionally export `before`, `after` and `around` keywords, powered by an optional dependency on Class::Method::Modifiers."; ], [ a doap-changeset:Change; rdfs:label "Take advantage of Class::Tiny's new(ish) `create_attributes` method."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.021"^^xsd:string. a doap:Version; dc:identifier "Class-Tiny-Antlers-0.022"^^xsd:string; dc:issued "2013-09-05"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Add 'test requires' dependency on Test::Requires - oh, the irony!"; ], [ a doap-changeset:Packaging; rdfs:label "Demote Role::Tiny and Class::Method::Modifiers from 'runtime recommends' dependencies to 'runtime suggests', but 'test recommends'."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.022"^^xsd:string. a doap:Version; dc:identifier "Class-Tiny-Antlers-0.023"^^xsd:string; dc:issued "2014-09-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Add IRC link."; ], [ a doap-changeset:Packaging; rdfs:label "Rebuilt package with newer Dist::Inkt to resolve minor packaging issues."; ], [ a doap-changeset:Packaging; rdfs:label "Add explicit dependency on Perl 5.6."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.023"^^xsd:string. a doap:Version; dc:identifier "Class-Tiny-Antlers-0.024"^^xsd:string; dc:issued "2019-11-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Support for isa/coerce."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.024"^^xsd:string. a foaf:Person; foaf:mbox ; foaf:name "Toby Inkster"; foaf:nick "TOBYINK"; foaf:page . 01basic.t000644001750001750 71013564447040 15547 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/t=pod =encoding utf-8 =head1 PURPOSE Test that Class::Tiny::Antlers compiles. =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_ok('Class::Tiny::Antlers'); done_testing; 02ro-rw-rwp-bare.t000644001750001750 330713564447040 17277 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/t=pod =encoding utf-8 =head1 PURPOSE Test C, C, C and C attributes. =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; { package YYY; use Class::Tiny; sub ddd { 'inherited sub' }; } { package XXX; use Class::Tiny::Antlers; extends 'YYY'; has aaa => (is => 'ro'); has bbb => (is => 'rw'); has ccc => (is => 'rwp'); has ddd => (is => 'bare'); has eee => (); # default should be rw } my $obj = new_ok 'XXX' => [ aaa => 11, bbb => 12, ccc => 13, ddd => 14, eee => 15 ]; subtest "ro attribute" => sub { is($obj->aaa, 11, 'reader works'); $obj->aaa(21); is($obj->aaa, 11, '... and cannot be used as writer'); done_testing; }; subtest "rw attribute" => sub { is($obj->bbb, 12, 'accessor can be used for reading'); $obj->bbb(22); is($obj->bbb, 22, '... and writing'); done_testing; }; subtest "rwp attribute" => sub { is($obj->ccc, 13, 'reader works'); $obj->ccc(23); is($obj->ccc, 13, '... and cannot be used as writer'); $obj->_set_ccc(23); is($obj->ccc, 23, 'private writer works'); done_testing; }; subtest "bare attribute" => sub { is($obj->{ddd}, 14, 'bare attributes accepted by constructor'); is($obj->ddd, 'inherited sub', 'but no methods are generated'); done_testing; }; subtest "attribute with no `is` option at all" => sub { is($obj->eee, 15, 'accessor can be used for reading'); $obj->eee(25); is($obj->eee, 25, '... and writing'); done_testing; }; done_testing; 03defaults.t000644001750001750 702213564447040 16322 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/t=pod =encoding utf-8 =head1 PURPOSE Test lazy defaults. =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 WWW; use Class::Tiny::Antlers; use constant STYLE => 'non-coderef default with explicit lazy => 1'; has aaa => (is => 'ro', lazy => 1, default => 11); has bbb => (is => 'rw', lazy => 1, default => 12); has ccc => (is => 'rwp', lazy => 1, default => 13); } { package XXX; use Class::Tiny::Antlers; use constant STYLE => 'coderef default with explicit lazy => 1'; has aaa => (is => 'ro', lazy => 1, default => sub { 11 }); has bbb => (is => 'rw', lazy => 1, default => sub { 12 }); has ccc => (is => 'rwp', lazy => 1, default => sub { 13 }); } { package YYY; use Class::Tiny::Antlers; use constant STYLE => 'non-coderef default with implicit lazy => 1'; has aaa => (is => 'ro', default => 11); has bbb => (is => 'rw', default => 12); has ccc => (is => 'rwp', default => 13); } { package ZZZ; use Class::Tiny::Antlers; use constant STYLE => 'coderef default with implicit lazy => 1'; has aaa => (is => 'ro', default => sub { 11 }); has bbb => (is => 'rw', default => sub { 12 }); has ccc => (is => 'rwp', default => sub { 13 }); } for my $class (qw/ WWW XXX YYY ZZZ /) { subtest sprintf('Class %s, %s', $class, $class->STYLE), sub { subtest "A new $class object setting nothing in the constructor" => sub { my $obj = new_ok $class; subtest "ro attribute" => sub { is($obj->{aaa}, undef, 'default is lazy'); is($obj->aaa, 11, 'returns correct value'); is($obj->{aaa}, 11, 'stores into the hashref'); done_testing; }; subtest "rw attribute" => sub { is($obj->{bbb}, undef, 'default is lazy'); is($obj->bbb, 12, 'returns correct value'); is($obj->{bbb}, 12, 'stores into the hashref'); done_testing; }; subtest "rw attribute" => sub { is($obj->{ccc}, undef, 'default is lazy'); is($obj->ccc, 13, 'returns correct value'); is($obj->{ccc}, 13, 'stores into the hashref'); done_testing; }; done_testing; }; subtest "A new $class object setting everything in the constructor" => sub { my $obj = new_ok $class, [ aaa => 21, bbb => 22, ccc => 23 ]; is($obj->aaa, 21, 'ro attribute; does not return default'); is($obj->bbb, 22, 'rw attribute; does not return default'); is($obj->ccc, 23, 'rwp attribute; does not return default'); done_testing; }; subtest "A new $class object just setting the read-only attributes" => sub { my $obj = new_ok $class, [ aaa => 21 ]; subtest "rw attribute" => sub { is($obj->{bbb}, undef, 'attribute was not set in constructor'); $obj->bbb(22); is($obj->bbb, 22, 'writer beats default'); done_testing; }; subtest "rwp attribute" => sub { is($obj->{ccc}, undef, 'attribute was not set in constructor'); $obj->_set_ccc(23); is($obj->ccc, 23, 'writer beats default'); done_testing; }; done_testing; }; done_testing; }; } for my $d ('non-coderef', sub {}) { like( exception { package Bad1; use Class::Tiny; use Class::Tiny::Antlers; has xxx => (lazy => 0, default => $d) }, qr{^Class::Tiny does not support eager defaults}, "Attempt to use an eager default throws an exception with $d default", ); } done_testing; 04predicates-clearers.t000644001750001750 330513564447040 20435 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/t=pod =encoding utf-8 =head1 PURPOSE Test predicates and clearers. =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; { package XXX; use Class::Tiny::Antlers; has aaa => (predicate => 1, clearer => 1); has _bbb => (predicate => 1, clearer => 1); has ccc => (predicate => 'HasCCC', clearer => 'ClearCCC'); } my %subtests = ( # reader writer predicate clearer # "predicates and clearers for public attribute" => [qw/ aaa aaa has_aaa clear_aaa /], "predicates and clearers for private attribute" => [qw/ _bbb _bbb _has_bbb _clear_bbb /], "custom predicates and clearers" => [qw/ ccc ccc HasCCC ClearCCC /], ); for my $subtest (sort keys %subtests) { my (undef, $writer, $predicate, $clearer) = @{ $subtests{$subtest} }; subtest $subtest => sub { my $obj = new_ok 'XXX'; ok(! $obj->$predicate, 'value not set in constructor; predicate returns false'); $obj->$writer(1); ok($obj->$predicate, 'value set by accessor; predicate returns true'); $obj->$clearer; ok(!$obj->$predicate, 'value wiped by clearer; predicate returns false'); $obj->$writer(undef); ok($obj->$predicate, 'value set by accessor; predicate returns true, even though value is undef'); my $obj2 = new_ok 'XXX', [ $writer => 42 ]; ok($obj->$predicate, 'value set in constructor; predicate returns true'); done_testing; }; } done_testing; 05init_arg.t000644001750001750 157413564447040 16317 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/t=pod =encoding utf-8 =head1 PURPOSE Test that C I work. =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; like( exception { package Bad1; use Class::Tiny::Antlers; has xxx => (init_arg => undef) }, qr{^Class::Tiny does not support init_arg}, "init_arg => undef", ); like( exception { package Bad2; use Class::Tiny::Antlers; has xxx => (init_arg => 'yyy') }, qr{^Class::Tiny does not support init_arg}, "init_arg => 'yyy'", ); is( exception { package Good1; use Class::Tiny::Antlers; has xxx => (init_arg => 'xxx') }, undef, "init_arg => 'xxx'", ); done_testing; 06required.t000644001750001750 251613564447040 16341 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/t=pod =encoding utf-8 =head1 PURPOSE Test that C I work. =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; like( exception { package Bad1; use Class::Tiny::Antlers; has xxx => (required => 1) }, qr{^Class::Tiny::Object::new does not support required attributes}, "required => 1", ); is( exception { package Good1; use Class::Tiny::Antlers; has xxx => (required => 0) }, undef, "required => 0", ); { package XXX; use Class::Tiny::Antlers -all; ::is( ::exception { has xxx => (required => 1, predicate => '_has_xxx') }, undef, 'we let required => 1 slide if the constructor has been overridden', ); sub new { my $class = shift; my $self = $class->SUPER::new(@_); $self->_has_xxx or confess("Required attribute xxx not set"); return $self; } } is( exception { 'XXX'->new(xxx => undef) }, undef, 'throws no exception when required attribute is provided' ); like( exception { 'XXX'->new() }, qr{^Required attribute xxx not set}, 'throws exception when required attribute is not provided' ); done_testing; 07extends.t000644001750001750 156613564447040 16200 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/t=pod =encoding utf-8 =head1 PURPOSE Test that C 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; { package WWW; use Class::Tiny::Antlers; } { package XXX; use Class::Tiny::Antlers; extends qw( WWW ); } { package YYY; use Class::Tiny::Antlers; } { package ZZZ; use Class::Tiny::Antlers; extends qw( XXX YYY ); } isa_ok('WWW'->new, $_) for qw( Class::Tiny::Object WWW ); isa_ok('XXX'->new, $_) for qw( Class::Tiny::Object WWW XXX ); isa_ok('YYY'->new, $_) for qw( Class::Tiny::Object YYY ); isa_ok('ZZZ'->new, $_) for qw( Class::Tiny::Object WWW XXX YYY ZZZ ); done_testing; 08with.t000644001750001750 211513564447040 15471 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/t=pod =encoding utf-8 =head1 PURPOSE Test that C works. =head1 DEPENDENCIES Requires L 1.000000; skipped otherwise. =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 { 'Role::Tiny' => '1.000000' }; { package UUU; use Role::Tiny; sub uuu { 42 }; } { package VVV; use Role::Tiny; } { package WWW; use Role::Tiny; with qw( UUU ); } { package XXX; use Class::Tiny::Antlers; with qw( WWW ); } { package YYY; use Role::Tiny; } { package ZZZ; use Class::Tiny::Antlers; extends qw( XXX ); with qw( VVV YYY ); } ok('XXX'->DOES($_), "XXX DOES $_") for qw( Class::Tiny::Object XXX WWW UUU ); ok('ZZZ'->DOES($_), "ZZZ DOES $_") for qw( Class::Tiny::Object ZZZ XXX YYY VVV WWW UUU ); is('ZZZ'->new->uuu, 42, 'can call method from UUU role on ZZZ object'); done_testing; 09hygiene.t000644001750001750 141413564447040 16150 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/t=pod =encoding utf-8 =head1 PURPOSE Test namespace cleanliness. =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; { package WWW; use Class::Tiny::Antlers -all; has aaa => (is => 'ro', lazy => 1, default => 11); has bbb => (is => 'rw', lazy => 1, default => 12); has ccc => (is => 'rwp', lazy => 1, default => 13); no Class::Tiny::Antlers; } ok( 'WWW'->can($_), "WWW can $_") for qw( aaa bbb ccc ); ok(!'WWW'->can($_), "WWW cannot $_") for qw( confess has extends with ); done_testing; 10modifiers.t000644001750001750 175113564447040 16475 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/t=pod =encoding utf-8 =head1 PURPOSE Test that C, C and C work. =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 { 'Class::Method::Modifiers' => '1.05' }; { package XXX; use Class::Tiny; sub xxx { ${$_[1]} .= ".in" }; } { package YYY; use Class::Tiny::Antlers -all; extends 'XXX'; before xxx => sub { ${$_[1]} .= ".before" }; after xxx => sub { ${$_[1]} .= ".after" }; around xxx => sub { my $orig = shift; my $self = shift; my $str = $_[0]; $$str .= ".around1"; my $r = $self->$orig($str); $$str .= ".around2"; return $r; }; } my $yyy = YYY->new; my $str = 'orig'; $yyy->xxx(\$str); is($str, 'orig.before.around1.in.around2.after'); done_testing; 11types-moose.t000644001750001750 75213564447040 16761 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/tuse strict; use warnings; use Test::More; use Test::Requires 'MooseX::Types::Moose'; use Test::Fatal; { package Local::Foo; use MooseX::Types::Moose 'Int'; use Class::Tiny::Antlers; has foo => (is => 'rw', isa => Int); }; my $o1 = Local::Foo->new(foo => 42); is($o1->foo, 42); $o1->foo(43); is($o1->foo, 43); my $e = exception { $o1->foo('bar') }; like($e, qr/type constraint/i); my $e2 = exception { Local::Foo->new(foo => 'baz') }; like($e2, qr/type constraint/i); done_testing; 11types-mouse.t000644001750001750 75213564447040 16767 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/tuse strict; use warnings; use Test::More; use Test::Requires 'MouseX::Types::Mouse'; use Test::Fatal; { package Local::Foo; use MouseX::Types::Mouse 'Int'; use Class::Tiny::Antlers; has foo => (is => 'rw', isa => Int); }; my $o1 = Local::Foo->new(foo => 42); is($o1->foo, 42); $o1->foo(43); is($o1->foo, 43); my $e = exception { $o1->foo('bar') }; like($e, qr/type constraint/i); my $e2 = exception { Local::Foo->new(foo => 'baz') }; like($e2, qr/type constraint/i); done_testing; 11types-nano.t000644001750001750 72613564447040 16573 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/tuse strict; use warnings; use Test::More; use Test::Requires 'Type::Nano'; use Test::Fatal; { package Local::Foo; use Type::Nano 'Int'; use Class::Tiny::Antlers; has foo => (is => 'rw', isa => Int); }; my $o1 = Local::Foo->new(foo => 42); is($o1->foo, 42); $o1->foo(43); is($o1->foo, 43); my $e = exception { $o1->foo('bar') }; like($e, qr/type constraint/i); my $e2 = exception { Local::Foo->new(foo => 'baz') }; like($e2, qr/type constraint/i); done_testing; 11types-specio.t000644001750001750 77113564447040 17122 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/tuse strict; use warnings; use Test::More; use Test::Requires 'Specio::Library::Builtins'; use Test::Fatal; { package Local::Foo; use Specio::Library::Builtins 'Int'; use Class::Tiny::Antlers; has foo => (is => 'rw', isa => t('Int')); }; my $o1 = Local::Foo->new(foo => 42); is($o1->foo, 42); $o1->foo(43); is($o1->foo, 43); my $e = exception { $o1->foo('bar') }; like($e, qr/type constraint/i); my $e2 = exception { Local::Foo->new(foo => 'baz') }; like($e2, qr/type constraint/i); done_testing; 11types.t000644001750001750 111313564447040 15651 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/tuse strict; use warnings; use Test::More; use Test::Requires { 'Type::Tiny' => '1.004000' }; use Test::Fatal; { package Local::Foo; use Types::Standard 'Int', 'Num'; use Class::Tiny::Antlers; has foo => (is => 'rw', isa => Int->plus_coercions(Num, sub { int($_) }), coerce => 1); }; my $o1 = Local::Foo->new(foo => 42); is($o1->foo, 42); $o1->foo(43); is($o1->foo, 43); $o1->foo('44.1'); is($o1->foo, 44); my $e = exception { $o1->foo('bar') }; like($e, qr/type constraint/i); my $e2 = exception { Local::Foo->new(foo => 'baz') }; like($e2, qr/type constraint/i); done_testing; Antlers.pm000644001750001750 3164513564447040 20454 0ustar00taitai000000000000Class-Tiny-Antlers-0.024/lib/Class/Tinypackage Class::Tiny::Antlers; sub _getstash { \%{"$_[0]::"} } use 5.006; use strict; use warnings; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.024'; use Class::Tiny 0.006 (); our @ISA = 'Class::Tiny'; my %EXPORT_TAGS = ( default => [qw/ has extends with strict /], all => [qw/ has extends with before after around strict warnings confess /], cmm => [qw/ before after around /], ); my %CLASS_ATTRIBUTES; sub import { my $me = shift; my %want = map +($_ => 1), map +(@{ $EXPORT_TAGS{substr($_, 1)} or [$_] }), (@_ ? @_ : '-default'); strict->import if delete $want{strict}; warnings->import if delete $want{warnings}; my $caller = caller; $me->_install_tracked($caller, has => sub { unshift @_, $me, $caller; goto \&has }) if delete $want{has}; $me->_install_tracked($caller, extends => sub { unshift @_, $me, $caller; goto \&extends }) if delete $want{extends}; $me->_install_tracked($caller, with => sub { unshift @_, $me, $caller; goto \&with }) if delete $want{with}; $me->_install_tracked($caller, confess => \&confess) if delete $want{confess}; for my $modifier (qw/ before after around /) { next unless delete $want{$modifier}; $me->_install_tracked($caller, $modifier, sub { require Class::Method::Modifiers; Class::Method::Modifiers::install_modifier($caller, $modifier, @_); }); } croak("Unknown import symbols (%s)", join ", ", sort keys %want) if keys %want; @_ = ($me); goto \&Class::Tiny::import; } my %INSTALLED; sub _install_tracked { no strict 'refs'; my ($me, $pkg, $name, $code) = @_; *{"$pkg\::$name"} = $code; $INSTALLED{$pkg}{$name} = "$code"; } sub unimport { my $me = shift; my $caller = caller; $me->_clean($caller, $INSTALLED{$caller}); } sub _clean { my ($me, $target, $exports) = @_; my %rev = reverse %$exports or return; my $stash = _getstash($target); for my $name (keys %$exports) { if ($stash->{$name} and defined(&{$stash->{$name}})) { if ($rev{$target->can($name)}) { my $old = delete $stash->{$name}; my $full_name = join('::',$target,$name); # Copy everything except the code slot back into place (e.g. $has) foreach my $type (qw(SCALAR HASH ARRAY IO)) { next unless defined(*{$old}{$type}); no strict 'refs'; *$full_name = *{$old}{$type}; } } } } } sub croak { require Carp; my ($fmt, @values) = @_; Carp::croak(sprintf($fmt, @values)); } sub confess { require Carp; my ($fmt, @values) = @_; Carp::confess(sprintf($fmt, @values)); } my %BUILD_WRAPPED; sub has { my ($me, $caller) = (shift, shift); my ($attr, %spec) = @_; if (defined($attr) and ref($attr) eq q(ARRAY)) { has($caller, $_, %spec) for @$attr; return; } $CLASS_ATTRIBUTES{$caller}{$attr} = +{ %spec }; $CLASS_ATTRIBUTES{$caller}{$attr}{is} ||= 'ro'; $CLASS_ATTRIBUTES{$caller}{$attr}{lazy} ||= 1 if exists($spec{default}); if (!defined($attr) or ref($attr) or $attr !~ /^[^\W\d]\w*$/s) { croak("Invalid accessor name '%s'", $attr); } my $init_arg = exists($spec{init_arg}) ? delete($spec{init_arg}) : \undef; my $is = delete($spec{is}) || 'rw'; my $required = delete($spec{required}); my $default = delete($spec{default}); my $lazy = delete($spec{lazy}); my $clearer = delete($spec{clearer}); my $predicate = delete($spec{predicate}); my $setter_wrap; if ($spec{isa} or $spec{coerce}) { ref($spec{isa}) or croak("Type names are strings are not supported"); $spec{isa}->can('check') or croak("Type doesn't have a `check` method"); $spec{isa}->can('get_message') or croak("Type doesn't have a `get_message` method"); $spec{isa}->can('coerce') or !$spec{coerce} or croak("Type doesn't have a `coerce` method"); $setter_wrap = 1; delete $spec{$_} for qw/ isa coerce /; __PACKAGE__->_wrap_build($caller) unless $BUILD_WRAPPED{$caller}++; } if ($is eq 'lazy') { $lazy = 1; $is = 'ro'; } if (defined $lazy and not $lazy) { croak("Class::Tiny does not support eager defaults"); } elsif (keys %spec) { croak("Unknown options in attribute specification (%s)", join ", ", sort keys %spec); } if ($required and 'Class::Tiny::Object'->can('new') == $caller->can('new')) { croak("Class::Tiny::Object::new does not support required attributes; please manually override the constructor to enforce required attributes"); } if ($init_arg and ref($init_arg) eq 'SCALAR' and not defined $$init_arg) { # ok } elsif (!$init_arg or $init_arg ne $attr) { croak("Class::Tiny does not support init_arg"); } my $getter = "\$_[0]{'$attr'}"; if (defined $default and ref($default) eq 'CODE') { $getter = "\$_[0]{'$attr'} = \$default->(\$_[0]) unless exists \$_[0]{'$attr'}; $getter"; } elsif (defined $default) { $getter = "\$_[0]{'$attr'} = \$default unless exists \$_[0]{'$attr'}; $getter"; } my $setter_name; my @methods; my $needs_clean = 0; if ($is eq 'rw') { $setter_name = $attr; push @methods, "sub $attr :method { \$_[0]{'$attr'} = \$_[1] if \@_ > 1; $getter };"; } elsif ($is eq 'ro' or $is eq 'rwp') { $setter_name = "_set_$attr"; push @methods, "sub $attr :method { $getter };"; push @methods, "sub _set_$attr :method { \$_[0]{'$attr'} = \$_[1] };" if $is eq 'rwp'; } elsif ($is eq 'bare') { no strict 'refs'; $needs_clean = not exists &{"$caller\::$attr"}; } else { croak("Class::Tiny::Antlers does not support '$is' accessors"); } if ($clearer) { $clearer = ($attr =~ /^_/) ? "_clear$attr" : "clear_$attr" if $clearer eq '1'; push @methods, "sub $clearer :method { delete(\$_[0]{'$attr'}) }"; } if ($predicate) { $predicate = ($attr =~ /^_/) ? "_has$attr" : "has_$attr" if $predicate eq '1'; push @methods, "sub $predicate :method { exists(\$_[0]{'$attr'}) }"; } eval "package $caller; @methods"; $me->create_attributes($caller, $attr); $me->_wrap_setter($caller, $attr, $setter_name) if $setter_wrap; $me->_clean($caller, { $attr => do { no strict 'refs'; ''.\&{"$caller\::$attr"} } }) if $needs_clean; } sub _wrap_build { my ($me, $caller) = @_; no strict 'refs'; if (exists &{"$caller\::BUILD"}) { my $next = \&{"$caller\::BUILD"}; $me->_clean($caller, { BUILD => $next }); eval sprintf(q{ package %s; sub BUILD { my $self = shift; %s->_check_args('%s', @_); $self->$next(@_); } }, $caller, $me, $caller); } else { eval sprintf(q{ package %s; sub BUILD { my $self = shift; %s->_check_args('%s', $self, @_); } }, $caller, $me, $caller); } } sub _check_args { my ($me, $caller, $object, $args) = @_; my $spec = $CLASS_ATTRIBUTES{$caller}; for my $attr (sort keys %$spec) { my $type = $spec->{$attr}{isa} or next; exists $args->{$attr} or next; $type->check($args->{$attr}) and next; if ($spec->{$attr}{coerce}) { my $coerced = $type->coerce($args->{$attr}); if ($type->check($coerced)) { $object->{$attr} = $args->{$attr} = $coerced; next; } } croak('Type constraint check failed for attribute "%s": %s', $attr, $type->get_message($args->{$attr})); } } sub _wrap_setter { my ($me, $caller, $attr, $setter_name) = @_; no strict 'refs'; my $next = \&{"$caller\::$setter_name"}; my $spec = $CLASS_ATTRIBUTES{$caller}; my $type = $spec->{$attr}{isa}; my $coerce = $spec->{$attr}{coerce}; $me->_clean($caller, { $setter_name => $next }); if ($coerce) { eval sprintf(q{ package %s; sub %s { my $self = shift; if (@_) { $type->check(@_) or do { my $coerced = $type->coerce(@_); $type->check($coerced) and do { @_ = ($coerced); 1 }; } or %s::croak('Type constraint check failed for attribute "%s": %%s', $type->get_message(@_)); } $self->$next(@_); } }, $caller, $setter_name, $me, $attr); } elsif ($type->can('can_be_inlined') && $type->can_be_inlined) { my $ic = $type->can('inline_check') || $type->can('_inline_check'); eval sprintf(q{ package %s; sub %s { my $self = shift; if (@_) { my $val = $_[0]; %s or %s::croak('Type constraint check failed for attribute "%s": %%s', $type->get_message(@_)); } $self->$next(@_); } }, $caller, $setter_name, $type->$ic('$val'), $me, $attr); } else { eval sprintf(q{ package %s; sub %s { my $self = shift; if (@_) { $type->check(@_) or %s::croak('Type constraint check failed for attribute "%s": %%s', $type->get_message(@_)); } $self->$next(@_); } }, $caller, $setter_name, $me, $attr); } } sub extends { my ($me, $caller) = (shift, shift); my (@parents) = @_; for my $parent (@parents) { eval "require $parent"; } no strict 'refs'; @{"$caller\::ISA"} = @parents; } sub with { my ($me, $caller) = (shift, shift); require Role::Tiny::With; goto \&Role::Tiny::With::with; } sub get_all_attribute_specs_for { my $me = shift; my $class = $_[0]; my %specs = %{ $me->get_all_attribute_defaults_for }; $specs{$_} = defined($specs{$_}) ? +{ is => 'rw', lazy => 1, default => $specs{$_} } : +{ is => 'rw' } for keys %specs; for my $p ( reverse @{ $class->mro::get_linear_isa } ) { while ( my ($k, $v) = each %{$CLASS_ATTRIBUTES{$p}||{}} ) { $specs{$k} = $v; } } \%specs; } 1; __END__ =pod =encoding utf-8 =for stopwords unimport =head1 NAME Class::Tiny::Antlers - Moose-like sugar for Class::Tiny =head1 SYNOPSIS { package Point; use Class::Tiny::Antlers; has x => (is => 'ro'); has y => (is => 'ro'); } { package Point3D; use Class::Tiny::Antlers; extends 'Point'; has z => (is => 'ro'); } =head1 DESCRIPTION Class::Tiny::Antlers provides L-like C, C, C, C, C and C keywords for L. (The C keyword requires L; method modifiers require L.) Class::Tiny doesn't support all Moose's attribute options; C should throw you an error if you try to do something it doesn't support (like triggers). Class::Tiny::Antlers does however hack in support for C<< is => 'ro' >> and Moo-style C<< is => 'rwp' >>, clearers and predicates. From version 0.24, Class::Tiny::Antlers also adds support for `isa` and `coerce` using L. (I mean, this is a TOBYINK module, so what do you expect?!) Technically L, L, L, and L should work, but these are less tested. =head2 Export By default, Class::Tiny::Antlers exports C, C and C, and also imports L into its caller. You can optionally also import C and L: use Class::Tiny::Antlers qw( -default confess warnings ); And Class::Method::Modifiers keywords: use Class::Tiny::Antlers qw( -default before after around ); use Class::Tiny::Antlers qw( -default -cmm ); # same thing If you just want everything: use Class::Tiny::Antlers qw( -all ); Class::Tiny::Antlers also ensures that Class::Tiny's import method is called for your class. You can put a C<< no Class::Tiny::Antlers >> statement at the end of your class definition to wipe the imported functions out of your namespace. (This does not unimport strict/warnings though.) To clean up your namespace more thoroughly, use something like L. =head2 Functions =over =item C<< has $attr, %spec >> Create an attribute. The specification hash roughly supports C, C, C and C as per L and L. =item C<< extends @classes >> Set the base class(es) for your class. =item C<< with @roles >> Compose L roles with your class. =item C<< before $name, \&code >> Install a C modifier using L. =item C<< after $name, \&code >> Install a C modifier using L. =item C<< around $name, \&code >> Install a C modifier using L. =item C<< confess $format, @list >> C-fueled version of L's C. =back =head2 Methods Class::Tiny::Antlers inherits the C and C methods from Class::Tiny, and also provides: =over =item C<< Class::Tiny::Antlers->get_all_attribute_specs_for($class) >> Gets Moose-style attribute specification hashes for all the class' attributes as a big hashref. (Includes inherited attributes.) =back =head1 BUGS Please report any bugs to L. =head1 SEE ALSO L, L, L, L. L, L, L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2013, 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.