CONTRIBUTING 000664 001750 001750 6146 12374366723 14001 0 ustar 00tai tai 000000 000000 MooX-late-0.015 NAME
CONTRIBUTING
DESCRIPTION
If you're reading this document, that means you might be thinking about
helping me out with this project. Thanks!
Here's some ways you could help out:
* Bug reports
Found a bug? Great! (Well, not so great I suppose.)
The place to report them is . Don't e-mail me
about it, as your e-mail is more than likely to get lost amongst the
spam.
An example script clearly demonstrating the bug (preferably written
using Test::More) would be greatly appreciated.
* Patches
If you've found a bug and written a fix for it, even better!
Generally speaking you should check out the latest copy of the code
from the source repository rather than using the CPAN distribution.
The file META.yml should contain a link to the source repository. If
not, then try or submit a bug report.
(As far as I'm concerned the lack of a link is a bug.) Many of my
distributions are also mirrored at .
To submit the patch, do a pull request on GitHub or Bitbucket, or
attach a diff file to a bug report. Unless otherwise stated, I'll
assume that your contributions are licensed under the same terms as
the rest of the project.
(If using git, feel free to work in a branch. For Mercurial, I'd
prefer bookmarks within the default branch.)
* Documentation
If there's anything unclear in the documentation, please submit this
as a bug report or patch as above.
Non-toy example scripts that I can bundle would also be appreciated.
* Translation
Translations of documentation would be welcome.
For translations of error messages and other strings embedded in the
code, check with me first. Sometimes the English strings may not in
a stable state, so it would be a waste of time translating them.
Coding Style
I tend to write using something approximating the Allman style, using
tabs for indentation and Unix-style line breaks.
*
*
I nominally encode all source files as UTF-8, though in practice most of
them use a 7-bit-safe ASCII-compatible subset of UTF-8.
AUTHOR
Toby Inkster .
COPYRIGHT AND LICENCE
Copyright (c) 2012-2014 by Toby Inkster.
CONTRIBUTING is available under three different licences permitting its
redistribution: the CC-BY-SA_UK-2.0 licence, plus the same licences as
Perl itself, which is distributed under the GNU General Public Licence
version 1, and the Artistic Licence.
This file is licensed under the Creative Commons Attribution-ShareAlike
2.0 UK: England & Wales License. To view a copy of this license, visit
.
This file is free software; you can redistribute it and/or modify it
under the same terms as the Perl 5 programming language system itself.
COPYRIGHT 000664 001750 001750 2660 12374366723 13437 0 ustar 00tai tai 000000 000000 MooX-late-0.015 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: MooX-late
Upstream-Contact: and Toby Inkster (TOBYINK)
Source: https://metacpan.org/release/MooX-late
Files: CONTRIBUTING
INSTALL
LICENSE
TODO
examples/simple.pl
Copyright: Unknown
License: Unknown
Files: t/01basic.t
t/02inflation.t
t/03invalid_tc.t
t/04arrayofattrs.t
Copyright: This software is copyright (c) 2012-2013 by Toby Inkster.
License: GPL-1.0+ or Artistic-1.0
Files: t/05haveimissedanytypes.t
t/06handlesvia.t
t/07coerce1.t
t/08doesrole.t
Copyright: This software is copyright (c) 2013 by Toby Inkster.
License: GPL-1.0+ or Artistic-1.0
Files: Changes
META.json
META.yml
doap.ttl
Copyright: Copyright 2014 Toby Inkster.
License: GPL-1.0+ or Artistic-1.0
Files: COPYRIGHT
CREDITS
SIGNATURE
Copyright: None
License: public-domain
Files: Makefile.PL
dist.ini
Copyright: Copyright 2013 Toby Inkster.
License: GPL-1.0+ or Artistic-1.0
Files: README
lib/MooX/late.pm
Copyright: This software is copyright (c) 2012-2014 by 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
CREDITS 000664 001750 001750 137 12374366720 13136 0 ustar 00tai tai 000000 000000 MooX-late-0.015 Maintainer:
- Toby Inkster (TOBYINK)
Thanks:
- SHLOMIF
Changes 000664 001750 001750 5146 12374366720 13436 0 ustar 00tai tai 000000 000000 MooX-late-0.015 MooX-late
=========
Created: 2012-11-30
Home page:
Bug tracker:
Maintainer: Toby Inkster (TOBYINK)
0.015 2013-08-18
[ Documentation ]
- Make the list of stuff this module does more concise.
[ Test Suite ]
- Improve test cases for class type constraints.
[ Packaging ]
- Depend on Moo 1.006000.
- Depend on Type::Utils 1.000001.
[ Other ]
- Removed: Drop support for `coerce => 1` because Moo 1.006000 supports
this natively now.
0.014 2013-07-16
- Added: Support `coerce => 1` for Type::Tiny type constraints and those
providing a similar API.
0.013 2013-07-16
- Added: Support Moose attribute traits using MooX::HandlesVia.
- Removed: Retire support for non-reference attribute defaults because Moo
now does this natively.
- Updated: Use Type::Utils::dwim_type to translate strings to type
constraint expressions.
0.012 2013-06-28
- Updated: Use Type::Registry/Type::Parser to translate strings to type
constraint expressions.
0.011 2013-04-27
[ Bug Fixes ]
- Fix support for class types.
SHLOMIF++
0.010 2013-04-23
[ Bug Fixes ]
- Fix support for Maybe[`a] type constraint. (It was being interpreted as
an object blessed into package 'Maybe'.)
SHLOMIF++
0.009 2013-04-15
- Updated: Switch from MooX::Types::MooseLike::Base to Types::Standard.
0.008 2013-03-11
[ Documentation ]
- Minor documentation updates.
[ Packaging ]
- Make MooX::Types::MooseLike::Base a required dependency (was optional).
0.007 2012-12-26
[ Documentation ]
- Documentation for use with Moo::Role.
SHLOMIF++
- Link to MooX::HandlesVia on github.
0.006 2012-12-11
[ Bug Fixes ]
- Skip t/02inflation.t if no MooX::Types::MooseLike::Base.
0.005 2012-12-09
[ Bug Fixes ]
- Cope with has \@attributes => (...).
[ Documentation ]
- Document test suite.
[ Packaging ]
- Bump required version of Moo to 1.000004.
0.004 2012-12-03
- Added: Issue warnings when type constraint cannot be interpreted
correctly. Warning is not issued at the time the attribute is built, but
the first time the type constraint is checked against. Don't attempt to
inflate these type constraints when Moose is loaded.
0.003 2012-12-02
- Added: Inflation of type constraints to Moose.
- General refactoring of type constraint code.
- Use MooX::Types::MooseLike::Base for type checks.
0.002 2012-12-02
[ Bug Fixes ]
- use re 'eval' on Perl 5.8 to fix regexp compilation problem
0.001 2012-12-01 Initial release
INSTALL 000664 001750 001750 1653 12374366717 13201 0 ustar 00tai tai 000000 000000 MooX-late-0.015 Installing MooX-late should be straightforward.
INSTALLATION WITH CPANMINUS
If you have cpanm, you only need one line:
% cpanm MooX::late
If you are installing into a system-wide directory, you may need to pass
the "-S" flag to cpanm, which uses sudo to install the module:
% cpanm -S MooX::late
INSTALLATION WITH THE CPAN SHELL
Alternatively, if your CPAN shell is set up, you should just be able to
do:
% cpan MooX::late
MANUAL INSTALLATION
As a last resort, you can manually install it. Download the tarball and
unpack it.
Consult the file META.json for a list of pre-requisites. Install these
first.
To build MooX-late:
% perl Makefile.PL
% make && make test
Then install it:
% make install
If you are installing into a system-wide directory, you may need to run:
% sudo make install
LICENSE 000664 001750 001750 43655 12374366717 13205 0 ustar 00tai tai 000000 000000 MooX-late-0.015 This software is copyright (c) 2014 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
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
MANIFEST 000664 001750 001750 463 12374366723 13254 0 ustar 00tai tai 000000 000000 MooX-late-0.015 CONTRIBUTING
COPYRIGHT
CREDITS
Changes
INSTALL
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
SIGNATURE
TODO
dist.ini
doap.ttl
examples/simple.pl
lib/MooX/late.pm
t/01basic.t
t/02inflation.t
t/03invalid_tc.t
t/04arrayofattrs.t
t/05haveimissedanytypes.t
t/06handlesvia.t
t/07coerce1.t
t/08doesrole.t
META.json 000664 001750 001750 3743 12374366723 13570 0 ustar 00tai tai 000000 000000 MooX-late-0.015 {
"abstract" : "easily translate Moose code to Moo",
"author" : [
"Toby Inkster (TOBYINK) ",
""
],
"dynamic_config" : 0,
"generated_by" : "Dist::Inkt::Profile::TOBYINK version 0.016, CPAN::Meta::Converter version 2.140640",
"keywords" : [],
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "2"
},
"name" : "MooX-late",
"no_index" : {
"directory" : [
"eg",
"examples",
"inc",
"t",
"xt"
]
},
"optional_features" : {},
"prereqs" : {
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "6.17"
}
},
"runtime" : {
"recommends" : {
"MooX::HandlesVia" : "0.001004"
},
"requires" : {
"Moo" : "1.006000",
"Type::Utils" : "1.000001"
},
"suggests" : {
"MooX" : "0"
}
},
"test" : {
"requires" : {
"Test::Fatal" : "0.010",
"Test::More" : "0.96",
"Test::Requires" : "0.06"
}
}
},
"provides" : {
"MooX::late" : {
"file" : "lib/MooX/late.pm",
"version" : "0.015"
},
"MooX::late::DefinitionContext" : {
"file" : "lib/MooX/late.pm",
"version" : "0.015"
}
},
"release_status" : "stable",
"resources" : {
"X_identifier" : "http://purl.org/NET/cpan-uri/dist/MooX-late/project",
"bugtracker" : {
"web" : "http://rt.cpan.org/Dist/Display.html?Queue=MooX-late"
},
"homepage" : "https://metacpan.org/release/MooX-late",
"license" : [
"http://dev.perl.org/licenses/"
],
"repository" : {
"type" : "git",
"url" : "git://github.com/tobyink/p5-moox-late.git",
"web" : "https://github.com/tobyink/p5-moox-late"
}
},
"version" : "0.015"
}
META.yml 000664 001750 001750 2212 12374366723 13406 0 ustar 00tai tai 000000 000000 MooX-late-0.015 ---
abstract: 'easily translate Moose code to Moo'
author:
- 'Toby Inkster (TOBYINK) '
- unknown
build_requires:
Test::Fatal: '0.010'
Test::More: '0.96'
Test::Requires: '0.06'
configure_requires:
ExtUtils::MakeMaker: '6.17'
dynamic_config: 0
generated_by: 'Dist::Inkt::Profile::TOBYINK version 0.016, CPAN::Meta::Converter version 2.140640'
keywords: []
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: MooX-late
no_index:
directory:
- eg
- examples
- inc
- t
- xt
optional_features: {}
provides:
MooX::late:
file: lib/MooX/late.pm
version: '0.015'
MooX::late::DefinitionContext:
file: lib/MooX/late.pm
version: '0.015'
recommends:
MooX::HandlesVia: '0.001004'
requires:
Moo: '1.006000'
Type::Utils: '1.000001'
resources:
X_identifier: http://purl.org/NET/cpan-uri/dist/MooX-late/project
bugtracker: http://rt.cpan.org/Dist/Display.html?Queue=MooX-late
homepage: https://metacpan.org/release/MooX-late
license: http://dev.perl.org/licenses/
repository: git://github.com/tobyink/p5-moox-late.git
version: '0.015'
Makefile.PL 000664 001750 001750 12115 12374366723 14132 0 ustar 00tai tai 000000 000000 MooX-late-0.015 use strict;
use ExtUtils::MakeMaker 6.17;
my $EUMM = eval( $ExtUtils::MakeMaker::VERSION );
my $meta = {
"abstract" => "easily translate Moose code to Moo",
"author" => ["Toby Inkster (TOBYINK) ", "unknown"],
"dynamic_config" => 0,
"generated_by" => "Dist::Inkt::Profile::TOBYINK version 0.016, CPAN::Meta::Converter version 2.140640",
"keywords" => [],
"license" => ["perl_5"],
"meta-spec" => {
url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
version => 2,
},
"name" => "MooX-late",
"no_index" => { directory => ["eg", "examples", "inc", "t", "xt"] },
"prereqs" => {
configure => { requires => { "ExtUtils::MakeMaker" => 6.17 } },
runtime => {
recommends => { "MooX::HandlesVia" => 0.001004 },
requires => { "Moo" => "1.006000", "Type::Utils" => 1.000001 },
suggests => { MooX => 0 },
},
test => {
requires => {
"Test::Fatal" => "0.010",
"Test::More" => 0.96,
"Test::Requires" => 0.06,
},
},
},
"provides" => {
"MooX::late" => { file => "lib/MooX/late.pm", version => 0.015 },
"MooX::late::DefinitionContext" => { file => "lib/MooX/late.pm", version => 0.015 },
},
"release_status" => "stable",
"resources" => {
bugtracker => { web => "http://rt.cpan.org/Dist/Display.html?Queue=MooX-late" },
homepage => "https://metacpan.org/release/MooX-late",
license => ["http://dev.perl.org/licenses/"],
repository => {
type => "git",
url => "git://github.com/tobyink/p5-moox-late.git",
web => "https://github.com/tobyink/p5-moox-late",
},
X_identifier => "http://purl.org/NET/cpan-uri/dist/MooX-late/project",
},
"version" => 0.015,
};
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);
README 000664 001750 001750 10037 12374366717 13044 0 ustar 00tai tai 000000 000000 MooX-late-0.015 NAME
MooX::late - easily translate Moose code to Moo
SYNOPSIS
package Foo;
use Moo;
use MooX::late;
has bar => (is => "ro", isa => "Str", default => "MacLaren's Pub");
(Examples for Moo roles in section below.)
DESCRIPTION
Moo is a light-weight object oriented programming framework which aims to
be compatible with Moose. It does this by detecting when Moose has been
loaded, and automatically "inflating" its classes and roles to full Moose
classes and roles. This way, Moo classes can consume Moose roles, Moose
classes can extend Moo classes, and so forth.
However, the surface syntax of Moo differs somewhat from Moose. For
example the `isa` option when defining attributes in Moose must be either
a string or a blessed Moose::Meta::TypeConstraint object; but in Moo must
be a coderef. These differences in surface syntax make porting code from
Moose to Moo potentially tricky. MooX::late provides some assistance by
enabling a slightly more Moosey surface syntax.
MooX::late does the following:
1. Supports `isa => $stringytype`.
2. Supports `does => $rolename` .
3. Supports `lazy_build => 1`.
4. Exports `blessed` and `confess` functions to your namespace.
5. Handles certain attribute traits. Currently `Hash`, `Array` and `Code`
are supported. This feature requires MooX::HandlesVia.
`String`, `Number`, `Counter` and `Bool` are unlikely to ever be
supported because of internal implementation details of Moo. If you
need another attribute trait to be supported, let me know and I will
consider it.
Five features. It is not the aim of `MooX::late` to make every aspect of
Moo behave exactly identically to Moose. It's just going after the
low-hanging fruit. So it does five things right now, and I promise that
future versions will never do more than seven.
Previous releases of MooX::late added support for `coerce => 1` and
`default => $nonref`. These features have now been added to Moo itself, so
MooX::late no longer has to deal with them.
Use in Moo::Roles
MooX::late should work in Moo::Roles, with no particular caveats.
package MyRole;
use Moo::Role;
use MooX::late;
Package::Variant can be used to build the Moo equivalent of parameterized
roles. MooX::late should work in roles built with Package::Variant.
use Package::Variant
importing => [ qw( Moo::Role MooX::late ) ],
subs => [ qw( has with ) ];
Type constraints
Type constraint strings are interpreted using Type::Parser, using the type
constraints defined in Types::Standard. This provides a very slight
superset of Moose's type constraint syntax and built-in type constraints.
Any unrecognized string that looks like it might be a class name is
interpreted as a class type constraint.
Subclassing
MooX::late is designed to be reasonably easy to subclass. There are
comments in the source code explaining hooks for extensibility.
BUGS
Please report any bugs to
.
SEE ALSO
`MooX::late` uses Types::Standard to check type constraints.
`MooX::late` uses MooX::HandlesVia to provide native attribute traits
support.
The following modules bring additional Moose functionality to Moo:
* MooX::Override - support override/super
* MooX::Augment - support augment/inner
MooX allows you to load Moo plus multiple MooX extension modules in a
single line.
AUTHOR
Toby Inkster .
COPYRIGHT AND LICENCE
This software is copyright (c) 2012-2014 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.
SIGNATURE 000664 001750 001750 4104 12374366724 13424 0 ustar 00tai tai 000000 000000 MooX-late-0.015 This 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 33317486c4fa2cf7fec85bf92ed38ac0f64233a0 CONTRIBUTING
SHA1 10a180a41f91e5461699b5a32d83af4eb2019063 COPYRIGHT
SHA1 502c559978c40e9248b93b179985933644ebfca1 CREDITS
SHA1 d540676247c6223ce63af2e24dd27ec597172804 Changes
SHA1 4b001f59d6016da8f1dd32e32c92340d098f4e4d INSTALL
SHA1 34f5e12514b91055de4b164a1f2327ef5c30ba53 LICENSE
SHA1 116b15d3035daeef65599f9c3d17da12a8a16b6e MANIFEST
SHA1 95d62b7d820562b9cab86d1ef25e85e71b481bf1 META.json
SHA1 f1b3c39140ce0efa4863837742633fc63b563a06 META.yml
SHA1 5f987fbb0941e6958dfe94859126be66ee4f3a5a Makefile.PL
SHA1 848b6a996d0e479d6cc8d279214891df84843e44 README
SHA1 82a5dbef757dbba311ab59332cd5c3092dc1dc4a TODO
SHA1 19114c43d58f7b89287f77b0a2318ea72d7d9983 dist.ini
SHA1 0f0783dd1b2c74f19c23c34f224ef959b45d5c4b doap.ttl
SHA1 6c115a020133c60ececeae3b2fde21abdcb83179 examples/simple.pl
SHA1 eb8f9f75bbec3fce01fae54dec155d3189867439 lib/MooX/late.pm
SHA1 f8833de7f2ab9f1d40f29c32943da5d513d7e623 t/01basic.t
SHA1 888f8a494a4d43c821e6bc581d59f577859b0c5d t/02inflation.t
SHA1 ff6dd69d308062933193712fe88abad29490838c t/03invalid_tc.t
SHA1 904411100b6e3c06629020bb2bc52eeca3afa802 t/04arrayofattrs.t
SHA1 de4ffc50f992e994565223480950ced4456976e2 t/05haveimissedanytypes.t
SHA1 7a6b642014d821f39bca5c5570b17ed8805843e1 t/06handlesvia.t
SHA1 5367c78be6846f7f71fcdbbc77a4a9495e024451 t/07coerce1.t
SHA1 066a4a083faf2ec211c72d346e0ab7ad6a710f95 t/08doesrole.t
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iEYEARECAAYFAlPx7dQACgkQzr+BKGoqfTnS2gCffhbs29dRF02DkXg+eMRqw1MU
ZhIAmwR7bblwp6hX4jU76hcv3e+MGE/5
=kcLS
-----END PGP SIGNATURE-----
TODO 000664 001750 001750 227 12374366717 12614 0 ustar 00tai tai 000000 000000 MooX-late-0.015 - make (handles => $rolename) work for Moo classes consuming Moose roles.
- mst has given me the go-ahead to do this in Moo directly rather than here
dist.ini 000664 001750 001750 146 12374366717 13570 0 ustar 00tai tai 000000 000000 MooX-late-0.015 ; Configuration file for Dist::Inkt
;
;; class = 'Dist::Inkt::Profile::TOBYINK'
;; name = 'MooX-late'
doap.ttl 000664 001750 001750 32737 12374366723 13644 0 ustar 00tai tai 000000 000000 MooX-late-0.015 @prefix dc: .
@prefix doap: .
@prefix doap-bugs: .
@prefix doap-changeset: .
@prefix doap-deps: .
@prefix foaf: .
@prefix rdfs: .
@prefix xsd: .
dc:title "the same terms as the perl 5 programming language system itself".
a doap:Project;
dc:contributor ;
doap-deps:runtime-recommendation [
doap-deps:on "MooX::HandlesVia 0.001004"^^doap-deps:CpanId;
];
doap-deps:runtime-requirement [ doap-deps:on "Moo 1.006000"^^doap-deps:CpanId ], [
doap-deps:on "Type::Utils 1.000001"^^doap-deps:CpanId;
];
doap-deps:runtime-suggestion [ doap-deps:on "MooX"^^doap-deps:CpanId ];
doap-deps:test-requirement [ doap-deps:on "Test::More 0.96"^^doap-deps:CpanId ], [
doap-deps:on "Test::Requires 0.06"^^doap-deps:CpanId;
], [ doap-deps:on "Test::Fatal 0.010"^^doap-deps:CpanId ];
doap:bug-database ;
doap:created "2012-11-30"^^xsd:date;
doap:developer ;
doap:download-page ;
doap:homepage ;
doap:license ;
doap:maintainer ;
doap:name "MooX-late";
doap:programming-language "Perl";
doap:release , , , , , , , , , , , , , , ;
doap:repository [
a doap:GitRepository;
doap:browse ;
];
doap:shortdesc "easily translate Moose code to Moo".
a doap:Version;
rdfs:label "Initial release";
dc:identifier "MooX-late-0.001"^^xsd:string;
dc:issued "2012-12-01"^^xsd:date;
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.001"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.002"^^xsd:string;
dc:issued "2012-12-02"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Bugfix;
rdfs:label "use re 'eval' on Perl 5.8 to fix regexp compilation problem";
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.002"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.003"^^xsd:string;
dc:issued "2012-12-02"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Addition;
rdfs:label "Inflation of type constraints to Moose.";
], [
a doap-changeset:Change;
rdfs:label "Use MooX::Types::MooseLike::Base for type checks.";
], [
a doap-changeset:Change;
rdfs:label "General refactoring of type constraint code.";
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.003"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.004"^^xsd:string;
dc:issued "2012-12-03"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Addition;
rdfs:label "Issue warnings when type constraint cannot be interpreted correctly. Warning is not issued at the time the attribute is built, but the first time the type constraint is checked against. Don't attempt to inflate these type constraints when Moose is loaded.";
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.004"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.005"^^xsd:string;
dc:issued "2012-12-09"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Packaging;
rdfs:label "Bump required version of Moo to 1.000004.";
], [
a doap-changeset:Documentation;
rdfs:label "Document test suite.";
], [
a doap-changeset:Bugfix;
rdfs:label "Cope with has \\@attributes => (...).";
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.005"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.006"^^xsd:string;
dc:issued "2012-12-11"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Bugfix;
rdfs:label "Skip t/02inflation.t if no MooX::Types::MooseLike::Base.";
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.006"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.007"^^xsd:string;
dc:issued "2012-12-26"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Documentation;
rdfs:label "Link to MooX::HandlesVia on github.";
], [
a doap-changeset:Documentation;
rdfs:label "Documentation for use with Moo::Role.";
doap-changeset:thanks ;
rdfs:seeAlso ;
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.007"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.008"^^xsd:string;
dc:issued "2013-03-11"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Documentation;
rdfs:label "Minor documentation updates.";
], [
a doap-changeset:Packaging;
rdfs:label "Make MooX::Types::MooseLike::Base a required dependency (was optional).";
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.008"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.009"^^xsd:string;
dc:issued "2013-04-15"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Update;
rdfs:label "Switch from MooX::Types::MooseLike::Base to Types::Standard.";
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.009"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.010"^^xsd:string;
dc:issued "2013-04-23"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Bugfix;
rdfs:label "Fix support for Maybe[`a] type constraint. (It was being interpreted as an object blessed into package 'Maybe'.)";
doap-changeset:fixes [
doap-bugs:affects ;
doap-bugs:reporter ;
];
doap-changeset:thanks ;
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.010"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.011"^^xsd:string;
dc:issued "2013-04-27"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Bugfix;
rdfs:label "Fix support for class types.";
doap-changeset:fixes [
doap-bugs:affects , ;
doap-bugs:reporter ;
];
doap-changeset:thanks ;
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.011"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.012"^^xsd:string;
dc:issued "2013-06-28"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Update;
rdfs:label "Use Type::Registry/Type::Parser to translate strings to type constraint expressions.";
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.012"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.013"^^xsd:string;
dc:issued "2013-07-16"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Update;
rdfs:label "Use Type::Utils::dwim_type to translate strings to type constraint expressions.";
], [
a doap-changeset:Addition;
rdfs:label "Support Moose attribute traits using MooX::HandlesVia.";
], [
a doap-changeset:Removal;
rdfs:label "Retire support for non-reference attribute defaults because Moo now does this natively.";
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.013"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.014"^^xsd:string;
dc:issued "2013-07-16"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Addition;
rdfs:label "Support `coerce => 1` for Type::Tiny type constraints and those providing a similar API.";
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.014"^^xsd:string.
a doap:Version;
dc:identifier "MooX-late-0.015"^^xsd:string;
dc:issued "2013-08-18"^^xsd:date;
doap-changeset:changeset [
doap-changeset:item [
a doap-changeset:Documentation;
rdfs:label "Make the list of stuff this module does more concise.";
], [
a doap-changeset:Removal;
rdfs:label "Drop support for `coerce => 1` because Moo 1.006000 supports this natively now.";
], [
a doap-changeset:Packaging;
rdfs:label "Depend on Type::Utils 1.000001.";
], [
a doap-changeset:Packaging;
rdfs:label "Depend on Moo 1.006000.";
], [
a doap-changeset:Tests;
rdfs:label "Improve test cases for class type constraints.";
];
];
doap-changeset:released-by ;
doap:file-release ;
doap:revision "0.015"^^xsd:string.
a foaf:Person;
foaf:nick "SHLOMIF";
foaf:page .
a foaf:Person;
foaf:mbox ;
foaf:name "Toby Inkster";
foaf:nick "TOBYINK";
foaf:page .
simple.pl 000664 001750 001750 202 12374366717 15561 0 ustar 00tai tai 000000 000000 MooX-late-0.015/examples package Foo;
use Moo;
use MooX::late;
has bar => (is => 'ro', isa => 'Str|ArrayRef[Int|Num]|Int');
Foo->new(bar => [1, '2o', 3])
01basic.t 000664 001750 001750 2235 12374366717 14017 0 ustar 00tai tai 000000 000000 MooX-late-0.015/t =head1 PURPOSE
Check that basic usage of MooX::late works.
=head1 AUTHOR
Toby Inkster Etobyink@cpan.orgE.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2012-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 Local::Role;
use Moo::Role;
use MooX::late;
has foo => (is => 'ro', isa => 'Str', default => 'foo');
}
{
package Local::Class;
use Moo;
use MooX::late;
with 'Local::Role';
has bar => (is => 'ro', isa => 'Str', default => 'bar');
}
my $o1 = Local::Class->new;
is($o1->foo, 'foo');
is($o1->bar, 'bar');
my $o2 = Local::Class->new(foo => 'bar', bar => 'foo');
is($o2->foo, 'bar');
is($o2->bar, 'foo');
ok not eval {
Local::Class->new(foo => []);
};
ok not eval {
Local::Class->new(bar => []);
};
{
package Local::Other;
use Moo;
use MooX::late;
has foo => (is => 'ro', lazy_build => 1);
sub _build_foo { 'foo' };
}
my $o = Local::Other->new;
ok( not $o->has_foo );
is( $o->foo, 'foo' );
ok( $o->has_foo );
$o->clear_foo;
ok( not $o->has_foo );
done_testing;
02inflation.t 000664 001750 001750 1614 12374366717 14722 0 ustar 00tai tai 000000 000000 MooX-late-0.015/t =head1 PURPOSE
Check that our type constraints are correctly inflated to Moose type
constraints.
=head1 AUTHOR
Toby Inkster Etobyink@cpan.orgE.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2012-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;
BEGIN {
package Local::Class;
use Moo;
use MooX::late;
has foo => (is => 'ro', isa => 'Str', default => 'foo');
};
my $isa = "Moo"->_constructor_maker_for("Local::Class")->all_attribute_specs->{foo}{isa};
note explain($isa);
ok not eval {
my $obj = "Local::Class"->new(foo => [])
};
eval {
require Moose;
my $foo = "Local::Class"->meta->get_attribute('foo');
note explain($foo->type_constraint);
is(
$foo->type_constraint->name,
'Str',
);
};
done_testing;
03invalid_tc.t 000664 001750 001750 1244 12374366717 15053 0 ustar 00tai tai 000000 000000 MooX-late-0.015/t =head1 PURPOSE
Check that we get error messages about unrecognisable type constraints.
=head1 AUTHOR
Toby Inkster Etobyink@cpan.orgE.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2012-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;
$@ = undef;
ok !eval q {
# line 1 "embedded"
package Foo;
use Moo;
use MooX::late;
has foo => (is => 'ro', isa => 'X Y Z', required => 0);
1;
};
like(
$@,
qr{^Unexpected tail on type expression: Y Z},
'error message looks ok',
);
done_testing;
04arrayofattrs.t 000664 001750 001750 1752 12374366717 15465 0 ustar 00tai tai 000000 000000 MooX-late-0.015/t =head1 PURPOSE
Test that this works:
has \@attributes => (...);
Specifically we test is for C as that's a kinda interesting
one.
=head1 AUTHOR
Toby Inkster Etobyink@cpan.orgE.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2012-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 Local::Role;
use Moo::Role;
use MooX::late;
has [qw(foo1 foo2)] => (is => 'ro', isa => 'Str', lazy_build => 1);
sub _build_foo1 { 'foo1' };
sub _build_foo2 { 'foo2' };
}
{
package Local::Class;
use Moo;
use MooX::late;
with 'Local::Role';
has [qw(bar1 bar2)] => (is => 'ro', isa => 'Str', lazy_build => 1);
sub _build_bar1 { 'bar1' };
sub _build_bar2 { 'bar2' };
}
my $o1 = Local::Class->new;
is($o1->foo1, 'foo1');
is($o1->foo2, 'foo2');
is($o1->bar1, 'bar1');
is($o1->bar2, 'bar2');
done_testing;
05haveimissedanytypes.t 000664 001750 001750 3711 12374366717 17040 0 ustar 00tai tai 000000 000000 MooX-late-0.015/t =pod
=head1 PURPOSE
Test that all Moose's built-in type constraints are correctly parsed.
=head1 AUTHOR
Toby Inkster Etobyink@cpan.orgE.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
use strict;
use warnings;
use Test::More;
require Moo;
my @types_to_check = qw(
Any
Item
Bool
Maybe
Maybe[Int]
Undef
Defined
Value
Str
Num
Int
ClassName
RoleName
Ref
ScalarRef
ScalarRef[Int]
ArrayRef
ArrayRef[Int]
HashRef
HashRef[Int]
CodeRef
RegexpRef
GlobRef
FileHandle
Object
Int|ArrayRef[Int]
ArrayRef[Int|HashRef[Int]]
ArrayRef[HashRef[Int]|Int]
ArrayRef[HashRef[Int]]|Int
);
my @class_types_to_check = qw(
Local::Test1
Local::Test::Two
LocalTest3
);
my $count = 0;
sub constraint_for
{
my $type = shift;
# Note that this will cause Local::Test1 to exist.
# We later use that in a @class_types_to_check test.
#
my $class = "Local::Test" . ++$count;
eval qq{
package $class;
use Moo;
use MooX::late;
has attr => (is => "ro", isa => "$type");
1;
} or diag($@);
"Moo"->_constructor_maker_for($class)->all_attribute_specs->{attr}{isa};
}
for my $type (@types_to_check)
{
my $got = constraint_for($type);
isa_ok($got, "Type::Tiny", "constraint_for('$type')");
is("$got", "$type", "Type constraint returned for '$type' looks right.");
}
for my $type (@class_types_to_check)
{
my $got = constraint_for($type);
isa_ok($got, "Type::Tiny::Class", "constraint_for('$type')");
is($got && $got->class, $type, "Type constraint returned for '$type' looks right.");
}
{
my $type = 'ArrayRef[Local::Test1]';
my $got = constraint_for($type);
isa_ok($got, "Type::Tiny", "constraint_for('$type')");
is(
$got && $got->type_parameter && $got->type_parameter->class,
"Local::Test1",
"Type constraint returned for '$type' looks right"
);
}
done_testing;
06handlesvia.t 000664 001750 001750 2345 12374366717 15063 0 ustar 00tai tai 000000 000000 MooX-late-0.015/t =head1 PURPOSE
See if L support works.
=head1 AUTHOR
Toby Inkster Etobyink@cpan.orgE.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
use strict;
use warnings;
use Test::More;
use Test::Requires { "MooX::HandlesVia" => "0.001004" };
{
package Local::ThingyContainer;
use Moo;
use MooX::late;
has _thingies => (
traits => ['Array'],
is => 'ro',
isa => 'ArrayRef[Str]',
default => sub { [] },
handles => {
all => 'elements',
add => 'push',
count => 'count',
},
);
}
{
package Local::Foo;
use Moo;
use MooX::late;
has code => (
traits => ['Code'],
is => 'ro',
isa => 'CodeRef',
handles => {
e => 'execute',
em => 'execute_method',
},
);
}
my $c = 'Local::ThingyContainer'->new;
is($c->count, 0);
$c->add(qw/ Foo Bar Baz /);
$c->add(qw/ Quux /);
is($c->count, 4);
is_deeply(
[ $c->all ],
[qw/ Foo Bar Baz Quux /],
);
my $x = 'Local::Foo'->new(code => sub { [@_] });
is_deeply(
$x->e(1..3),
[1..3],
);
is_deeply(
$x->em(1..3),
[$x, 1..3],
);
done_testing;
07coerce1.t 000664 001750 001750 1451 12374366717 14264 0 ustar 00tai tai 000000 000000 MooX-late-0.015/t =head1 PURPOSE
See if C<< coerce => 1 >> works.
=head1 AUTHOR
Toby Inkster Etobyink@cpan.orgE.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use Types::Standard qw( Int Num );
my $Int = Int->plus_coercions( Num, q{int($_)} );
{
package Foo;
use Moo; use MooX::late;
has attr => (is => 'ro', isa => $Int, coerce => 1);
}
is(
Foo->new(attr => 3.14159)->attr,
3,
);
#like(
# exception {
# package Bar;
# use Moo; use MooX::late;
# has attr => (is => 'ro', isa => $Int->no_coercions, coerce => 1);
# },
# qr{^Invalid coerce '1'},
#);
done_testing;
08doesrole.t 000664 001750 001750 1435 12374366717 14562 0 ustar 00tai tai 000000 000000 MooX-late-0.015/t =pod
=encoding utf-8
=head1 PURPOSE
See if C<< does => $rolename >> works.
=head1 AUTHOR
Toby Inkster Etobyink@cpan.orgE.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
use strict;
use warnings;
use Test::More;
use Test::Fatal;
{
package Bar;
use Moo::Role;
}
{
package Foo::Bar;
use Moo;
with 'Bar';
}
{
package Foo::Baz;
use Moo;
}
{
package Quux;
use Moo;
use MooX::late;
has xxx => (is => 'ro', does => 'Bar');
}
is(
exception { Quux->new(xxx => Foo::Bar->new) },
undef,
);
like(
exception { Quux->new(xxx => Foo::Baz->new) },
qr/did not pass type constraint/,
);
done_testing;
late.pm 000664 001750 001750 23426 12374366717 15105 0 ustar 00tai tai 000000 000000 MooX-late-0.015/lib/MooX use 5.008;
use strict;
use warnings;
package MooX::late;
our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION = '0.015';
use Moo qw( );
use Carp qw( carp croak );
use Scalar::Util qw( blessed );
use Module::Runtime qw( is_module_name );
BEGIN {
package MooX::late::DefinitionContext;
our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION = '0.015';
use Moo;
use overload (
q[""] => 'to_string',
q[bool] => sub { 1 },
fallback => 1,
);
has package => (is => 'ro');
has filename => (is => 'ro');
has line => (is => 'ro');
sub to_string
{
my $self = shift;
sprintf(
'%s:%d, package %s',
$self->filename,
$self->line,
$self->package,
);
}
sub new_from_caller
{
my ($class, $level) = @_;
$level = 0 unless defined $level;
my ($p, $f, $c) = caller($level + 1);
return $class->new(
package => $p,
filename => $f,
line => $c,
);
}
};
# SUBCLASSING
# This is a hook for people subclassing MooX::late.
# It should be easy to tack on your own handlers
# to the end of the list. A handler is only called
# if exists($spec{$handler_name}) in the attribute
# spec.
#
sub _handlers
{
qw( isa does lazy_build traits );
}
# SUBCLASSING
# Not really sure why you'd want to override
# this.
#
sub _definition_context_class
{
"MooX::late::DefinitionContext";
}
sub import
{
my $me = shift;
my $caller = caller;
my $install_tracked;
{
no warnings;
if ($Moo::MAKERS{$caller})
{
$install_tracked = \&Moo::_install_tracked;
}
elsif ($Moo::Role::INFO{$caller})
{
$install_tracked = \&Moo::Role::_install_tracked;
}
else
{
croak "MooX::late applied to a non-Moo package"
. "(need: use Moo or use Moo::Role)";
}
}
my $orig = $caller->can('has') # lolcat
or croak "Could not locate 'has' function to alter";
my @handlers = $me->_handlers;
# SUBCLASSING
# MooX::late itself does not provide a
# `_finalize_attribute` method. Your subclass
# can, in which case it will be called right
# before setting up the attribute.
#
my $finalize = $me->can("_finalize_attribute");
$install_tracked->(
$caller, has => sub
{
my ($proto, %spec) = @_;
my $context = $me->_definition_context_class->new_from_caller(0);
for my $name (ref $proto ? @$proto : $proto)
{
my $spec = +{ %spec }; # shallow clone
for my $option (@handlers)
{
next unless exists $spec->{$option};
my $handler = $me->can("_handle_$option");
# SUBCLASSING
# Note that handlers are called as methods, and
# get passed:
# 1. the attribute name
# 2. the attribute spec (hashref, modifiable)
# 3. a context object
# 4. the name of the caller class/role
#
$me->$handler($name, $spec, $context, $caller);
}
$me->$finalize($name, $spec, $context, $caller) if $finalize;
$orig->($name, %$spec);
}
return;
},
);
$me->_install_sugar($caller, $install_tracked);
}
# SUBCLASSING
# This can be used to install additional functions
# into the caller package.
#
sub _install_sugar
{
my $me = shift;
my ($caller, $installer) = @_;
$installer->($caller, blessed => \&Scalar::Util::blessed);
$installer->($caller, confess => \&Carp::confess);
}
sub _handle_isa
{
my $me = shift;
my ($name, $spec, $context, $class) = @_;
return if ref $spec->{isa};
require Type::Utils;
$spec->{isa} = Type::Utils::dwim_type($spec->{isa}, for => $class);
return;
}
sub _handle_does
{
my $me = shift;
my ($name, $spec, $context, $class) = @_;
return unless defined $spec->{does};
require Types::Standard;
$spec->{isa} = Types::Standard::ConsumerOf()->of($spec->{does});
return;
}
sub _handle_lazy_build
{
my $me = shift;
my ($name, $spec, $context, $class) = @_;
return unless delete $spec->{lazy_build};
$spec->{is} ||= "ro";
$spec->{lazy} ||= 1;
$spec->{builder} ||= "_build_$name";
if ($name =~ /^_/)
{
$spec->{clearer} ||= "_clear$name";
$spec->{predicate} ||= "_has$name";
}
else
{
$spec->{clearer} ||= "clear_$name";
$spec->{predicate} ||= "has_$name";
}
return;
}
sub _handle_traits
{
my $me = shift;
my ($name, $spec, $context, $class) = @_;
my @new;
foreach my $trait (@{ $spec->{traits} || [] })
{
my $handler = $me->can("_handletrait_$trait");
croak "$me cannot process trait $trait" unless $handler;
# SUBCLASSING
# There is a second level of handlers for traits.
# Just add a method called "_handletrait_Foo"
# and it will be called to handle the trait "Foo".
# These handlers should normally return the empty
# list, but may return a list of strings to add to
# a *new* traits arrayref.
#
push @new, $me->$handler(@_);
}
$spec->{traits} = \@new;
if ($spec->{handles_via})
{
eval "require MooX::HandlesVia"
or croak("Requires MooX::HandlesVia for attribute trait defined at $context");
my ($name, %spec) = MooX::HandlesVia::process_has($name, %$spec);
%$spec = %spec;
}
return;
}
sub _handletrait_Array
{
my $me = shift;
my ($name, $spec, $context, $class) = @_;
$spec->{handles_via} = "Data::Perl::Collection::Array::MooseLike";
return;
}
sub _handletrait_Hash
{
my $me = shift;
my ($name, $spec, $context, $class) = @_;
$spec->{handles_via} = "Data::Perl::Collection::Hash::MooseLike";
return;
}
sub _handletrait_Code
{
my $me = shift;
my ($name, $spec, $context, $class) = @_;
$spec->{handles_via} = "Data::Perl::Code";
# Special handling for execute_method!
while (my ($k, $v) = each %{ $spec->{handles} })
{
next unless $v eq q(execute_method);
# MooX::HandlesVia can't handle this right yet.
delete $spec->{handles}{$k};
# ... so we handle it ourselves.
eval qq{
package ${class};
sub ${k} {
my \$self = shift;
return \$self->${name}->(\$self, \@_);
}
};
}
return;
}
1;
__END__
=pod
=encoding utf8
=for stopwords superset MooX
=head1 NAME
MooX::late - easily translate Moose code to Moo
=head1 SYNOPSIS
package Foo;
use Moo;
use MooX::late;
has bar => (is => "ro", isa => "Str", default => "MacLaren's Pub");
(Examples for Moo roles in section below.)
=head1 DESCRIPTION
L is a light-weight object oriented programming framework which aims
to be compatible with L. It does this by detecting when Moose has
been loaded, and automatically "inflating" its classes and roles to full
Moose classes and roles. This way, Moo classes can consume Moose roles,
Moose classes can extend Moo classes, and so forth.
However, the surface syntax of Moo differs somewhat from Moose. For example
the C option when defining attributes in Moose must be either a string
or a blessed L object; but in Moo must be a
coderef. These differences in surface syntax make porting code from Moose to
Moo potentially tricky. L provides some assistance by enabling a
slightly more Moosey surface syntax.
MooX::late does the following:
=over
=item 1.
Supports C<< isa => $stringytype >>.
=item 2.
Supports C<< does => $rolename >> .
=item 3.
Supports C<< lazy_build => 1 >>.
=item 4.
Exports C and C functions to your namespace.
=item 5.
Handles certain attribute traits. Currently C, C and C
are supported. This feature requires L.
C, C, C and C are unlikely to ever be
supported because of internal implementation details of Moo. If you need
another attribute trait to be supported, let me know and I will consider
it.
=back
Five features. It is not the aim of C to make every aspect of
Moo behave exactly identically to Moose. It's just going after the low-hanging
fruit. So it does five things right now, and I promise that future versions
will never do more than seven.
Previous releases of MooX::late added support for C<< coerce => 1 >> and
C<< default => $nonref >>. These features have now been added to Moo itself,
so MooX::late no longer has to deal with them.
=head2 Use in Moo::Roles
MooX::late should work in Moo::Roles, with no particular caveats.
package MyRole;
use Moo::Role;
use MooX::late;
L can be used to build the Moo equivalent of
parameterized roles. MooX::late should work in roles built with
Package::Variant.
use Package::Variant
importing => [ qw( Moo::Role MooX::late ) ],
subs => [ qw( has with ) ];
=head2 Type constraints
Type constraint strings are interpreted using L, using the
type constraints defined in L. This provides a very slight
superset of Moose's type constraint syntax and built-in type constraints.
Any unrecognized string that looks like it might be a class name is
interpreted as a class type constraint.
=head2 Subclassing
MooX::late is designed to be reasonably easy to subclass. There are comments
in the source code explaining hooks for extensibility.
=head1 BUGS
Please report any bugs to
L.
=head1 SEE ALSO
C uses L to check type constraints.
C uses L to provide native attribute traits
support.
The following modules bring additional Moose functionality to Moo:
=over
=item *
L - support override/super
=item *
L - support augment/inner
=back
L allows you to load Moo plus multiple MooX extension modules in a
single line.
=head1 AUTHOR
Toby Inkster Etobyink@cpan.orgE.
=head1 COPYRIGHT AND LICENCE
This software is copyright (c) 2012-2014 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.