COPYRIGHT000664001750001750 253112422423641 14123 0ustar00taitai000000000000Role-Commons-0.104Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Role-Commons Upstream-Contact: Toby Inkster (TOBYINK) Source: https://metacpan.org/release/Role-Commons Files: Changes META.json META.yml dist.ini doap.ttl lib/Object/AUTHORITY.pm Copyright: Copyright 2014 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: t/01basic.t t/02oaa.t t/Object-AUTHORITY/01basic.t t/Object-AUTHORITY/02return.t t/Object-AUTHORITY/03croak.t Copyright: Copyright 2012 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: README lib/Role/Commons.pm lib/Role/Commons/Authority.pm lib/Role/Commons/ObjectID.pm lib/Role/Commons/Tap.pm Copyright: This software is copyright (c) 2012, 2014 by Toby Inkster. License: GPL-1.0+ or Artistic-1.0 Files: COPYRIGHT CREDITS SIGNATURE Copyright: None License: public-domain Files: INSTALL LICENSE Copyright: Unknown License: Unknown Files: Makefile.PL Copyright: Copyright 2013 Toby Inkster. License: GPL-1.0+ or Artistic-1.0 License: Artistic-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The Artistic License 1.0 License: GPL-1.0 This software is Copyright (c) 2014 by the copyright holder(s). This is free software, licensed under: The GNU General Public License, Version 1, February 1989 CREDITS000664001750001750 7112422423640 13604 0ustar00taitai000000000000Role-Commons-0.104Maintainer: - Toby Inkster (TOBYINK) Changes000664001750001750 162012422423640 14120 0ustar00taitai000000000000Role-Commons-0.104Role-Commons ============ Created: 2012-10-12 Home page: Bug tracker: Maintainer: Toby Inkster (TOBYINK) 0.104 2014-10-24 Happy Birthday, Elliott! [ Packaging ] - Add dependency on Test::Exception. 0.103 2014-10-18 [ Packaging ] - Fix dependency information. [ Other ] - Recommend Object::Tap/Object::Util over Role::Commons::Tap. - Removed: The obsolete Object::Tap module is now gone (though the namespace has been recycled by MSTROUT). - Removed: The obsolete authority::shared module is now gone. - Stop using Scalar::Does. - use match::simple. 0.102 2014-09-10 [ Packaging ] - Switch to Dist::Inkt. 0.101 2012-10-26 - Added: Provide &Object::AUTHORITY::AUTHORITY function. It seems Web::Magic was relying on it. 0.100 2012-10-26 Initial release INSTALL000664001750001750 167212422423640 13665 0ustar00taitai000000000000Role-Commons-0.104 Installing Role-Commons should be straightforward. INSTALLATION WITH CPANMINUS If you have cpanm, you only need one line: % cpanm Role::Commons 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 Role::Commons INSTALLATION WITH THE CPAN SHELL Alternatively, if your CPAN shell is set up, you should just be able to do: % cpan Role::Commons 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 Role-Commons: % 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 LICENSE000664001750001750 4365512422423640 13670 0ustar00taitai000000000000Role-Commons-0.104This software is copyright (c) 2014 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Toby Inkster. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Toby Inkster. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End MANIFEST000664001750001750 54212422423641 13741 0ustar00taitai000000000000Role-Commons-0.104COPYRIGHT CREDITS Changes INSTALL LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE dist.ini doap.ttl lib/Object/AUTHORITY.pm lib/Role/Commons.pm lib/Role/Commons/Authority.pm lib/Role/Commons/ObjectID.pm lib/Role/Commons/Tap.pm t/01basic.t t/02oaa.t t/Object-AUTHORITY/01basic.t t/Object-AUTHORITY/02return.t t/Object-AUTHORITY/03croak.t META.json000664001750001750 421712422423640 14253 0ustar00taitai000000000000Role-Commons-0.104{ "abstract" : "roles that can be commonly used, for the mutual benefit of all", "author" : [ "Toby Inkster (TOBYINK) " ], "dynamic_config" : 0, "generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.142690", "keywords" : [], "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Role-Commons", "no_index" : { "directory" : [ "eg", "examples", "inc", "t", "xt" ] }, "optional_features" : {}, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.17" } }, "runtime" : { "requires" : { "Module::Runtime" : "0", "Moo::Role" : "0", "Object::ID" : "0", "Types::Standard" : "1.000000", "match::simple" : "0", "perl" : "5.008" } }, "test" : { "requires" : { "Test::Exception" : "0", "Test::More" : "0.61" } } }, "provides" : { "Object::AUTHORITY" : { "file" : "lib/Object/AUTHORITY.pm", "version" : "0.104" }, "Role::Commons" : { "file" : "lib/Role/Commons.pm", "version" : "0.104" }, "Role::Commons::Authority" : { "file" : "lib/Role/Commons/Authority.pm", "version" : "0.104" }, "Role::Commons::ObjectID" : { "file" : "lib/Role/Commons/ObjectID.pm", "version" : "0.104" }, "Role::Commons::Tap" : { "file" : "lib/Role/Commons/Tap.pm", "version" : "0.104" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://rt.cpan.org/Dist/Display.html?Queue=Role-Commons" }, "homepage" : "https://metacpan.org/release/Role-Commons", "license" : [ "http://dev.perl.org/licenses/" ], "x_identifier" : "http://purl.org/NET/cpan-uri/dist/Role-Commons/project" }, "version" : "0.104" } META.yml000664001750001750 256712422423640 14111 0ustar00taitai000000000000Role-Commons-0.104--- abstract: 'roles that can be commonly used, for the mutual benefit of all' author: - 'Toby Inkster (TOBYINK) ' build_requires: Test::Exception: '0' Test::More: '0.61' configure_requires: ExtUtils::MakeMaker: '6.17' dynamic_config: 0 generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.142690' keywords: [] license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Role-Commons no_index: directory: - eg - examples - inc - t - xt optional_features: {} provides: Object::AUTHORITY: file: lib/Object/AUTHORITY.pm version: '0.104' Role::Commons: file: lib/Role/Commons.pm version: '0.104' Role::Commons::Authority: file: lib/Role/Commons/Authority.pm version: '0.104' Role::Commons::ObjectID: file: lib/Role/Commons/ObjectID.pm version: '0.104' Role::Commons::Tap: file: lib/Role/Commons/Tap.pm version: '0.104' requires: Module::Runtime: '0' Moo::Role: '0' Object::ID: '0' Types::Standard: '1.000000' match::simple: '0' perl: '5.008' resources: Identifier: http://purl.org/NET/cpan-uri/dist/Role-Commons/project bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=Role-Commons homepage: https://metacpan.org/release/Role-Commons license: http://dev.perl.org/licenses/ version: '0.104' Makefile.PL000664001750001750 1233312422423640 14622 0ustar00taitai000000000000Role-Commons-0.104use strict; use ExtUtils::MakeMaker 6.17; my $EUMM = eval( $ExtUtils::MakeMaker::VERSION ); my $meta = { "abstract" => "roles that can be commonly used, for the mutual benefit of all", "author" => ["Toby Inkster (TOBYINK) "], "dynamic_config" => 0, "generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.023, CPAN::Meta::Converter version 2.142690", "keywords" => [], "license" => ["perl_5"], "meta-spec" => { url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec", version => 2, }, "name" => "Role-Commons", "no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] }, "prereqs" => { configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } }, runtime => { requires => { "match::simple" => 0, "Module::Runtime" => 0, "Moo::Role" => 0, "Object::ID" => 0, "perl" => 5.008, "Types::Standard" => "1.000000", }, }, test => { requires => { "Test::Exception" => 0, "Test::More" => 0.61 } }, }, "provides" => { "Object::AUTHORITY" => { file => "lib/Object/AUTHORITY.pm", version => 0.104 }, "Role::Commons" => { file => "lib/Role/Commons.pm", version => 0.104 }, "Role::Commons::Authority" => { file => "lib/Role/Commons/Authority.pm", version => 0.104 }, "Role::Commons::ObjectID" => { file => "lib/Role/Commons/ObjectID.pm", version => 0.104 }, "Role::Commons::Tap" => { file => "lib/Role/Commons/Tap.pm", version => 0.104 }, }, "release_status" => "stable", "resources" => { bugtracker => { web => "http://rt.cpan.org/Dist/Display.html?Queue=Role-Commons", }, homepage => "https://metacpan.org/release/Role-Commons", license => ["http://dev.perl.org/licenses/"], x_identifier => "http://purl.org/NET/cpan-uri/dist/Role-Commons/project", }, "version" => 0.104, }; 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 t/Object-AUTHORITY/*.t" }, %dynamic_config, ); $WriteMakefileArgs{LICENSE} = $meta->{license}[0] if $EUMM >= 6.3001; sub deps { my %r; for my $stage (@_) { for my $dep (keys %{$meta->{prereqs}{$stage}{requires}}) { next if $dep eq 'perl'; my $ver = $meta->{prereqs}{$stage}{requires}{$dep}; $r{$dep} = $ver if !exists($r{$dep}) || $ver >= $r{$dep}; } } \%r; } my ($build_requires, $configure_requires, $runtime_requires, $test_requires); if ($EUMM >= 6.6303) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{TEST_REQUIRES} ||= deps('test'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.5503) { $WriteMakefileArgs{BUILD_REQUIRES} ||= deps('build', 'test'); $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime'); } elsif ($EUMM >= 6.52) { $WriteMakefileArgs{CONFIGURE_REQUIRES} ||= deps('configure'); $WriteMakefileArgs{PREREQ_PM} ||= deps('runtime', 'build', 'test'); } else { $WriteMakefileArgs{PREREQ_PM} ||= deps('configure', 'build', 'test', 'runtime'); } { my ($minperl) = reverse sort( grep defined && /^[0-9]+(\.[0-9]+)?$/, map $meta->{prereqs}{$_}{requires}{perl}, qw( configure build runtime ) ); if (defined($minperl)) { die "Installing $meta->{name} requires Perl >= $minperl" unless $] >= $minperl; $WriteMakefileArgs{MIN_PERL_VERSION} ||= $minperl if $EUMM >= 6.48; } } sub FixMakefile { return unless -d 'inc'; my $file = shift; local *MAKEFILE; open MAKEFILE, "< $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; my $makefile = do { local $/; }; close MAKEFILE or die $!; $makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /; $makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g; $makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g; $makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m; $makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m; open MAKEFILE, "> $file" or die "FixMakefile: Couldn't open $file: $!; bailing out"; print MAKEFILE $makefile or die $!; close MAKEFILE or die $!; } my $mm = WriteMakefile(%WriteMakefileArgs); FixMakefile($mm->{FIRST_MAKEFILE} || 'Makefile'); exit(0); README000664001750001750 546412422423640 13517 0ustar00taitai000000000000Role-Commons-0.104NAME Role::Commons - roles that can be commonly used, for the mutual benefit of all SYNOPSIS use 5.010; { package Local::Class; use Moo; use Role::Commons -all; our $AUTHORITY = 'cpan:JOEBLOGGS'; our $VERSION = '1.000'; } say Local::Class->AUTHORITY if Local::Class->DOES('Role::Commons::Authority'); my $obj = Local::Class->new; say $obj->object_id if $obj->DOES('Role::Commons::ObjectID'); DESCRIPTION Role-Commons is not yet another implementation of roles. It is a collection of generic, reusable roles that hopefully you will love to apply to your classes. These roles are built using Moo::Role, so automatically integrate into the Moose object system if you're using it, but they do not require Moose. The Role::Commons module itself provides shortcuts for applying roles to your package, so that instead of doing: { package Local::Class; use Moo; # or "use Moose" with qw( Role::Commons::Authority Role::Commons::ObjectID ); } You can just do this: { package Local::Class; use Moo; use Role::Commons qw( Authority ObjectID ); } It also handles passing some simple parameters through to the role from the consuming class. (Because Moo doesn't have anything like MooseX::Role::Parameterized.) Roles Role::Commons::Authority Sets up a `AUTHORITY` method for your class which is conceptually a little like `VERSION`. Role::Commons::ObjectID Provides an `object_id` method for your class which returns a unique identifier for each object. Role::Commons::Tap Provides a `tap` method for your class, inspired by Ruby's method of the same name. Helpful for writing chained method calls. Obsolescence Role-Commons is the successor for my older projects: authority-shared, Object-AUTHORITY, Object-DOES, Object-Role, and Object-Tap. Role-Commons bundles Object::AUTHORITY for the sake of backwards compatibility. This is being phased out. BUGS Please report any bugs to . SEE ALSO Role::Commons::Authority, Role::Commons::ObjectID, Role::Commons::Tap. Role::Tiny, Moo::Role, Moose::Role. AUTHOR Toby Inkster . COPYRIGHT AND LICENCE This software is copyright (c) 2012, 2014 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. SIGNATURE000664001750001750 402712422423641 14116 0ustar00taitai000000000000Role-Commons-0.104This file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.73. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SHA1 ed98ec4ee6e188b24a914aa66f53bd40f78361df COPYRIGHT SHA1 6bd7b17d81be63d08d4efa6cb80106e72887842c CREDITS SHA1 e760295e68d1e4af096a06b1dc1de36ec86692d0 Changes SHA1 12a5fc40c0b78f8148b795bf5be1c5ee42af3e3a INSTALL SHA1 34f5e12514b91055de4b164a1f2327ef5c30ba53 LICENSE SHA1 9ab58fcd800610e6776cb1c209dc6d2ffb42b7fa MANIFEST SHA1 c545eabff54bf55156863351bfb6875a662c7b92 META.json SHA1 ab5d202787470cff6cba740ebffc6c398e108aae META.yml SHA1 8ca528349972a8b25efd5931c21c7b4557059078 Makefile.PL SHA1 49a41167dfc9e40e0d450ad8ecabac799ac78466 README SHA1 a3b2c7abba52141fd8cf1e0cca50d31b51ceb9c5 dist.ini SHA1 001aa6c93a7165d481afed114e970a0f3fdf2c34 doap.ttl SHA1 441d786b9c7ab84346405c9e046b34321386cdb0 lib/Object/AUTHORITY.pm SHA1 f480170179b9473faaa1d927a5b0e8e91d707c3b lib/Role/Commons.pm SHA1 574ee98c1cf439c23b875f4872fa988126f20b06 lib/Role/Commons/Authority.pm SHA1 080467a33742f6518af8b78fb92ff7e49f8d712b lib/Role/Commons/ObjectID.pm SHA1 9fcf5913c3f826b00468faf081e81a2049ea0b01 lib/Role/Commons/Tap.pm SHA1 53acb49d3d14625252221e3e21b6666fe48d0e1e t/01basic.t SHA1 ba9b56441d49ffc9e58bafb1d377b2eed623f70f t/02oaa.t SHA1 304c22f406f9c3595fdceaa80136c01adc37709d t/Object-AUTHORITY/01basic.t SHA1 6f9bab9fa817005dc0e07df8896b283acb54a449 t/Object-AUTHORITY/02return.t SHA1 6b2e2e7acea0853e3cd0232d6c7de61c35df7e49 t/Object-AUTHORITY/03croak.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlRKJ6EACgkQzr+BKGoqfTmTMgCdGrAF0hoQ/uxH+OLK99ysHmF+ 554AoKsvBNQYA9L1Dksr3mYZpGrpnTqc =Q4Dj -----END PGP SIGNATURE----- dist.ini000664001750001750 7512422423640 14234 0ustar00taitai000000000000Role-Commons-0.104;;class='Dist::Inkt::Profile::TOBYINK' ;;name='Role-Commons' doap.ttl000664001750001750 1274512422423640 14327 0ustar00taitai000000000000Role-Commons-0.104@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; dc:contributor ; doap-deps:runtime-requirement [ doap-deps:on "perl 5.008"^^doap-deps:CpanId ], [ doap-deps:on "Types::Standard 1.000000"^^doap-deps:CpanId; ], [ doap-deps:on "Moo::Role"^^doap-deps:CpanId ], [ doap-deps:on "Object::ID"^^doap-deps:CpanId ], [ doap-deps:on "Module::Runtime"^^doap-deps:CpanId ], [ doap-deps:on "match::simple"^^doap-deps:CpanId ]; doap-deps:test-requirement [ doap-deps:on "Test::More 0.61"^^doap-deps:CpanId ], [ doap-deps:on "Test::Exception"^^doap-deps:CpanId ]; doap:bug-database ; doap:created "2012-10-12"^^xsd:date; doap:developer ; doap:download-page ; doap:homepage ; doap:license ; doap:maintainer ; doap:name "Role-Commons"; doap:programming-language "Perl"; doap:release , , , , ; doap:shortdesc "roles that can be commonly used, for the mutual benefit of all". a doap:Version; rdfs:label "Initial release"; dc:identifier "Role-Commons-0.100"^^xsd:string; dc:issued "2012-10-26"^^xsd:date; doap-changeset:released-by ; doap:file-release ; doap:revision "0.100"^^xsd:string. a doap:Version; dc:identifier "Role-Commons-0.101"^^xsd:string; dc:issued "2012-10-26"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Addition; rdfs:label "Provide &Object::AUTHORITY::AUTHORITY function. It seems Web::Magic was relying on it."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.101"^^xsd:string. a doap:Version; dc:identifier "Role-Commons-0.102"^^xsd:string; dc:issued "2014-09-10"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Switch to Dist::Inkt."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.102"^^xsd:string. a doap:Version; dc:identifier "Role-Commons-0.103"^^xsd:string; dc:issued "2014-10-18"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Change; rdfs:label "Stop using Scalar::Does."; ], [ a doap-changeset:Change; rdfs:label "use match::simple."; ], [ a doap-changeset:Change; rdfs:label "Recommend Object::Tap/Object::Util over Role::Commons::Tap."; ], [ a doap-changeset:Removal; rdfs:label "The obsolete authority::shared module is now gone."; ], [ a doap-changeset:Removal; rdfs:label "The obsolete Object::Tap module is now gone (though the namespace has been recycled by MSTROUT)."; ], [ a doap-changeset:Packaging; rdfs:label "Fix dependency information."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.103"^^xsd:string. a doap:Version; rdfs:label "Happy Birthday, Elliott!"; dc:identifier "Role-Commons-0.104"^^xsd:string; dc:issued "2014-10-24"^^xsd:date; doap-changeset:changeset [ doap-changeset:item [ a doap-changeset:Packaging; rdfs:label "Add dependency on Test::Exception."; ]; ]; doap-changeset:released-by ; doap:file-release ; doap:revision "0.104"^^xsd:string. a foaf:Person; foaf:mbox ; foaf:name "Toby Inkster"; foaf:nick "TOBYINK"; foaf:page . 01basic.t000664001750001750 131512422423640 14500 0ustar00taitai000000000000Role-Commons-0.104/tuse Test::More; BEGIN { package Local::Class; use Role::Commons -all; our $AUTHORITY = 'http://www.example.com/'; our $VERSION = '42.0'; sub new { bless [], shift }; sub bumf { 123 }; } my $obj = new_ok 'Local::Class'; can_ok $obj => $_ for qw( AUTHORITY tap object_id does ); is( Local::Class->AUTHORITY, 'http://www.example.com/', 'AUTHORITY get', ); ok( Local::Class->AUTHORITY('http://www.example.com/'), 'AUTHORITY assert', ); ok( !eval { Local::Class->AUTHORITY('http://www.example.net/') }, 'AUTHORITY assert (failure)', ); is( Local::Class->tap('bumf'), 'Local::Class', 'tap', ); isnt( Local::Class->new->object_id, Local::Class->new->object_id, 'object_id', ); done_testing(); 02oaa.t000664001750001750 13612422423640 14140 0ustar00taitai000000000000Role-Commons-0.104/tuse Test::More tests => 1; use Object::AUTHORITY (); can_ok 'Object::AUTHORITY', 'AUTHORITY'; AUTHORITY.pm000664001750001750 100112422423640 16520 0ustar00taitai000000000000Role-Commons-0.104/lib/Objectuse 5.006; use strict; use warnings; package Object::AUTHORITY; our $AUTHORITY = 'cpan:TOBYINK'; our $VERSION = '0.104'; use Role::Commons (); use Role::Commons::Authority (); sub import { shift; my (undef, $opts) = Role::Commons::->parse_arguments(Authority => @_); my @packages = ref $opts->{package} ? @{ $opts->{package} } : ($opts->{package}|| scalar caller); Role::Commons::->import('Authority', -into => $_) for @packages; } *AUTHORITY = Role::Commons::Authority::->can('AUTHORITY'); 1; Commons.pm000664001750001750 1270712422423640 16275 0ustar00taitai000000000000Role-Commons-0.104/lib/Roleuse 5.008; use strict; use warnings; package Role::Commons; use Carp qw[ carp croak ]; use Module::Runtime qw[ use_package_optimistically ]; use Moo::Role qw[]; use Types::TypeTiny qw[ HashLike ArrayLike ]; BEGIN { $Role::Commons::AUTHORITY = 'cpan:TOBYINK'; $Role::Commons::VERSION = '0.104'; } my @ALL = qw( Authority ObjectID Tap ); sub parse_arguments { my $class = shift; # Translate "-all". my $all = 0; my @args = grep { /^\-all$/i ? do { $all++; 0 } : 1 } @_; unshift @args, @ALL if $all; my %roles; my %options; while (my $name = shift @args) { my $details; if ($name =~ /^-/ or ref $args[0]) { $details = shift @args } if ($name =~ /^\-(.+)$/i) { $options{ lc $1 } = $details } else { $roles{ $name } = $details } } carp "Role::Commons - no roles specified" if keys %options && !keys %roles; return(\%roles, \%options); } sub import { my $class = shift; my ($roles, $options) = $class->parse_arguments(@_); $options->{into} = caller unless exists $options->{into}; foreach my $role (sort keys %$roles) { use_package_optimistically( join q[::], $class, $role ); } 'Moo::Role'->apply_roles_to_package( $options->{into}, map { join q[::], $class, $_ } sort keys %$roles, ); foreach my $role (sort keys %$roles) { my $role_pkg = join q[::], $class, $role; my $details = $roles->{$role}; my $setup_method = do { no strict 'refs'; ${"$role_pkg\::setup_for_class"}; } or next; $role_pkg->$setup_method( $options->{into}, HashLike->check($details) ? %$details : ( ArrayLike->check($details) ? @$details : (option => $details) ), ); } } sub apply_roles_to_object { my $class = shift unless blessed($_[0]); my $object = shift; my ($roles, $options) = $class->parse_arguments(@_); foreach my $role (sort keys %$roles) { use_package_optimistically( join q[::], $class, $role ); } 'Moo::Role'->apply_roles_to_object( $object, map { join q[::], $class, $_ } sort keys %$roles, ); foreach my $role (sort keys %$roles) { my $role_pkg = join q[::], $class, $role; my $details = $roles->{$role}; my $setup_method = do { no strict 'refs'; ${"$role_pkg\::setup_for_class"}; } || sub { 0 }; $role_pkg->$setup_method( ref($object), HashLike->check($details) ? %$details : ( ArrayLike->check($details) ? @$details : (option => $details) ), ); $setup_method = do { no strict 'refs'; ${"$role_pkg\::setup_for_object"}; } or next; $role_pkg->$setup_method( $object, HashLike->check($details) ? %$details : ( ArrayLike->check($details) ? @$details : (option => $details) ), ); } } 1; __END__ =head1 NAME Role::Commons - roles that can be commonly used, for the mutual benefit of all =head1 SYNOPSIS use 5.010; { package Local::Class; use Moo; use Role::Commons -all; our $AUTHORITY = 'cpan:JOEBLOGGS'; our $VERSION = '1.000'; } say Local::Class->AUTHORITY if Local::Class->DOES('Role::Commons::Authority'); my $obj = Local::Class->new; say $obj->object_id if $obj->DOES('Role::Commons::ObjectID'); =head1 DESCRIPTION Role-Commons is not yet another implementation of roles. It is a collection of generic, reusable roles that hopefully you will love to apply to your classes. These roles are built using L, so automatically integrate into the L object system if you're using it, but they do not require Moose. The Role::Commons module itself provides shortcuts for applying roles to your package, so that instead of doing: { package Local::Class; use Moo; # or "use Moose" with qw( Role::Commons::Authority Role::Commons::ObjectID ); } You can just do this: { package Local::Class; use Moo; use Role::Commons qw( Authority ObjectID ); } It also handles passing some simple parameters through to the role from the consuming class. (Because Moo doesn't have anything like L.) =begin trustme Not sure if these should be documented or not... =item parse_arguments =item apply_roles_to_object =end trustme =head2 Roles =over =item L Sets up a C method for your class which is conceptually a little like C. =item L Provides an C method for your class which returns a unique identifier for each object. =item L Provides a C method for your class, inspired by Ruby's method of the same name. Helpful for writing chained method calls. =back =head2 Obsolescence Role-Commons is the successor for my older projects: authority-shared, Object-AUTHORITY, Object-DOES, Object-Role, and Object-Tap. Role-Commons bundles L for the sake of backwards compatibility. This is being phased out. =head1 BUGS Please report any bugs to L. =head1 SEE ALSO L, L, L. L, L, L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2012, 2014 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 01basic.t000664001750001750 10312422423640 17246 0ustar00taitai000000000000Role-Commons-0.104/t/Object-AUTHORITYuse Test::More tests => 1; BEGIN { use_ok('Object::AUTHORITY') }; 02return.t000664001750001750 104212422423640 17530 0ustar00taitai000000000000Role-Commons-0.104/t/Object-AUTHORITYpackage Local::MyTest; our $AUTHORITY = 'http://example.net/'; package main; use Test::More tests => 2; use Object::AUTHORITY -package => 'Local::MyTest'; is( Local::MyTest->AUTHORITY, 'http://example.net/', 'test package has correct authority', ); SKIP: { skip "need Moose 2.02", 1 unless eval 'use Moose 2.02; 1;'; skip "Moose seems to have stopped defining an authority", 1 unless defined $Moose::AUTHORITY; Object::AUTHORITY->import(-package => 'Moose'); ok( defined Moose->AUTHORITY, 'Moose has an authority', ); } 03croak.t000664001750001750 144212422423640 17315 0ustar00taitai000000000000Role-Commons-0.104/t/Object-AUTHORITYpackage Local::MyTest; our $AUTHORITY = 'http://example.net/'; package main; use Test::More tests => 7; use Test::Exception; use Object::AUTHORITY -package => 'Local::MyTest'; dies_ok { Local::MyTest->AUTHORITY('cpan:TOBYINK') } 'dies passed string'; dies_ok { Local::MyTest->AUTHORITY(qr/^cpan:/i) } 'dies passed regexp'; dies_ok { Local::MyTest->AUTHORITY(undef) } 'dies passed undef'; dies_ok { Local::MyTest->AUTHORITY(['mailto:joe@example.net' , qr/^cpan:/i]) } 'dies passed arrayref'; lives_ok { Local::MyTest->AUTHORITY('http://example.net/') } 'lives passed string'; lives_ok { Local::MyTest->AUTHORITY(qr/^http:/i) } 'lives passed regexp'; lives_ok { Local::MyTest->AUTHORITY(['mailto:joe@example.net' , qr/^cpan:/i, 'http://example.net/']) } 'lives passed arrayref'; Authority.pm000664001750001750 1116612422423640 20263 0ustar00taitai000000000000Role-Commons-0.104/lib/Role/Commonsuse 5.008; use strict; use warnings; package Role::Commons::Authority; use Carp qw[croak]; use match::simple qw[match]; use Scalar::Util qw[blessed]; BEGIN { use Moo::Role; $Role::Commons::Authority::AUTHORITY = 'cpan:TOBYINK'; $Role::Commons::Authority::VERSION = '0.104'; } our %ENABLE_SHARED; our %SHARED_AUTHORITIES; our $setup_for_class = sub { my ($role, $package, %args) = @_; if ( exists $args{-authorities} ) { $ENABLE_SHARED{ $package } = 1; ref($args{-authorities}) eq 'ARRAY' and $SHARED_AUTHORITIES{ $package } = $args{-authorities}; } }; sub AUTHORITY { my ($invocant, $test) = @_; $invocant = ref $invocant if blessed($invocant); my @authorities = do { no strict 'refs'; my @a = ${"$invocant\::AUTHORITY"}; if (exists $ENABLE_SHARED{ $invocant }) { push @a, @{$SHARED_AUTHORITIES{$invocant} || []}; push @a, @{"$invocant\::AUTHORITIES"}; } @a; }; if (scalar @_ > 1) { my $ok = undef; AUTH: for my $A (@authorities) { if (match($A, $test)) { $ok = $A; last AUTH; } } return $ok if defined $ok; @authorities ? croak("Invocant ($invocant) has authority '$authorities[0]'") : croak("Invocant ($invocant) has no authority defined"); } wantarray ? @authorities : $authorities[0]; } 1; __END__ =head1 NAME Role::Commons::Authority - a class method indicating who published the package =head1 SYNOPSIS package MyApp; use Role::Commons -all; BEGIN { our $AUTHORITY = 'cpan:JOEBLOGGS' }; say MyApp->AUTHORITY; # says "cpan:JOEBLOGGS" MyApp->AUTHORITY("cpan:JOEBLOGGS"); # does nothing much MyApp->AUTHORITY("cpan:JOHNTCITIZEN"); # croaks =head1 DESCRIPTION This module adds an C function to your package, which works along the same lines as the C function. The authority of a package can be defined like this: package MyApp; BEGIN { our $AUTHORITY = 'cpan:JOEBLOGGS' }; The authority should be a URI identifying the person, team, organisation or trained chimp responsible for the release of the package. The pseudo-URI scheme "cpan:" is the most commonly used identifier. =head2 Method =over =item C<< AUTHORITY >> Called with no parameters returns the authority of the module. =item C<< AUTHORITY($test) >> If passed a test, will croak if the test fails. The authority is tested against the test using something approximating Perl 5.10's smart match operator. (Briefly, you can pass a string for eq comparison, a regular expression, a code reference to use as a callback, or an array reference that will be grepped.) =back =head2 Multiple Authorities This module allows you to indicate that your module is issued by multiple authorities. The package variable C<< $AUTHORITY >> should still be used to indicate the primary authority for the package. package MyApp; use Role::Commons Authority => { -authorities => [qw( cpan:ALICE cpan:BOB )] }; BEGIN { $MyApp::AUTHORITY = 'cpan:JOE'; } package main; use feature qw(say); say scalar MyApp->AUTHORITY; # says "cpan:JOE" MyApp->AUTHORITY('cpan:JOE'); # lives MyApp->AUTHORITY('cpan:ALICE'); # lives MyApp->AUTHORITY('cpan:BOB'); # lives MyApp->AUTHORITY('cpan:CAROL'); # croaks The main use case for shared authorities is for team projects. The team would designate a URI to represent the team as a whole. For example, C<< http://datetime.perl.org/ >>, C<< http://moose.iinteractive.com/ >> or C<< http://www.perlrdf.org/ >>. Releases can then be officially stamped with the authority of the team. And users can check they have an module released by the official team using: RDF::TakeOverTheWorld->AUTHORITY( q, ); which will croak if package RDF::TakeOverTheWorld doesn't have the specified authority. =head1 BUGS An obvious limitation is that this module relies on honesty. Don't release modules under authorities you have no authority to use. Please report any bugs to L. =head1 SEE ALSO L, L. Background reading: L, L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2012, 2014 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. ObjectID.pm000664001750001750 303312422423640 17670 0ustar00taitai000000000000Role-Commons-0.104/lib/Role/Commonsuse 5.008; use strict; use warnings; package Role::Commons::ObjectID; BEGIN { use Moo::Role; $Role::Commons::ObjectID::AUTHORITY = 'cpan:TOBYINK'; $Role::Commons::ObjectID::VERSION = '0.104'; } # deliberately load this *after* Moo::Role use Object::ID qw( object_id ); our $setup_for_class = sub { my ($role, $package, %args) = @_; }; 1; __END__ =head1 NAME Role::Commons::Authority - an object method providing a unique identifier =head1 SYNOPSIS use v5.14; package Person 1.0 { use Moo; use Role::Commons -all; has name => (is => 'ro'); }; my $bob1 = Person->new(name => "Bob"); my $bob2 = Person->new(name => "Bob"); say $bob1->object_id; # an identifier say $bob2->object_id; # a different identifier =head1 DESCRIPTION This is a tiny shim between L and L (and hence L/L too). =head1 BUGS Please report any bugs to L. =head1 SEE ALSO L, L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2012, 2014 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. Tap.pm000664001750001750 1271312422423640 17016 0ustar00taitai000000000000Role-Commons-0.104/lib/Role/Commonsuse 5.008; use strict; use warnings; package Role::Commons::Tap; use Carp qw[croak]; BEGIN { use Moo::Role; $Role::Commons::Tap::AUTHORITY = 'cpan:TOBYINK'; $Role::Commons::Tap::VERSION = '0.104'; } our $setup_for_class = sub { my ($role, $package, %args) = @_; return 0; }; sub tap { my $self = shift; my %flags; PARAM: while (@_) { my $next = shift; if (ref($next) eq 'CODE' or not ref $next) { my $args = ref($_[0]) eq 'ARRAY' ? shift : []; my $code = ref $next ? $next : sub { $self->$next(@_) }; if ($flags{ EVAL }) { local $_ = $self; eval { $code->(@$args) } } else { local $_ = $self; do { $code->(@$args) } } next PARAM; } if (ref($next) eq 'SCALAR') { if ($$next =~ m{^(no_?)?(.+)$}i) { $flags{ uc $2 } = $1 ? 0 : 1; next PARAM; } } croak qq/Unsupported parameter to tap: $next/; } return $self; } 1; __END__ =head1 NAME Role::Commons::Tap - an object method which helps with chaining, inspired by Ruby =head1 SYNOPSIS # This fails because the "post" method doesn't return # $self; it returns an HTTP::Request object. # LWP::UserAgent -> new -> post('http://www.example.com/submit', \%data) -> get('http://www.example.com/status'); # The 'tap' method runs some code and always returns $self. # LWP::UserAgent -> new -> tap(post => [ 'http://www.example.com/submit', \%data ]) -> get('http://www.example.com/status'); # Or use a coderef... # LWP::UserAgent -> new -> tap(sub { $_->post('http://www.example.com/submit', \%data) }) -> get('http://www.example.com/status'); =head1 DESCRIPTION B<< DO NOT USE THIS MODULE! >> Use L or L instead. They are not drop-in replacements, but a far more sensible way to have a C method. This module has nothing to do with the Test Anything Protocol (TAP, see L). This module is a role for your class, providing it with a C method. The C method is an aid to chaining. You can do for example: $object ->tap( sub{ $_->foo(1) } ) ->tap( sub{ $_->bar(2) } ) ->tap( sub{ $_->baz(3) } ); ... without worrying about what the C, C and C methods return, because C always returns its invocant. The C method also provides a few shortcuts, so that the above can actually be written: $object->tap(foo => [1], bar => [2], baz => [3]); ... but more about that later. Anyway, this module provides one method for your class - C - which is described below. =head2 C<< tap(@arguments) >> This can be called as an object or class method, but is usually used as an object method. Each argument is processed in the order given. It is processed differently, depending on the kind of argument it is. =head3 Coderef arguments An argument that is a coderef (or a blessed argument that overloads C<< &{} >> - see L) will be executed in a context where C<< $_ >> has been set to the invocant of the tap method C. The return value of the coderef is ignored. For example: { package My::Class; use Role::Commons qw(Tap); } print My::Class->tap( sub { warn uc $_; return 'X' }, ); ... will warn "MY::CLASS" and then print "My::Class". Because each argument to C is processed in order, you can provide multiple coderefs: print My::Class->tap( sub { warn uc $_; return 'X' }, sub { warn lc $_; return 'Y' }, ); =head3 String arguments A non-reference argument (i.e. a string) is treated as a shortcut for a method call on the invocant. That is, the following two taps are equivalent: $object->tap( sub{$_->foo(@_)} ); $object->tap( 'foo' ); =head3 Arrayref arguments An arrayref is dereferenced yielding a list. This list is passed as an argument list when executing the previous coderef argument (or string argument). The following three taps are equivalent: $object->tap( sub { $_->foo('bar', 'baz') }, ); $object->tap( sub { $_->foo(@_) }, ['bar', 'baz'], ); $object->tap( foo => ['bar', 'baz'], ); =head3 Scalar ref arguments There are a handful of special scalar ref arguments that are supported: =over =item C<< \"EVAL" >> This indicates that you wish for all subsequent coderefs to be wrapped in an C, making any errors that occur within it non-fatal. $object->tap(\"EVAL", sub {...}); =item C<< \"NO_EVAL" >> Switches back to the default behaviour of not wrapping coderefs in C. $object->tap( \"EVAL", sub {...}, # any fatal errors will be caught and ignored \"NO_EVAL", sub {...}, # fatal errors are properly fatal again. ); =back =head1 BUGS Please report any bugs to L. =head1 SEE ALSO L, L. L. L, L. =head1 AUTHOR Toby Inkster Etobyink@cpan.orgE. =head1 COPYRIGHT AND LICENCE This software is copyright (c) 2012, 2014 by Toby Inkster. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 DISCLAIMER OF WARRANTIES THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.