MooseX-AttributeShortcuts-0.028/0000775000175000017500000000000012511122102017052 5ustar rsrchboyrsrchboyMooseX-AttributeShortcuts-0.028/README0000644000175000017500000003216512511122102017737 0ustar rsrchboyrsrchboyNAME MooseX::AttributeShortcuts - Shorthand for common attribute options VERSION This document describes version 0.028 of MooseX::AttributeShortcuts - released April 07, 2015 as part of MooseX-AttributeShortcuts. SYNOPSIS package Some::Class; use Moose; use MooseX::AttributeShortcuts; # same as: # is => 'ro', lazy => 1, builder => '_build_foo' has foo => (is => 'lazy'); # same as: is => 'ro', writer => '_set_foo' has foo => (is => 'rwp'); # same as: is => 'ro', builder => '_build_bar' has bar => (is => 'ro', builder => 1); # same as: is => 'ro', clearer => 'clear_bar' has bar => (is => 'ro', clearer => 1); # same as: is => 'ro', predicate => 'has_bar' has bar => (is => 'ro', predicate => 1); # works as you'd expect for "private": predicate => '_has_bar' has _bar => (is => 'ro', predicate => 1); # extending? Use the "Shortcuts" trait alias extends 'Some::OtherClass'; has '+bar' => (traits => [Shortcuts], builder => 1, ...); # or... package Some::Other::Class; use Moose; use MooseX::AttributeShortcuts -writer_prefix => '_'; # same as: is => 'ro', writer => '_foo' has foo => (is => 'rwp'); DESCRIPTION Ever find yourself repeatedly specifying writers and builders, because there's no good shortcut to specifying them? Sometimes you want an attribute to have a read-only public interface, but a private writer. And wouldn't it be easier to just say "builder => 1" and have the attribute construct the canonical "_build_$name" builder name for you? This package causes an attribute trait to be applied to all attributes defined to the using class. This trait extends the attribute option processing to handle the above variations. USAGE This package automatically applies an attribute metaclass trait. Unless you want to change the defaults, you can ignore the talk about "prefixes" below. EXTENDING A CLASS If you're extending a class and trying to extend its attributes as well, you'll find out that the trait is only applied to attributes defined locally in the class. This package exports a trait shortcut function "Shortcuts" that will help you apply this to the extended attribute: has '+something' => (traits => [Shortcuts], ...); PREFIXES We accept two parameters on the use of this module; they impact how builders and writers are named. -writer_prefix use MooseX::::AttributeShortcuts -writer_prefix => 'prefix'; The default writer prefix is '_set_'. If you'd prefer it to be something else (say, '_'), this is where you'd do that. -builder_prefix use MooseX::::AttributeShortcuts -builder_prefix => 'prefix'; The default builder prefix is '_build_', as this is what lazy_build does, and what people in general recognize as build methods. NEW ATTRIBUTE OPTIONS Unless specified here, all options defined by Moose::Meta::Attribute and Class::MOP::Attribute remain unchanged. Want to see additional options? Ask, or better yet, fork on GitHub and send a pull request. If the shortcuts you're asking for already exist in Moo or Mouse or elsewhere, please note that as it will carry significant weight. For the following, "$name" should be read as the attribute name; and the various prefixes should be read using the defaults. is => 'rwp' Specifying is => 'rwp' will cause the following options to be set: is => 'ro' writer => "_set_$name" is => 'lazy' Specifying is => 'lazy' will cause the following options to be set: is => 'ro' builder => "_build_$name" lazy => 1 NOTE: Since 0.009 we no longer set init_arg => undef if no init_arg is explicitly provided. This is a change made in parallel with Moo, based on a large number of people surprised that lazy also made one's init_def undefined. is => 'lazy', default => ... Specifying is => 'lazy' and a default will cause the following options to be set: is => 'ro' lazy => 1 default => ... # as provided That is, if you specify is => 'lazy' and also provide a default, then we won't try to set a builder, as well. builder => 1 Specifying builder => 1 will cause the following options to be set: builder => "_build_$name" builder => sub { ... } Passing a coderef to builder will cause that coderef to be installed in the class this attribute is associated with the name you'd expect, and builder => 1 to be set. e.g., in your class, has foo => (is => 'ro', builder => sub { 'bar!' }); ...is effectively the same as... has foo => (is => 'ro', builder => '_build_foo'); sub _build_foo { 'bar!' } clearer => 1 Specifying clearer => 1 will cause the following options to be set: clearer => "clear_$name" or, if your attribute name begins with an underscore: clearer => "_clear$name" (that is, an attribute named "_foo" would get "_clear_foo") predicate => 1 Specifying predicate => 1 will cause the following options to be set: predicate => "has_$name" or, if your attribute name begins with an underscore: predicate => "_has$name" (that is, an attribute named "_foo" would get "_has_foo") trigger => 1 Specifying trigger => 1 will cause the attribute to be created with a trigger that calls a named method in the class with the options passed to the trigger. By default, the method name the trigger calls is the name of the attribute prefixed with "_trigger_". e.g., for an attribute named "foo" this would be equivalent to: trigger => sub { shift->_trigger_foo(@_) } For an attribute named "_foo": trigger => sub { shift->_trigger__foo(@_) } This naming scheme, in which the trigger is always private, is the same as the builder naming scheme (just with a different prefix). handles => { foo => sub { ... }, ... } Creating a delegation with a coderef will now create a new, "custom accessor" for the attribute. These coderefs will be installed and called as methods on the associated class (just as readers, writers, and other accessors are), and will have the attribute metaclass available in $_. Anything the accessor is called with it will have access to in @_, just as you'd expect of a method. e.g., the following example creates an attribute named 'bar' with a standard reader accessor named 'bar' and two custom accessors named 'foo' and 'foo_too'. has bar => ( is => 'ro', isa => 'Int', handles => { foo => sub { my $self = shift @_; return $_->get_value($self) + 1; }, foo_too => sub { my $self = shift @_; return $self->bar + 1; }, }, ); ...and later, Note that in this example both foo() and foo_too() do effectively the same thing: return the attribute's current value plus 1. However, foo() accesses the attribute value directly through the metaclass, the pros and cons of which this author leaves as an exercise for the reader to determine. You may choose to use the installed accessors to get at the attribute's value, or use the direct metaclass access, your choice. ANONYMOUS SUBTYPING AND COERCION "Abusus non tollit usum." Note that we create new, anonymous subtypes whenever the constraint or coercion options are specified in such a way that the Shortcuts trait (this one) is invoked. It's fully supported to use both constraint and coerce options at the same time. This facility is intended to assist with the creation of one-off type constraints and coercions. It is not possible to deliberately reuse the subtypes we create, and if you find yourself using a particular isa / constraint / coerce option triplet in more than one place you should really think about creating a type that you can reuse. MooseX::Types provides the facilities to easily do this, or even a simple constant definition at the package level with an anonymous type stashed away for local use. isa => sub { ... } has foo => ( is => 'rw', # $_ == $_[0] == the value to be validated isa => sub { die unless $_[0] == 1 }, ); # passes constraint $thing->foo(1); # fails constraint $thing->foo(5); Given a coderef, create a type constraint for the attribute. This constraint will fail if the coderef dies, and pass otherwise. Astute users will note that this is the same way Moo constraints work; we use MooseX::Meta::TypeConstraint::Mooish to implement the constraint. isa_instance_of => ... Given a package name, this option will create an isa type constraint that requires the value of the attribute be an instance of the class (or a descendant class) given. That is, has foo => (is => 'ro', isa_instance_of => 'SomeThing'); ...is effectively the same as: use Moose::TypeConstraints 'class_type'; has foo => ( is => 'ro', isa => class_type('SomeThing'), ); ...but a touch less awkward. isa => ..., constraint => sub { ... } Specifying the constraint option with a coderef will cause a new subtype constraint to be created, with the parent type being the type specified in the isa option and the constraint being the coderef supplied here. For example, only integers greater than 10 will pass this attribute's type constraint: # value must be an integer greater than 10 to pass the constraint has thinger => ( isa => 'Int', constraint => sub { $_ > 10 }, # ... ); Note that if you supply a constraint, you must also provide an isa. isa => ..., constraint => sub { ... }, coerce => 1 Supplying a constraint and asking for coercion will "Just Work", that is, any coercions that the isa type has will still work. For example, let's say that you're using the File type constraint from MooseX::Types::Path::Class, and you want an additional constraint that the file must exist: has thinger => ( is => 'ro', isa => File, constraint => sub { !! $_->stat }, coerce => 1, ); thinger will correctly coerce the string "/etc/passwd" to a Path::Class:File, and will only accept the coerced result as a value if the file exists. coerce => [ Type => sub { ...coerce... }, ... ] Specifying the coerce option with a hashref will cause a new subtype to be created and used (just as with the constraint option, above), with the specified coercions added to the list. In the passed hashref, the keys are Moose types (well, strings resolvable to Moose types), and the values are coderefs that will coerce a given type to our type. has bar => ( is => 'ro', isa => 'Str', coerce => [ Int => sub { "$_" }, Object => sub { 'An instance of ' . ref $_ }, ], ); SEE ALSO Please see those modules/websites for more information related to this module. * MooseX::Types SOURCE The development version is on github at http://https://github.com/RsrchBoy/moosex-attributeshortcuts and may be cloned from git://https://github.com/RsrchBoy/moosex-attributeshortcuts.git BUGS Please report any bugs or feature requests on the bugtracker website https://github.com/RsrchBoy/moosex-attributeshortcuts/issues When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. AUTHOR Chris Weyl I'm a material boy in a material world Please note I do not expect to be gittip'ed or flattr'ed for this work, rather it is simply a very pleasant surprise. I largely create and release works like this because I need them or I find it enjoyable; however, don't let that stop you if you feel like it ;) Flattr this , gittip me , or indulge my Amazon Wishlist ... If you so desire. CONTRIBUTORS * David Steinbrunner * Graham Knop COPYRIGHT AND LICENSE This software is Copyright (c) 2011 by Chris Weyl. This is free software, licensed under: The GNU Lesser General Public License, Version 2.1, February 1999 MooseX-AttributeShortcuts-0.028/Changes0000644000175000017500000001222312511122102020343 0ustar rsrchboyrsrchboyRevision history for MooseX-AttributeShortcuts 0.028 2015-04-07 20:45:00 PDT-0700 * 0.028. *le sigh* 0.027_02 2015-04-07 20:43:17 PDT-0700 * Moose 1.14 is now the minimum supported Moose. 0.027_01 2015-03-28 22:02:17 PDT-0700 * Break out our $_process_options into more... succinct... methods. * Add Moo-style type constraints. 0.027 2015-03-10 19:27:06 PDT-0700 * Stop using autobox, after relentless persecution by The Cabal ;) * Push out our warnings for those using undocumented bits, as we haven't released a non-dev/trial version in *ages* 0.026-TRIAL 2014-12-02 19:52:59 PST-0800 * Keep our comments dumb, even in tests. (thanks, @haarg!) 0.025-TRIAL 2014-05-22 12:51:25 PDT-0700 * This is a TRIAL release, as I'm not entirely sure of the wisdom and implementation of the following. * Allow for the creation of additional associated methods by hijacking the delegation system, a la native traits: handles => { ... => sub { ... } } 0.024 2014-05-02 12:50:57 PDT-0700 * Make the undocumented isa_* options "deprecated" ...which seems like better karma than no warning, as people really shouldn't be using these anyways, but better nice than to have it done to me someday :) 0.023 2014-04-04 21:23:33 PDT-0700 * Add isa_instance_of attribute option. 0.022 2013-09-29 00:08:39 PDT-0700 * No code changes -- released with refreshed test suite 0.021 2013-09-08 23:32:09 PDT-0700 * Drop MXCPA entirely, and incorporate the subtyping functionality 0.020_01 2013-08-26 13:33:44 PDT-0700 * Keep MXCPA quiet, for now. This is evil (hence the dev release), but should keep things status-quo until we properly integrate MXCPA functionality into MXAS proper. 0.020 2013-08-19 21:51:02 PDT-0700 * Bump CoercePerAttribute version requirement to 1.000 and update docs 0.019 2013-04-20 21:50:05 PDT-0700 * Better support inline subtyping and coercions (people who are inclined to shoot themselves in their foot will do it regardless) * Additional tests for coercions 0.018 2013-01-09 10:20:25 PST8PDT * ~~ TRIAL ~~ * If a constraint coderef is given and coercion is requested, we now copy the parent type's coercions to the anonymous child type. * Better document the constraint option and how it interacts with simple coercion. 0.017 2012-10-28 20:53:52 PST8PDT * make actually make classes immutable during tests * add initial primitive anonymous inline subtyping support; this needs to be evaluated with the outstanding pull request (issue #6) but I need this Right Now 0.016 2012-09-08 21:41:38 America/Los_Angeles * provide for "negative shortcuts" for clearer and predicate, but don't document for the moment 0.015 2012-08-26 11:48:29 America/Los_Angeles * add 'builder => sub { ... }' shortcut [gh #4] 0.014 2012-08-16 17:26:09 America/Los_Angeles * explictly test for definedness rather than truthiness when determining if someone has also specified a default along with is => lazy 0.013 2012-07-15 22:11:37 America/Los_Angeles * Restore tests lost from (d11e67a) -- no functional / code changes! 0.012 2012-05-02 11:02:10 America/Los_Angeles * TRIAL/dev release * Don't try to guess what sort of metaclass we need; just die if we don't have one * Misc cleanups 0.011 2012-04-30 13:41:05 America/Los_Angeles * TRIAL/dev release * Handle the no-metaclass case in our init_meta() 0.010 2012-04-06 18:25:42 America/Los_Angeles * Minor doc updates; no functional changes from 0.009 (TRIAL) 0.009 2012-03-26 23:46:58 America/Los_Angeles * Drop 'init_arg => undef' from our 'ro => "lazy"' shortcut. This was done in coordination with the author of Moo, based on consistently surprised user feedback. 0.008 2012-01-10 23:05:34 America/Los_Angeles * Prebuild our roles, for better caching (and fewer warnings, at least) 0.007 2012-01-10 17:30:57 America/Los_Angeles * Allow default to be also be specified when is => lazy 0.006 2011-10-27 10:15:07 America/Los_Angeles * We now handle "trigger => 1", as well * All our tests are wrapped in Test::Moose::with_immutable(), just to make sure that we immutablize properly 0.005 2011-08-18 20:54:02 America/Los_Angeles * handle attribute extension/cloning, for realz this time * we now handle the case of attributes defined in roles by properly applying our trait to the applied_attribute metaclass 0.004 2011-08-02 23:44:20 America/Los_Angeles * add lazy_build => 'private' * our laziness was being ignored when an attribute defined in one class was being extended/cloned in another class -- this could not stand 0.003 2011-07-03 16:40:19 America/Los_Angeles * handle predicate => 1, clearer => 1 as well 0.002 2011-03-30 23:43:11 America/Los_Angeles * Convert our trait to a parameterized role, to allow for different build and writer prefixes (e.g. '_set_' vs '_') * Cause 'is => "lazy"' to behave the way it does in Moo * Change the default writer prefix from _ to _set_; it was pointed out that this is the expected way to do things (and makes more sense, really). 0.001 2011-03-27 08:12:11 America/Los_Angeles * initial release MooseX-AttributeShortcuts-0.028/LICENSE0000644000175000017500000006011712511122102020062 0ustar rsrchboyrsrchboyThis software is Copyright (c) 2011 by Chris Weyl. This is free software, licensed under: The GNU Lesser General Public License, Version 2.1, February 1999 The GNU Lesser General Public License (LGPL) Version 2.1, February 1999 (The master copy of this license lives on the GNU website.) Copyright (C) 1991, 1999 Free Software Foundation, Inc. 59 51 Franklin Street, 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. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete 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 License and to the absence of any warranty; and distribute a copy of this License along with the Library. 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. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser 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 Library specifies a version number of this 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 Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, 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 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "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 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. 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 LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS MooseX-AttributeShortcuts-0.028/dist.ini0000600000175000017500000000034512511122102020506 0ustar rsrchboyrsrchboyname = MooseX-AttributeShortcuts author = Chris Weyl license = LGPL_2_1 copyright_holder = Chris Weyl copyright_year = 2011 [@RSRCHBOY] autoprereqs_skip = ^(funcs|TestClass.*|TestRole.*)$ tweet = 1 MooseX-AttributeShortcuts-0.028/MANIFEST0000644000175000017500000000161012511122102020177 0ustar rsrchboyrsrchboy# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.034. .travis.yml Changes LICENSE MANIFEST META.json META.yml Makefile.PL README SIGNATURE cpanfile dist.ini lib/MooseX/AttributeShortcuts.pm t/00-check-deps.t t/00-compile.t t/000-report-versions-tiny.t t/01-basic.t t/02-parameterized.t t/03-lazy.t t/04-clearer-and-predicate.t t/05-extend.t t/06-role.t t/07-trigger.t t/anon-builder.t t/constraint.t t/deprecated/inline_typing.t t/funcs.pm t/handles-coderef.t t/handles-metaclass.t t/inline_coercion-back-compat.t t/inline_coercion.t t/inline_subtyping.t t/inline_subtyping_with_coercion.t t/isa-mooish.t t/isa_instance_of.t xt/author/eol.t xt/author/no-tabs.t xt/author/pod-spell.t xt/release/consistent-version.t xt/release/has-version.t xt/release/minimum-version.t xt/release/no-smart-comments.t xt/release/pod-coverage.t xt/release/pod-linkcheck.t xt/release/pod-syntax.t MooseX-AttributeShortcuts-0.028/META.yml0000644000175000017500000004650512511122102020333 0ustar rsrchboyrsrchboy--- abstract: 'Shorthand for common attribute options' author: - 'Chris Weyl ' build_requires: File::Spec: '0' IO::Handle: '0' IPC::Open3: '0' Moose::Role: '0' Moose::Util: '0' MooseX::Types::Path::Class: '0' Path::Class: '0' Test::CheckDeps: '0.010' Test::Fatal: '0' Test::Moose: '0' Test::Moose::More: '0.018' Test::More: '0.94' Test::Warn: '0' constant: '0' perl: '5.006' configure_requires: ExtUtils::MakeMaker: '0' perl: '5.006' dynamic_config: 0 generated_by: 'Dist::Zilla version 5.034, CPAN::Meta::Converter version 2.150001' license: lgpl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: MooseX-AttributeShortcuts no_index: directory: - corpus - t provides: MooseX::AttributeShortcuts: file: lib/MooseX/AttributeShortcuts.pm version: '0.028' MooseX::AttributeShortcuts::Trait::Attribute: file: lib/MooseX/AttributeShortcuts.pm version: '0.028' requires: List::AllUtils: '0' Moose: '1.14' Moose::Exporter: '0' Moose::Meta::TypeConstraint: '0' Moose::Util::MetaRole: '0' Moose::Util::TypeConstraints: '0' MooseX::Meta::TypeConstraint::Mooish: '0' MooseX::Role::Parameterized: '0' MooseX::Types::Common::String: '0' MooseX::Types::Moose: '0' Package::DeprecationManager: '0' aliased: '0' namespace::autoclean: '0' perl: '5.006' strict: '0' warnings: '0' resources: bugtracker: https://github.com/RsrchBoy/moosex-attributeshortcuts/issues homepage: https://github.com/RsrchBoy/moosex-attributeshortcuts repository: https://github.com/RsrchBoy/moosex-attributeshortcuts.git version: '0.028' x_Dist_Zilla: perl: version: '5.020001' plugins: - class: Dist::Zilla::Plugin::NextRelease name: '@RSRCHBOY/NextRelease' version: '5.034' - class: Dist::Zilla::Plugin::Git::NextVersion config: Dist::Zilla::Plugin::Git::NextVersion: first_version: '0.001' version_by_branch: '0' version_regexp: (?^:^(\d.\d+(_\d\d)?)(-TRIAL|)$) Dist::Zilla::Role::Git::Repo: repo_root: . name: '@RSRCHBOY/Git::NextVersion' version: '2.033' - class: Dist::Zilla::Plugin::ContributorsFromGit name: '@RSRCHBOY/ContributorsFromGit' version: '0.016' - class: Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch config: Dist::Zilla::Role::Git::Repo: repo_root: . name: '@RSRCHBOY/@Git::CheckFor/Git::CheckFor::CorrectBranch' version: '0.013' - class: Dist::Zilla::Plugin::Git::CheckFor::Fixups config: Dist::Zilla::Role::Git::Repo: repo_root: . name: '@RSRCHBOY/@Git::CheckFor/Git::CheckFor::Fixups' version: '0.013' - class: Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts config: Dist::Zilla::Role::Git::Repo: repo_root: . name: '@RSRCHBOY/@Git::CheckFor/Git::CheckFor::MergeConflicts' version: '0.013' - class: Dist::Zilla::Plugin::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: - LICENSE - cpanfile exclude_match: [] follow_symlinks: '0' include_dotfiles: '0' prefix: '' prune_directory: [] root: . name: '@RSRCHBOY/GatherDir' version: '5.034' - class: Dist::Zilla::Plugin::PromptIfStale config: Dist::Zilla::Plugin::PromptIfStale: check_all_plugins: 0 check_all_prereqs: 0 modules: - Dist::Zilla - Dist::Zilla::PluginBundle::RSRCHBOY phase: build skip: [] name: '@RSRCHBOY/PromptIfStale' version: '0.040' - class: Dist::Zilla::Plugin::PruneCruft name: '@RSRCHBOY/PruneCruft' version: '5.034' - class: Dist::Zilla::Plugin::Git::Describe name: '@RSRCHBOY/Git::Describe' version: '0.005' - class: Dist::Zilla::Plugin::ExecDir name: '@RSRCHBOY/ExecDir' version: '5.034' - class: Dist::Zilla::Plugin::ShareDir name: '@RSRCHBOY/ShareDir' version: '5.034' - class: Dist::Zilla::Plugin::MakeMaker config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@RSRCHBOY/MakeMaker' version: '5.034' - class: Dist::Zilla::Plugin::Manifest name: '@RSRCHBOY/Manifest' version: '5.034' - class: Dist::Zilla::Plugin::SurgicalPkgVersion name: '@RSRCHBOY/SurgicalPkgVersion' version: '0.0019' - class: Dist::Zilla::Plugin::MinimumPerl name: '@RSRCHBOY/MinimumPerl' version: '1.006' - class: Dist::Zilla::Plugin::ReportVersions::Tiny name: '@RSRCHBOY/ReportVersions::Tiny' version: '1.10' - class: Dist::Zilla::Plugin::AutoPrereqs name: '@RSRCHBOY/AutoPrereqs' version: '5.034' - class: Dist::Zilla::Plugin::Prepender name: '@RSRCHBOY/Prepender' version: '2.001' - class: Dist::Zilla::Plugin::Test::PodSpelling name: '@RSRCHBOY/Test::PodSpelling' version: '2.006008' - class: Dist::Zilla::Plugin::ConsistentVersionTest name: '@RSRCHBOY/ConsistentVersionTest' version: '0.02' - class: Dist::Zilla::Plugin::PodCoverageTests name: '@RSRCHBOY/PodCoverageTests' version: '5.034' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@RSRCHBOY/PodSyntaxTests' version: '5.034' - class: Dist::Zilla::Plugin::Test::NoTabs config: Dist::Zilla::Plugin::Test::NoTabs: filename: xt/author/no-tabs.t finder: - ':InstallModules' - ':ExecFiles' - ':TestFiles' name: '@RSRCHBOY/Test::NoTabs' version: '0.13' - class: Dist::Zilla::Plugin::Test::EOL config: Dist::Zilla::Plugin::Test::EOL: filename: xt/author/eol.t finder: - ':InstallModules' - ':ExecFiles' - ':TestFiles' trailing_whitespace: '1' name: '@RSRCHBOY/Test::EOL' version: '0.17' - class: Dist::Zilla::Plugin::HasVersionTests name: '@RSRCHBOY/HasVersionTests' version: '1.101420' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: '0' fail_on_warning: author fake_home: '0' filename: t/00-compile.t module_finder: - ':InstallModules' needs_display: '0' phase: test script_finder: - ':ExecFiles' skips: [] name: '@RSRCHBOY/Test::Compile' version: '2.052' - class: Dist::Zilla::Plugin::NoSmartCommentsTests name: '@RSRCHBOY/NoSmartCommentsTests' version: '0.007' - class: Dist::Zilla::Plugin::Test::Pod::LinkCheck name: '@RSRCHBOY/Test::Pod::LinkCheck' version: '1.001' - class: Dist::Zilla::Plugin::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@RSRCHBOY/RunExtraTests' version: '0.026' - class: Dist::Zilla::Plugin::CheckExtraTests name: '@RSRCHBOY/CheckExtraTests' version: '0.026' - class: Dist::Zilla::Plugin::Test::MinimumVersion name: '@RSRCHBOY/Test::MinimumVersion' version: '2.000006' - class: Dist::Zilla::Plugin::Authority name: '@RSRCHBOY/Authority' version: '1.009' - class: Dist::Zilla::Plugin::MetaConfig name: '@RSRCHBOY/MetaConfig' version: '5.034' - class: Dist::Zilla::Plugin::MetaJSON name: '@RSRCHBOY/MetaJSON' version: '5.034' - class: Dist::Zilla::Plugin::MetaYAML name: '@RSRCHBOY/MetaYAML' version: '5.034' - class: Dist::Zilla::Plugin::MetaNoIndex name: '@RSRCHBOY/MetaNoIndex' version: '5.034' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@RSRCHBOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '5.034' Dist::Zilla::Role::MetaProvider::Provider: inherit_missing: '1' inherit_version: '1' meta_noindex: '1' name: '@RSRCHBOY/MetaProvides::Package' version: '2.003001' - class: Dist::Zilla::Plugin::GithubMeta name: '@RSRCHBOY/GithubMeta' version: '0.48' - class: Dist::Zilla::Plugin::TestRelease name: '@RSRCHBOY/TestRelease' version: '5.034' - class: Dist::Zilla::Plugin::CheckChangesHasContent name: '@RSRCHBOY/CheckChangesHasContent' version: '0.008' - class: Dist::Zilla::Plugin::CheckPrereqsIndexed name: '@RSRCHBOY/CheckPrereqsIndexed' version: '0.015' - class: Dist::Zilla::Plugin::Git::Remote::Update name: '@RSRCHBOY/GitFetchOrigin' version: 0.1.2 - class: Dist::Zilla::Plugin::Git::Remote::Check name: '@RSRCHBOY/GitCheckReleaseBranchSync' version: 0.1.2 - class: Dist::Zilla::Plugin::Git::Remote::Check name: '@RSRCHBOY/GitCheckMasterBranchSync' version: 0.1.2 - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - .gitignore - .travis.yml - Changes - README.mkdn - dist.ini - weaver.ini - LICENSE - cpanfile allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: repo_root: . name: '@RSRCHBOY/Git::Check' version: '2.033' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%v%n%n%c time_zone: local Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - .gitignore - .travis.yml - Changes - README.mkdn - dist.ini - weaver.ini - LICENSE - cpanfile allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: repo_root: . name: '@RSRCHBOY/Git::Commit' version: '2.033' - class: Dist::Zilla::Plugin::Test::CheckDeps name: '@RSRCHBOY/Test::CheckDeps' version: '0.012' - class: Dist::Zilla::Plugin::CheckSelfDependency config: Dist::Zilla::Plugin::CheckSelfDependency: finder: - ':InstallModules' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000026' version: '0.003' name: '@RSRCHBOY/CheckSelfDependency' version: '0.011' - class: Dist::Zilla::Plugin::Travis::ConfigForReleaseBranch name: '@RSRCHBOY/Travis::ConfigForReleaseBranch' version: '0.001' - class: Dist::Zilla::Plugin::SchwartzRatio name: '@RSRCHBOY/SchwartzRatio' version: 0.2.0 - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ signed: '1' tag: '0.028' tag_format: '%v' tag_message: v%v time_zone: local Dist::Zilla::Role::Git::Repo: repo_root: . name: '@RSRCHBOY/Git::Tag' version: '2.033' - class: Dist::Zilla::Plugin::Git::CommitBuild config: Dist::Zilla::Plugin::Git::CommitBuild: branch: build/%b build_root: ~ message: 'Build results of %h (on %b)' multiple_inheritance: 0 release_branch: ~ release_message: 'Build results of %h (on %b)' Dist::Zilla::Role::Git::Repo: repo_root: . name: '@RSRCHBOY/Git::CommitBuild::Build' version: '2.033' - class: Dist::Zilla::Plugin::Git::CommitBuild config: Dist::Zilla::Plugin::Git::CommitBuild: branch: build/%b build_root: ~ message: 'Build results of %h (on %b)' multiple_inheritance: 1 release_branch: release/cpan release_message: 'Full build of CPAN release %v%t' Dist::Zilla::Role::Git::Repo: repo_root: . name: '@RSRCHBOY/Git::CommitBuild::Release' version: '2.033' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin - 'origin refs/heads/release/cpan:refs/heads/release/cpan' remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: repo_root: . name: '@RSRCHBOY/Git::Push' version: '2.033' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@RSRCHBOY/UploadToCPAN' version: '5.034' - class: Dist::Zilla::Plugin::Signature name: '@RSRCHBOY/Signature' version: '1.100930' - class: Dist::Zilla::Plugin::Twitter name: '@RSRCHBOY/Twitter' version: '0.026' - class: Dist::Zilla::Plugin::InstallRelease name: '@RSRCHBOY/InstallRelease' version: '0.008' - class: Dist::Zilla::Plugin::GitHub::Update name: '@RSRCHBOY/GitHub::Update' version: '0.40' - class: Dist::Zilla::Plugin::ArchiveRelease name: '@RSRCHBOY/ArchiveRelease' version: '4.26' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@RSRCHBOY/ConfirmRelease' version: '5.034' - class: Dist::Zilla::Plugin::License name: '@RSRCHBOY/License' version: '5.034' - class: Dist::Zilla::Plugin::CPANFile name: '@RSRCHBOY/CPANFile' version: '5.034' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod name: '@RSRCHBOY/ReadmeMarkdownInRoot' version: '0.150250' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod name: '@RSRCHBOY/ReadmeTxt' version: '0.150250' - class: Dist::Zilla::Plugin::CopyFilesFromBuild name: '@RSRCHBOY/CopyFilesFromBuild' version: '0.150250' - class: Dist::Zilla::Plugin::PodWeaver config: Dist::Zilla::Plugin::PodWeaver: config_plugins: - '@RSRCHBOY' finder: - ':InstallModules' - ':ExecFiles' plugins: - class: Pod::Weaver::Plugin::StopWords name: '@RSRCHBOY/StopWords' version: '1.010' - class: Pod::Weaver::Plugin::EnsurePod5 name: '@CorePrep/EnsurePod5' version: '4.011' - class: Pod::Weaver::Plugin::H1Nester name: '@CorePrep/H1Nester' version: '4.011' - class: Pod::Weaver::Section::Name name: '@RSRCHBOY/Name' version: '4.011' - class: Pod::Weaver::Section::Version name: '@RSRCHBOY/Version' version: '4.011' - class: Pod::Weaver::Section::Region name: '@RSRCHBOY/prelude' version: '4.011' - class: Pod::Weaver::Section::Generic name: SYNOPSIS version: '4.011' - class: Pod::Weaver::Section::Generic name: DESCRIPTION version: '4.011' - class: Pod::Weaver::Section::Generic name: OVERVIEW version: '4.011' - class: Pod::Weaver::Section::RSRCHBOY::RoleParameters name: 'ROLE PARAMETERS' version: '0.055' - class: Pod::Weaver::Section::RSRCHBOY::RequiredAttributes name: 'REQUIRED ATTRIBUTES' version: '0.055' - class: Pod::Weaver::Section::RSRCHBOY::LazyAttributes name: 'LAZY ATTRIBUTES' version: '0.055' - class: Pod::Weaver::Section::Collect name: ATTRIBUTES version: '4.011' - class: Pod::Weaver::Section::Collect name: METHODS version: '4.011' - class: Pod::Weaver::Section::Collect name: 'REQUIRED METHODS' version: '4.011' - class: Pod::Weaver::Section::Collect name: FUNCTIONS version: '4.011' - class: Pod::Weaver::Section::Collect name: TYPES version: '4.011' - class: Pod::Weaver::Section::Collect name: TEST_FUNCTIONS version: '4.011' - class: Pod::Weaver::Section::Leftovers name: '@RSRCHBOY/Leftovers' version: '4.011' - class: Pod::Weaver::Section::Region name: '@RSRCHBOY/postlude' version: '4.011' - class: Pod::Weaver::Section::SeeAlso name: '@RSRCHBOY/SeeAlso' version: '1.003' - class: Pod::Weaver::Section::SourceGitHub name: '@RSRCHBOY/SourceGitHub' version: '0.54' - class: Pod::Weaver::Section::Bugs name: '@RSRCHBOY/Bugs' version: '4.011' - class: Pod::Weaver::Section::RSRCHBOY::Authors name: RSRCHBOY::Authors version: '0.055' - class: Pod::Weaver::Section::Contributors name: '@RSRCHBOY/Contributors' version: '0.009' - class: Pod::Weaver::Section::Legal name: '@RSRCHBOY/Legal' version: '4.011' - class: Pod::Weaver::Plugin::Transformer name: '@RSRCHBOY/List' version: '4.011' - class: Pod::Weaver::Plugin::SingleEncoding name: '@RSRCHBOY/SingleEncoding' version: '4.011' name: '@RSRCHBOY/PodWeaver' version: '4.006' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '5.034' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '5.034' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '5.034' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '5.034' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '5.034' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '5.034' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '5.034' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '5.034' - class: Dist::Zilla::Plugin::FinderCode name: '@RSRCHBOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '5.034' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '5.034' x_authority: cpan:RSRCHBOY x_contributors: - 'David Steinbrunner ' - 'Graham Knop ' MooseX-AttributeShortcuts-0.028/cpanfile0000644000175000017500000000306112511122102020554 0ustar rsrchboyrsrchboyrequires "List::AllUtils" => "0"; requires "Moose" => "1.14"; requires "Moose::Exporter" => "0"; requires "Moose::Meta::TypeConstraint" => "0"; requires "Moose::Util::MetaRole" => "0"; requires "Moose::Util::TypeConstraints" => "0"; requires "MooseX::Meta::TypeConstraint::Mooish" => "0"; requires "MooseX::Role::Parameterized" => "0"; requires "MooseX::Types::Common::String" => "0"; requires "MooseX::Types::Moose" => "0"; requires "Package::DeprecationManager" => "0"; requires "aliased" => "0"; requires "namespace::autoclean" => "0"; requires "perl" => "5.006"; requires "strict" => "0"; requires "warnings" => "0"; on 'test' => sub { requires "File::Spec" => "0"; requires "IO::Handle" => "0"; requires "IPC::Open3" => "0"; requires "Moose::Role" => "0"; requires "Moose::Util" => "0"; requires "MooseX::Types::Path::Class" => "0"; requires "Path::Class" => "0"; requires "Test::CheckDeps" => "0.010"; requires "Test::Fatal" => "0"; requires "Test::Moose" => "0"; requires "Test::Moose::More" => "0.018"; requires "Test::More" => "0.94"; requires "Test::Warn" => "0"; requires "constant" => "0"; requires "perl" => "5.006"; }; on 'configure' => sub { requires "ExtUtils::MakeMaker" => "0"; requires "perl" => "5.006"; }; on 'develop' => sub { requires "Pod::Coverage::TrustPod" => "0"; requires "Test::EOL" => "0"; requires "Test::More" => "0.88"; requires "Test::NoTabs" => "0"; requires "Test::Pod" => "1.41"; requires "Test::Pod::Coverage" => "1.08"; requires "Test::Spelling" => "0.12"; requires "version" => "0.9901"; }; MooseX-AttributeShortcuts-0.028/META.json0000644000175000017500000007322012511122102020475 0ustar rsrchboyrsrchboy{ "abstract" : "Shorthand for common attribute options", "author" : [ "Chris Weyl " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.034, CPAN::Meta::Converter version 2.150001", "license" : [ "lgpl_2_1" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "MooseX-AttributeShortcuts", "no_index" : { "directory" : [ "corpus", "t" ] }, "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", "perl" : "5.006" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::EOL" : "0", "Test::More" : "0.88", "Test::NoTabs" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::Spelling" : "0.12", "version" : "0.9901" } }, "runtime" : { "requires" : { "List::AllUtils" : "0", "Moose" : "1.14", "Moose::Exporter" : "0", "Moose::Meta::TypeConstraint" : "0", "Moose::Util::MetaRole" : "0", "Moose::Util::TypeConstraints" : "0", "MooseX::Meta::TypeConstraint::Mooish" : "0", "MooseX::Role::Parameterized" : "0", "MooseX::Types::Common::String" : "0", "MooseX::Types::Moose" : "0", "Package::DeprecationManager" : "0", "aliased" : "0", "namespace::autoclean" : "0", "perl" : "5.006", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Moose::Role" : "0", "Moose::Util" : "0", "MooseX::Types::Path::Class" : "0", "Path::Class" : "0", "Test::CheckDeps" : "0.010", "Test::Fatal" : "0", "Test::Moose" : "0", "Test::Moose::More" : "0.018", "Test::More" : "0.94", "Test::Warn" : "0", "constant" : "0", "perl" : "5.006" } } }, "provides" : { "MooseX::AttributeShortcuts" : { "file" : "lib/MooseX/AttributeShortcuts.pm", "version" : "0.028" }, "MooseX::AttributeShortcuts::Trait::Attribute" : { "file" : "lib/MooseX/AttributeShortcuts.pm", "version" : "0.028" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/RsrchBoy/moosex-attributeshortcuts/issues" }, "homepage" : "https://github.com/RsrchBoy/moosex-attributeshortcuts", "repository" : { "type" : "git", "url" : "https://github.com/RsrchBoy/moosex-attributeshortcuts.git", "web" : "https://github.com/RsrchBoy/moosex-attributeshortcuts" } }, "version" : "0.028", "x_Dist_Zilla" : { "perl" : { "version" : "5.020001" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@RSRCHBOY/NextRelease", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "config" : { "Dist::Zilla::Plugin::Git::NextVersion" : { "first_version" : "0.001", "version_by_branch" : "0", "version_regexp" : "(?^:^(\\d.\\d+(_\\d\\d)?)(-TRIAL|)$)" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@RSRCHBOY/Git::NextVersion", "version" : "2.033" }, { "class" : "Dist::Zilla::Plugin::ContributorsFromGit", "name" : "@RSRCHBOY/ContributorsFromGit", "version" : "0.016" }, { "class" : "Dist::Zilla::Plugin::Git::CheckFor::CorrectBranch", "config" : { "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@RSRCHBOY/@Git::CheckFor/Git::CheckFor::CorrectBranch", "version" : "0.013" }, { "class" : "Dist::Zilla::Plugin::Git::CheckFor::Fixups", "config" : { "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@RSRCHBOY/@Git::CheckFor/Git::CheckFor::Fixups", "version" : "0.013" }, { "class" : "Dist::Zilla::Plugin::Git::CheckFor::MergeConflicts", "config" : { "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@RSRCHBOY/@Git::CheckFor/Git::CheckFor::MergeConflicts", "version" : "0.013" }, { "class" : "Dist::Zilla::Plugin::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [ "LICENSE", "cpanfile" ], "exclude_match" : [], "follow_symlinks" : "0", "include_dotfiles" : "0", "prefix" : "", "prune_directory" : [], "root" : "." } }, "name" : "@RSRCHBOY/GatherDir", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::PromptIfStale", "config" : { "Dist::Zilla::Plugin::PromptIfStale" : { "check_all_plugins" : 0, "check_all_prereqs" : 0, "modules" : [ "Dist::Zilla", "Dist::Zilla::PluginBundle::RSRCHBOY" ], "phase" : "build", "skip" : [] } }, "name" : "@RSRCHBOY/PromptIfStale", "version" : "0.040" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@RSRCHBOY/PruneCruft", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::Git::Describe", "name" : "@RSRCHBOY/Git::Describe", "version" : "0.005" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@RSRCHBOY/ExecDir", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@RSRCHBOY/ShareDir", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@RSRCHBOY/MakeMaker", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@RSRCHBOY/Manifest", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::SurgicalPkgVersion", "name" : "@RSRCHBOY/SurgicalPkgVersion", "version" : "0.0019" }, { "class" : "Dist::Zilla::Plugin::MinimumPerl", "name" : "@RSRCHBOY/MinimumPerl", "version" : "1.006" }, { "class" : "Dist::Zilla::Plugin::ReportVersions::Tiny", "name" : "@RSRCHBOY/ReportVersions::Tiny", "version" : "1.10" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "@RSRCHBOY/AutoPrereqs", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::Prepender", "name" : "@RSRCHBOY/Prepender", "version" : "2.001" }, { "class" : "Dist::Zilla::Plugin::Test::PodSpelling", "name" : "@RSRCHBOY/Test::PodSpelling", "version" : "2.006008" }, { "class" : "Dist::Zilla::Plugin::ConsistentVersionTest", "name" : "@RSRCHBOY/ConsistentVersionTest", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "@RSRCHBOY/PodCoverageTests", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@RSRCHBOY/PodSyntaxTests", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::Test::NoTabs", "config" : { "Dist::Zilla::Plugin::Test::NoTabs" : { "filename" : "xt/author/no-tabs.t", "finder" : [ ":InstallModules", ":ExecFiles", ":TestFiles" ] } }, "name" : "@RSRCHBOY/Test::NoTabs", "version" : "0.13" }, { "class" : "Dist::Zilla::Plugin::Test::EOL", "config" : { "Dist::Zilla::Plugin::Test::EOL" : { "filename" : "xt/author/eol.t", "finder" : [ ":InstallModules", ":ExecFiles", ":TestFiles" ], "trailing_whitespace" : "1" } }, "name" : "@RSRCHBOY/Test::EOL", "version" : "0.17" }, { "class" : "Dist::Zilla::Plugin::HasVersionTests", "name" : "@RSRCHBOY/HasVersionTests", "version" : "1.101420" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "bail_out_on_fail" : "0", "fail_on_warning" : "author", "fake_home" : "0", "filename" : "t/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : "0", "phase" : "test", "script_finder" : [ ":ExecFiles" ], "skips" : [] } }, "name" : "@RSRCHBOY/Test::Compile", "version" : "2.052" }, { "class" : "Dist::Zilla::Plugin::NoSmartCommentsTests", "name" : "@RSRCHBOY/NoSmartCommentsTests", "version" : "0.007" }, { "class" : "Dist::Zilla::Plugin::Test::Pod::LinkCheck", "name" : "@RSRCHBOY/Test::Pod::LinkCheck", "version" : "1.001" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@RSRCHBOY/RunExtraTests", "version" : "0.026" }, { "class" : "Dist::Zilla::Plugin::CheckExtraTests", "name" : "@RSRCHBOY/CheckExtraTests", "version" : "0.026" }, { "class" : "Dist::Zilla::Plugin::Test::MinimumVersion", "name" : "@RSRCHBOY/Test::MinimumVersion", "version" : "2.000006" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "@RSRCHBOY/Authority", "version" : "1.009" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@RSRCHBOY/MetaConfig", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@RSRCHBOY/MetaJSON", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@RSRCHBOY/MetaYAML", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::MetaNoIndex", "name" : "@RSRCHBOY/MetaNoIndex", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : { "finder_objects" : [ { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@RSRCHBOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "5.034" } ] }, "Dist::Zilla::Role::MetaProvider::Provider" : { "inherit_missing" : "1", "inherit_version" : "1", "meta_noindex" : "1" } }, "name" : "@RSRCHBOY/MetaProvides::Package", "version" : "2.003001" }, { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "@RSRCHBOY/GithubMeta", "version" : "0.48" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@RSRCHBOY/TestRelease", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", "name" : "@RSRCHBOY/CheckChangesHasContent", "version" : "0.008" }, { "class" : "Dist::Zilla::Plugin::CheckPrereqsIndexed", "name" : "@RSRCHBOY/CheckPrereqsIndexed", "version" : "0.015" }, { "class" : "Dist::Zilla::Plugin::Git::Remote::Update", "name" : "@RSRCHBOY/GitFetchOrigin", "version" : "0.1.2" }, { "class" : "Dist::Zilla::Plugin::Git::Remote::Check", "name" : "@RSRCHBOY/GitCheckReleaseBranchSync", "version" : "0.1.2" }, { "class" : "Dist::Zilla::Plugin::Git::Remote::Check", "name" : "@RSRCHBOY/GitCheckMasterBranchSync", "version" : "0.1.2" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ ".gitignore", ".travis.yml", "Changes", "README.mkdn", "dist.ini", "weaver.ini", "LICENSE", "cpanfile" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@RSRCHBOY/Git::Check", "version" : "2.033" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%v%n%n%c", "time_zone" : "local" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ ".gitignore", ".travis.yml", "Changes", "README.mkdn", "dist.ini", "weaver.ini", "LICENSE", "cpanfile" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@RSRCHBOY/Git::Commit", "version" : "2.033" }, { "class" : "Dist::Zilla::Plugin::Test::CheckDeps", "name" : "@RSRCHBOY/Test::CheckDeps", "version" : "0.012" }, { "class" : "Dist::Zilla::Plugin::CheckSelfDependency", "config" : { "Dist::Zilla::Plugin::CheckSelfDependency" : { "finder" : [ ":InstallModules" ] }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000026", "version" : "0.003" } }, "name" : "@RSRCHBOY/CheckSelfDependency", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::Travis::ConfigForReleaseBranch", "name" : "@RSRCHBOY/Travis::ConfigForReleaseBranch", "version" : "0.001" }, { "class" : "Dist::Zilla::Plugin::SchwartzRatio", "name" : "@RSRCHBOY/SchwartzRatio", "version" : "0.2.0" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "signed" : "1", "tag" : "0.028", "tag_format" : "%v", "tag_message" : "v%v", "time_zone" : "local" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@RSRCHBOY/Git::Tag", "version" : "2.033" }, { "class" : "Dist::Zilla::Plugin::Git::CommitBuild", "config" : { "Dist::Zilla::Plugin::Git::CommitBuild" : { "branch" : "build/%b", "build_root" : null, "message" : "Build results of %h (on %b)", "multiple_inheritance" : 0, "release_branch" : null, "release_message" : "Build results of %h (on %b)" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@RSRCHBOY/Git::CommitBuild::Build", "version" : "2.033" }, { "class" : "Dist::Zilla::Plugin::Git::CommitBuild", "config" : { "Dist::Zilla::Plugin::Git::CommitBuild" : { "branch" : "build/%b", "build_root" : null, "message" : "Build results of %h (on %b)", "multiple_inheritance" : 1, "release_branch" : "release/cpan", "release_message" : "Full build of CPAN release %v%t" }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@RSRCHBOY/Git::CommitBuild::Release", "version" : "2.033" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin", "origin refs/heads/release/cpan:refs/heads/release/cpan" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "repo_root" : "." } }, "name" : "@RSRCHBOY/Git::Push", "version" : "2.033" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@RSRCHBOY/UploadToCPAN", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::Signature", "name" : "@RSRCHBOY/Signature", "version" : "1.100930" }, { "class" : "Dist::Zilla::Plugin::Twitter", "name" : "@RSRCHBOY/Twitter", "version" : "0.026" }, { "class" : "Dist::Zilla::Plugin::InstallRelease", "name" : "@RSRCHBOY/InstallRelease", "version" : "0.008" }, { "class" : "Dist::Zilla::Plugin::GitHub::Update", "name" : "@RSRCHBOY/GitHub::Update", "version" : "0.40" }, { "class" : "Dist::Zilla::Plugin::ArchiveRelease", "name" : "@RSRCHBOY/ArchiveRelease", "version" : "4.26" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@RSRCHBOY/ConfirmRelease", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@RSRCHBOY/License", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::CPANFile", "name" : "@RSRCHBOY/CPANFile", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "name" : "@RSRCHBOY/ReadmeMarkdownInRoot", "version" : "0.150250" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "name" : "@RSRCHBOY/ReadmeTxt", "version" : "0.150250" }, { "class" : "Dist::Zilla::Plugin::CopyFilesFromBuild", "name" : "@RSRCHBOY/CopyFilesFromBuild", "version" : "0.150250" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "config" : { "Dist::Zilla::Plugin::PodWeaver" : { "config_plugins" : [ "@RSRCHBOY" ], "finder" : [ ":InstallModules", ":ExecFiles" ], "plugins" : [ { "class" : "Pod::Weaver::Plugin::StopWords", "name" : "@RSRCHBOY/StopWords", "version" : "1.010" }, { "class" : "Pod::Weaver::Plugin::EnsurePod5", "name" : "@CorePrep/EnsurePod5", "version" : "4.011" }, { "class" : "Pod::Weaver::Plugin::H1Nester", "name" : "@CorePrep/H1Nester", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Name", "name" : "@RSRCHBOY/Name", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Version", "name" : "@RSRCHBOY/Version", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@RSRCHBOY/prelude", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "SYNOPSIS", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "DESCRIPTION", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Generic", "name" : "OVERVIEW", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::RSRCHBOY::RoleParameters", "name" : "ROLE PARAMETERS", "version" : "0.055" }, { "class" : "Pod::Weaver::Section::RSRCHBOY::RequiredAttributes", "name" : "REQUIRED ATTRIBUTES", "version" : "0.055" }, { "class" : "Pod::Weaver::Section::RSRCHBOY::LazyAttributes", "name" : "LAZY ATTRIBUTES", "version" : "0.055" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "ATTRIBUTES", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "METHODS", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "REQUIRED METHODS", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "FUNCTIONS", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "TYPES", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Collect", "name" : "TEST_FUNCTIONS", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Leftovers", "name" : "@RSRCHBOY/Leftovers", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::Region", "name" : "@RSRCHBOY/postlude", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::SeeAlso", "name" : "@RSRCHBOY/SeeAlso", "version" : "1.003" }, { "class" : "Pod::Weaver::Section::SourceGitHub", "name" : "@RSRCHBOY/SourceGitHub", "version" : "0.54" }, { "class" : "Pod::Weaver::Section::Bugs", "name" : "@RSRCHBOY/Bugs", "version" : "4.011" }, { "class" : "Pod::Weaver::Section::RSRCHBOY::Authors", "name" : "RSRCHBOY::Authors", "version" : "0.055" }, { "class" : "Pod::Weaver::Section::Contributors", "name" : "@RSRCHBOY/Contributors", "version" : "0.009" }, { "class" : "Pod::Weaver::Section::Legal", "name" : "@RSRCHBOY/Legal", "version" : "4.011" }, { "class" : "Pod::Weaver::Plugin::Transformer", "name" : "@RSRCHBOY/List", "version" : "4.011" }, { "class" : "Pod::Weaver::Plugin::SingleEncoding", "name" : "@RSRCHBOY/SingleEncoding", "version" : "4.011" } ] } }, "name" : "@RSRCHBOY/PodWeaver", "version" : "4.006" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "5.034" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@RSRCHBOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "5.034" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : "0" }, "version" : "5.034" } }, "x_authority" : "cpan:RSRCHBOY", "x_contributors" : [ "David Steinbrunner ", "Graham Knop " ] } MooseX-AttributeShortcuts-0.028/SIGNATURE0000644000175000017500000001006012511122102020331 0ustar rsrchboyrsrchboyThis file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.75. 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 55ac697642a18dd7d974736a3d06fd531aa82382 .travis.yml SHA1 6a2df887608ff6cd1ae11db2bbd7e2604b318bab Changes SHA1 62c6886b1f14e9e9a39f6bf00f5490057d3c2885 LICENSE SHA1 7c1852f0ceaef5560285664440a473798b49b7bf MANIFEST SHA1 72a40b1dfb133b42fe3f53654a7ebfa3560a2b36 META.json SHA1 86456471e7e76410579a35bcaa6a258789a383e6 META.yml SHA1 ab9f277c87f924683af7add61f42ace320c47a31 Makefile.PL SHA1 d43fb50509b7713ce5a36540129bc07fcc3e3528 README SHA1 b4570359a04fc7426d8c2fa689566c45c1b4213c cpanfile SHA1 5dafee4fc2c3642d0de8db57ec01d89d67fa5979 dist.ini SHA1 b4ee08f25d8bf8fdf924c36b3d65fe58cdeadc0e lib/MooseX/AttributeShortcuts.pm SHA1 c522c3928158e64bd97d34d20cbfe0b5305a7eb2 t/00-check-deps.t SHA1 761bc6c1796b43db176c6ed2efedfa2a9be74ed2 t/00-compile.t SHA1 4c280df2e0a943f1a075f4ab6df64fdb6015f80f t/000-report-versions-tiny.t SHA1 b201b29194c8e2d174032993fbf9b989d204943c t/01-basic.t SHA1 feb9ac405e94777b2eccb564c75e81b303877592 t/02-parameterized.t SHA1 8b3de3014b22392c176c297ec6169376b4c7d080 t/03-lazy.t SHA1 6f2f4e73fdbd5f1b5b502b6496575d91ffb9765d t/04-clearer-and-predicate.t SHA1 dcdac8f250e53b097c3727c6d4e5ccf2d7512277 t/05-extend.t SHA1 aeead510300b711df372bf0c026a60099d330927 t/06-role.t SHA1 141674978f422f7ae85a333e45b6984fdad9a1e8 t/07-trigger.t SHA1 2983277e0687e4cf8119b46779afb8b11b3d6329 t/anon-builder.t SHA1 cdb770dcc3e7834ebfef966b99b65696b4bebfe9 t/constraint.t SHA1 dca1fccb7685c417014a64adf9cf7dd3bac46051 t/deprecated/inline_typing.t SHA1 0693757ec019aebd05fc427a757294136889cf74 t/funcs.pm SHA1 6704194966b41752902fe8fc984cd7f5c4fe3153 t/handles-coderef.t SHA1 2a3a2473622b9bd48532a52cfb1aafe72a0d34af t/handles-metaclass.t SHA1 e47d5df31a76798e7db5a7d776330cf8ca4e43f9 t/inline_coercion-back-compat.t SHA1 78aee97e4cb5687712f41fae37fd800cd1fe3ac7 t/inline_coercion.t SHA1 efa514912dc489236506a5a9aca8414a6b661e52 t/inline_subtyping.t SHA1 2b9133942088af2b4b6926c65d7b2da8beb1f2b6 t/inline_subtyping_with_coercion.t SHA1 55d5cc1a7feafab1e88a9cbeb7975f1ec0be7721 t/isa-mooish.t SHA1 801cfa02cf426ab31f6b1f9465cbc89d78822743 t/isa_instance_of.t SHA1 06ce65438552cb8bf64a1e86f5dd084aa78d1995 xt/author/eol.t SHA1 250f25701aa7c96afaf067b3bf1400f749327b59 xt/author/no-tabs.t SHA1 36733582be7dbdcfce28e2a471e6ae82f50ee837 xt/author/pod-spell.t SHA1 a7948d34cfaad400286ea5d5fa6206c4c7e2552c xt/release/consistent-version.t SHA1 cd1efd4a6edcf18422a226628e6c7a87f2ffb7df xt/release/has-version.t SHA1 6b9989c3e0d0e9348ab8e83a25912816be52efc0 xt/release/minimum-version.t SHA1 73ebc5cc0cb99fa55a82472d63cc09edbb61c96d xt/release/no-smart-comments.t SHA1 9ff2bd29987b01440cfe648807df8cdbeedc289c xt/release/pod-coverage.t SHA1 1e6adb7e320c9a83e7e5ed59fbe4080e1d029256 xt/release/pod-linkcheck.t SHA1 a0c20421984c072fd1701d1639592f2d7c4ff226 xt/release/pod-syntax.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVJKRCAAoJEJ/Rlq0N/NXWkR4QAJmJoxGw594tcJKCZQwbMqYG LcUhbv8+x0tx/W0US9yhpLtXdZRLpK9Rb91HOm9XDrM+ApoMgfk5aBlOzkuYWAXC ybrLNM1QMDbZqUfstvXFmNkdaK8JalHuWrQ6NZDqi1KhzIXpej5lgXC6RGlt7nrX DiGwPWKP6O4wm+8nP1vwtfoCd8tBOGwWDvbbRodoM6VetSYDaSqluYIughFDibvZ NbXg7wwFtlwJX5WAC/2npySKndyvlS2JkU8TUyzZ5MO9ub22JuqsoHeuAgKfIGG8 ezFS7ogiI196rGyz5pApIFRxv9Hwu5eWyySE/rkjw+Ag/TpqzoDV1tc8jry13KZe PlQWTH/rFtKt9mcx3B7NYu4wGrVnTMXlUaBQWdWGgB5SZyYxFo5Q446qug3cfjiD gHTQ1OK4Au/RdVYwV8kXgxx47SGnz56YwEcrJbRXgRa+1fcbajUh6pMbiHNzmiWL lnGiZjRRcK2WaNdhbV5kqawhi0lYP1NFRbgjelirSmtUa40Y4EAMTYsxKS9/d96g eGnOtsGPQGNuF6Lcae1dLeawlq9TkHGSco61pNA08ahVN6Y7mCX2G9FfkyI7Yrjl AGcv5YLI5OypZd4RHqEv0xXSkl/p3HnrFdQvZ2EbKfmAqO0y5AM/h4ialGXhS/Sr mq7WzzbxXZLR8GE/XkPa =uFNh -----END PGP SIGNATURE----- MooseX-AttributeShortcuts-0.028/t/0000775000175000017500000000000012511122102017315 5ustar rsrchboyrsrchboyMooseX-AttributeShortcuts-0.028/t/funcs.pm0000644000175000017500000000510412511122102020767 0ustar rsrchboyrsrchboy# # This file is part of MooseX-AttributeShortcuts # # This software is Copyright (c) 2011 by Chris Weyl. # # This is free software, licensed under: # # The GNU Lesser General Public License, Version 2.1, February 1999 # use constant Shortcuts => 'MooseX::AttributeShortcuts::Trait::Attribute'; sub test_class { my $classname = shift @_; my $writer_prefix = shift @_ || '_set_'; my $builder_prefix = shift @_ || '_build_'; test_class_sanity_checks($classname, qw{ foo bar baz }); my $meta = $classname->meta; my ($foo, $bar, $baz) = map { $meta->get_attribute($_) } qw{ foo bar baz }; is($_->reader, $_->name, $_->name . ': reader => correct') for $foo, $bar, $baz; is($_->writer, $writer_prefix . $_->name, $_->name . ': writer => correct') for $foo, $baz; is($_->writer, undef, $_->name . ': writer => correct (undef)') for $bar; is($_->builder, undef, $_->name . ': builder => correct (undef)') for $foo; is($_->accessor, undef, $_->name . ': accessor => correct (undef)') for $foo, $bar, $baz; is($_->builder, $builder_prefix . $_->name, $_->name . ': builder => correct') for $bar, $baz; } sub test_class_sanity_checks { my ($classname, @attributes) = @_; # sanity checks meta_ok($classname); does_ok( $classname->meta->attribute_metaclass, 'MooseX::AttributeShortcuts::Trait::Attribute', ); has_attribute_ok($classname, $_) for @attributes; ok($classname->meta->get_attribute($_)->does(Shortcuts), "does role: $_") for @attributes; return; } sub check_attribute { my ($class, $name, %accessors) = @_; has_attribute_ok($class, $name); my $att = $class->meta->get_attribute($name); my $check = sub { my $property = $_; my $value = $accessors{$property}; my $has = "has_$property"; defined $value ? ok($att->$has, "$name has $property") : ok(!$att->$has, "$name does not have $property") ; is($att->$property, $value, "$name: $property correct") }; $check->() for grep { ! /(init_arg|lazy)/ } keys %accessors; if (exists $accessors{init_arg}) { if ($accessors{init_arg}) { local $_ = 'init_arg'; $check->(); } else { ok(!$att->has_init_arg, "$name has no init_arg"); } } if (exists $accessors{lazy} && $accessors{lazy}) { ok($att->is_lazy, "$name is lazy"); } elsif (exists $accessors{lazy} && !$accessors{lazy}) { is(!$att->is_lazy, "$name is not lazy"); } return; } 1; MooseX-AttributeShortcuts-0.028/t/06-role.t0000600000175000017500000000106612511122102020657 0ustar rsrchboyrsrchboyuse strict; use warnings; { package TestRole; use Moose::Role; use namespace::autoclean; use MooseX::AttributeShortcuts; has foo => (is => 'rwp'); has bar => (is => 'ro', builder => 1); } { package TestClassTwo; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; with 'TestRole'; has baz => (is => 'rwp', builder => 1); } use Test::More; use Test::Moose; require 't/funcs.pm' unless eval { require funcs }; with_immutable { test_class('TestClassTwo'); } 'TestClassTwo'; done_testing; MooseX-AttributeShortcuts-0.028/t/03-lazy.t0000600000175000017500000000200212511122102020661 0ustar rsrchboyrsrchboyuse strict; use warnings; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; has foo => (is => 'lazy'); has bar => (is => 'lazy', default => 'bip!'); # if this one fails, we're just going to get a die() off it for a "cannot # have both a builder and a default!" violation. So, the test here really # is "does it not die?" has baz => (is => 'lazy', default => 0); } use Test::More; use Test::Moose; require 't/funcs.pm' unless eval { require funcs }; my %foo_accessors = ( reader => 'foo', init_arg => 'foo', lazy => 1, builder => '_build_foo', default => undef, ); my %bar_accessors = ( reader => 'bar', init_arg => 'bar', lazy => 1, default => 'bip!', builder => undef, ); with_immutable { test_class_sanity_checks('TestClass'); check_attribute('TestClass', foo => %foo_accessors); check_attribute('TestClass', bar => %bar_accessors); } 'TestClass'; done_testing; MooseX-AttributeShortcuts-0.028/t/01-basic.t0000600000175000017500000000060012511122102020763 0ustar rsrchboyrsrchboyuse strict; use warnings; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; has foo => (is => 'rwp'); has bar => (is => 'ro', builder => 1); has baz => (is => 'rwp', builder => 1); } use Test::More; use Test::Moose; require 't/funcs.pm' unless eval { require funcs }; test_class('TestClass'); done_testing; MooseX-AttributeShortcuts-0.028/t/05-extend.t0000600000175000017500000000110412511122102021175 0ustar rsrchboyrsrchboyuse strict; use warnings; { package TestClass; use Moose; use namespace::autoclean; has bar => (is => 'ro'); } { package TestClassTwo; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; extends 'TestClass'; has '+bar' => (traits => [Shortcuts], builder => 1); has foo => (is => 'rwp'); has baz => (is => 'rwp', builder => 1); } use Test::More; use Test::Moose; require 't/funcs.pm' unless eval { require funcs }; with_immutable { test_class('TestClassTwo') } 'TestClass', 'TestClassTwo'; done_testing; MooseX-AttributeShortcuts-0.028/t/07-trigger.t0000600000175000017500000000210212511122102021352 0ustar rsrchboyrsrchboyuse strict; use warnings; my $trigger_called = 0; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; has foo => (is => 'rwp'); has bar => (is => 'ro', builder => 1); has baz => (is => 'rwp', builder => 1); sub _build_bar {} sub _build_baz {} has fee => (is => 'rw', trigger => 1); sub _trigger_fee { $trigger_called++ } has _foe => (is => 'rw', trigger => 1); sub _trigger__foe { $trigger_called++ } } use Test::More; use Test::Moose; require 't/funcs.pm' unless eval { require funcs }; with_immutable { test_class('TestClass'); for my $name (qw{ fee _foe }) { $trigger_called = 0; my $a = TestClass->meta->get_attribute($name); ok $a->has_trigger, "$name has a trigger"; ok !$trigger_called, 'no trigger calls yet'; my $tc = TestClass->new($name => 'Ian'); is $trigger_called, 1, 'trigger called once'; $tc->$name('Cormac'); is $trigger_called, 2, 'trigger called again'; } } 'TestClass'; done_testing; MooseX-AttributeShortcuts-0.028/t/constraint.t0000600000175000017500000000204512511122102021655 0ustar rsrchboyrsrchboyuse strict; use warnings; # test our new constraint option # # this test is perhaps a bit redundnant, given t/inline_*.t, but it's kinda # where I'd like to see it go when Test::Moose::More is retrofitted with # isa/type_constraint checking support. use Test::More; use Test::Moose::More; use Moose::Util; use Moose::Util::TypeConstraints; my $shortcuts; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; $shortcuts = Shortcuts; has foo => ( is => 'rw', isa => 'Str', constraint => sub { /^Hi/ }, ); } my $tc = Moose::Util::TypeConstraints::find_or_create_isa_type_constraint('Str') ->create_child_type(constraint => sub { /^Hi/ }) ; validate_class TestClass => ( attributes => [ foo => { -does => [ $shortcuts ], accessor => 'foo', original_isa => 'Str', type_constraint => $tc, isa => $tc, }, ], ); done_testing; MooseX-AttributeShortcuts-0.028/t/isa-mooish.t0000644000175000017500000000273112511122102021553 0ustar rsrchboyrsrchboyuse strict; use warnings; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; has bar => ( is => 'rw', isa => sub { die unless $_[0] == 5 || $_[0] == 10 }, ); } use Test::More; use Test::Moose::More 0.017; use Test::Fatal; # TODO shift the constraint checking out into TMM? validate_class TestClass => ( attributes => [ bar => { reader => undef, writer => undef, accessor => 'bar', required => undef, }, ], ); subtest 'value OK' => sub { my $tc; my $msg = exception { $tc = TestClass->new(bar => 5) }; is $msg, undef, 'does not die on construction'; is $tc->bar, 5, 'value is correct'; $msg = exception { $tc->bar(10) }; is $msg, undef, 'does not die on setting'; is $tc->bar, 10, 'value is correct'; }; subtest 'value NOT OK' => sub { my $error = qr/Attribute \(bar\) does not pass the type constraint/; my $tc; my $msg = exception { $tc = TestClass->new(bar => -10) }; ok !!$msg, 'dies on bad value'; like $msg, $error, 'dies with expected message'; $msg = exception { $tc = TestClass->new(bar => 5) }; is $msg, undef, 'does not die on construction with OK value'; is $tc->bar, 5, 'value is correct'; $msg = exception { $tc->bar(-10) }; ok !!$msg, 'dies on bad value'; like $msg, $error, 'dies with expected message'; }; done_testing; MooseX-AttributeShortcuts-0.028/t/00-compile.t0000644000175000017500000000213512511122102021346 0ustar rsrchboyrsrchboyuse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.052 use Test::More; plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'MooseX/AttributeShortcuts.pm' ); # no fake home requested my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; MooseX-AttributeShortcuts-0.028/t/anon-builder.t0000600000175000017500000000245412511122102022054 0ustar rsrchboyrsrchboyuse strict; use warnings; use Test::More; use Test::Moose::More 0.011; my $i = 0; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; has foo => (is => 'ro', builder => sub { $i++ }); } { package TestRole; use Moose::Role; use namespace::autoclean; use MooseX::AttributeShortcuts; has bar => (is => 'ro', builder => sub { $i++ }); } validate_class TestClass => ( attributes => [ qw{ foo } ], methods => [ qw{ foo _build_foo } ], ); is $i, 0, 'counter correct (sanity check)'; my $tc = TestClass->new; isa_ok $tc, 'TestClass'; is $i, 1, 'counter correct'; TODO: { local $TODO = 'not currently setting up anon builder as method in roles yet'; # using builders in roles and being able to exclude/alias them as # necessary when consuming them is a major win. Because of that -- and # because that's what we'd expect to be able to do with a builder when # created in the usual fashion (aka not anon sub via us) we want to create # the builder as a method in the role when we define the attribute to a # role. # # We don't do that quite yet :) validate_role TestRole => ( attributes => [ qw{ bar } ], methods => [ qw{ _build_bar } ], ); } done_testing; MooseX-AttributeShortcuts-0.028/t/00-check-deps.t0000644000175000017500000000043612511122102021726 0ustar rsrchboyrsrchboyuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::CheckDeps 0.012 use Test::More 0.94; use Test::CheckDeps 0.010; check_dependencies('suggests'); if (1) { BAIL_OUT("Missing dependencies") if !Test::More->builder->is_passing; } done_testing; MooseX-AttributeShortcuts-0.028/t/inline_coercion.t0000600000175000017500000000411412511122102022627 0ustar rsrchboyrsrchboyuse strict; use warnings; { package TestClass::From; use Moose; } my $i = 0; my $sc_trait; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; use Path::Class; use MooseX::Types::Path::Class ':all'; $sc_trait = Shortcuts; has bar => ( is => 'rw', isa => File, coerce => [ 'TestClass::From' => sub { $i++; return file('foo') }, 'Str' => sub { $i++; file $_ }, ], ); } use Test::More; use Test::Moose::More 0.018; use Test::Fatal; use Path::Class; use MooseX::Types::Path::Class ':all'; # TODO shift the constraint checking out into TMM? validate_class TestClass => ( attributes => [ bar => { -does => [ $sc_trait ], reader => undef, writer => undef, accessor => 'bar', isa => File, original_isa => 'MooseX::Types::Path::Class::File', coerce => 1, required => undef, }, ], ); subtest 'Str coercion OK' => sub { my $tc; my $msg = exception { $tc = TestClass->new(bar => 'foo') }; is $msg, undef, 'does not die on construction'; my $bar = $tc->bar; isa_ok $bar, 'Path::Class::File'; is "$bar", 'foo', 'value is correct'; $msg = exception { $tc->bar('baz') }; is $msg, undef, 'does not die on setting'; $bar = $tc->bar; isa_ok $bar, 'Path::Class::File'; is "$bar", 'baz', 'value is correct'; }; subtest 'TestClass::From coercion OK' => sub { my $tc; my $tf = TestClass::From->new(); my $msg = exception { $tc = TestClass->new(bar => $tf) }; is $msg, undef, 'does not die on construction'; my $bar = $tc->bar; isa_ok $bar, 'Path::Class::File'; is "$bar", 'foo', 'value is correct'; $msg = exception { $tc->bar($tf) }; is $msg, undef, 'does not die on setting'; $bar = $tc->bar; isa_ok $bar, 'Path::Class::File'; # yeah, I know, just go with it for now is "$bar", 'foo', 'value is correct'; }; done_testing; MooseX-AttributeShortcuts-0.028/t/isa_instance_of.t0000600000175000017500000000130612511122102022614 0ustar rsrchboyrsrchboyuse strict; use warnings; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; has bar => (is => 'ro', isa_instance_of => 'SomeClass'); } use Test::More; use Test::Moose::More; # TODO shift the constraint checking out into TMM? validate_class TestClass => ( attributes => [ qw{ bar } ], ); subtest 'isa_instance_of check' => sub { my $att = 'bar'; my $meta = TestClass->meta->get_attribute($att); ok $meta->has_type_constraint, "$att has a type constraint"; my $tc = $meta->type_constraint; isa_ok $tc, 'Moose::Meta::TypeConstraint::Class'; is $tc->class, 'SomeClass', 'tc looks for correct class'; }; done_testing; MooseX-AttributeShortcuts-0.028/t/handles-coderef.t0000644000175000017500000000143612511122102022527 0ustar rsrchboyrsrchboyuse strict; use warnings; use Test::More; use Test::Moose::More; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; has foo => ( is => 'ro', isa => 'Int', handles => { our_accessor => sub { my $self = shift @_; Test::More::pass 'in our_accessor()'; Test::More::isa_ok $_, 'Moose::Meta::Attribute'; return $_->get_value($self) + 2; }, }, ); } validate_class TestClass => ( attributes => [ qw{ foo } ], methods => [ qw{ foo our_accessor } ], ); my $tc = TestClass->new(foo => 4); isa_ok($tc, 'TestClass'); is $tc->foo, 4, 'foo() is 4'; is $tc->our_accessor, 6, 'our_accessor() is 6'; done_testing; MooseX-AttributeShortcuts-0.028/t/inline_subtyping.t0000600000175000017500000000301512511122102023051 0ustar rsrchboyrsrchboyuse strict; use warnings; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; has bar => ( is => 'rw', isa => 'Int', constraint => sub { $_ > 0 }, ); } use Test::More; use Test::Moose::More 0.017; use Test::Fatal; # TODO shift the constraint checking out into TMM? validate_class TestClass => ( attributes => [ bar => { reader => undef, writer => undef, accessor => 'bar', original_isa => 'Int', required => undef, }, ], ); subtest 'value OK' => sub { my $tc; my $msg = exception { $tc = TestClass->new(bar => 10) }; is $msg, undef, 'does not die on construction'; is $tc->bar, 10, 'value is correct'; $msg = exception { $tc->bar(20) }; is $msg, undef, 'does not die on setting'; is $tc->bar, 20, 'value is correct'; }; subtest 'value NOT OK' => sub { my $error = qr/Attribute \(bar\) does not pass the type constraint/; my $tc; my $msg = exception { $tc = TestClass->new(bar => -10) }; ok !!$msg, 'dies on bad value'; like $msg, $error, 'dies with expected message'; $msg = exception { $tc = TestClass->new(bar => 10) }; is $msg, undef, 'does not die on construction with OK value'; is $tc->bar, 10, 'value is correct'; $msg = exception { $tc->bar(-10) }; ok !!$msg, 'dies on bad value'; like $msg, $error, 'dies with expected message'; }; done_testing; MooseX-AttributeShortcuts-0.028/t/02-parameterized.t0000600000175000017500000000153412511122102022546 0ustar rsrchboyrsrchboyuse strict; use warnings; { package TestClass::WriterPrefix; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts -writer_prefix => '_'; has foo => (is => 'rwp'); has bar => (is => 'ro', builder => 1); has baz => (is => 'rwp', builder => 1); } { package TestClass::BuilderPrefix; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts -builder_prefix => '_silly_'; has foo => (is => 'rwp'); has bar => (is => 'ro', builder => 1); has baz => (is => 'rwp', builder => 1); } use Test::More; use Test::Moose; require 't/funcs.pm' unless eval { require funcs }; with_immutable { test_class('TestClass::WriterPrefix', '_') } 'TestClass::WriterPrefix'; with_immutable { test_class('TestClass::BuilderPrefix', undef, '_silly_') } 'TestClass::BuilderPrefix'; done_testing; MooseX-AttributeShortcuts-0.028/t/handles-metaclass.t0000600000175000017500000000050012511122102023053 0ustar rsrchboyrsrchboyuse strict; use warnings; use Test::More; use Test::Fatal; use MooseX::AttributeShortcuts (); { package TestClass; } my $dies = exception { MooseX::AttributeShortcuts->init_meta(for_class => 'foo') }; like $dies, qr/Class foo has no metaclass!/, 'init_meta() dies on no-metaclass', ; done_testing; MooseX-AttributeShortcuts-0.028/t/04-clearer-and-predicate.t0000600000175000017500000000200412511122102024020 0ustar rsrchboyrsrchboyuse strict; use warnings; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; has foo => (is => 'rw', clearer => 1, predicate => -1); has _foo => (is => 'rw', clearer => 1, predicate => -1); has bar => (is => 'rw', predicate => 1, clearer => -1); has _bar => (is => 'rw', predicate => 1, clearer => -1); } use Test::More; use Test::Moose; require 't/funcs.pm' unless eval { require funcs }; with_immutable { test_class_sanity_checks('TestClass'); check_attribute('TestClass', foo => (accessor => 'foo', clearer => 'clear_foo', predicate => '_has_foo')); check_attribute('TestClass', _foo => (accessor => '_foo', clearer => '_clear_foo', predicate => 'has_foo')); check_attribute('TestClass', bar => (accessor => 'bar', predicate => 'has_bar', clearer => '_clear_bar')); check_attribute('TestClass', _bar => (accessor => '_bar', predicate => '_has_bar', clearer => 'clear_bar')); } 'TestClass'; done_testing; MooseX-AttributeShortcuts-0.028/t/deprecated/0000775000175000017500000000000012511122102021415 5ustar rsrchboyrsrchboyMooseX-AttributeShortcuts-0.028/t/deprecated/inline_typing.t0000644000175000017500000000246112511122102024453 0ustar rsrchboyrsrchboyuse strict; use warnings; use Test::More; use Test::Moose::More; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; use Test::Warn; warnings_exist { has bar => (is => 'ro', isa_class => 'SomeClass'); has baz => (is => 'rwp', isa_role => 'SomeRole'); } [ qr/Naughty! isa_class, isa_role, and isa_enum will be removed on or after 01 July 2015!/ ], 'expected warnings thrown for isa_class, isa_role usage', ; } # TODO shift the constraint checking out into TMM? validate_class TestClass => ( attributes => [ qw{ bar baz } ], ); subtest 'isa_class check' => sub { my $att = 'bar'; my $meta = TestClass->meta->get_attribute($att); ok $meta->has_type_constraint, "$att has a type constraint"; my $tc = $meta->type_constraint; isa_ok $tc, 'Moose::Meta::TypeConstraint::Class'; is $tc->class, 'SomeClass', 'tc looks for correct class'; }; subtest 'isa_role check' => sub { my $att = 'baz'; my $meta = TestClass->meta->get_attribute($att); ok $meta->has_type_constraint, "$att has a type constraint"; my $tc = $meta->type_constraint; isa_ok $tc, 'Moose::Meta::TypeConstraint::Role'; is $tc->role, 'SomeRole', 'tc looks for correct role'; }; done_testing; MooseX-AttributeShortcuts-0.028/t/000-report-versions-tiny.t0000644000175000017500000000670712511122102024151 0ustar rsrchboyrsrchboyuse strict; use warnings; use Test::More 0.88; # This is a relatively nice way to avoid Test::NoWarnings breaking our # expectations by adding extra tests, without using no_plan. It also helps # avoid any other test module that feels introducing random tests, or even # test plans, is a nice idea. our $success = 0; END { $success && done_testing; } # List our own version used to generate this my $v = "\nGenerated by Dist::Zilla::Plugin::ReportVersions::Tiny v1.10\n"; eval { # no excuses! # report our Perl details my $want = '5.006'; $v .= "perl: $] (wanted $want) on $^O from $^X\n\n"; }; defined($@) and diag("$@"); # Now, our module version dependencies: sub pmver { my ($module, $wanted) = @_; $wanted = " (want $wanted)"; my $pmver; eval "require $module;"; if ($@) { if ($@ =~ m/Can't locate .* in \@INC/) { $pmver = 'module not found.'; } else { diag("${module}: $@"); $pmver = 'died during require.'; } } else { my $version; eval { $version = $module->VERSION; }; if ($@) { diag("${module}: $@"); $pmver = 'died during VERSION check.'; } elsif (defined $version) { $pmver = "$version"; } else { $pmver = ''; } } # So, we should be good, right? return sprintf('%-45s => %-10s%-15s%s', $module, $pmver, $wanted, "\n"); } eval { $v .= pmver('ExtUtils::MakeMaker','any version') }; eval { $v .= pmver('File::Spec','any version') }; eval { $v .= pmver('IO::Handle','any version') }; eval { $v .= pmver('IPC::Open3','any version') }; eval { $v .= pmver('List::AllUtils','any version') }; eval { $v .= pmver('Moose','1.14') }; eval { $v .= pmver('Moose::Exporter','any version') }; eval { $v .= pmver('Moose::Meta::TypeConstraint','any version') }; eval { $v .= pmver('Moose::Role','any version') }; eval { $v .= pmver('Moose::Util','any version') }; eval { $v .= pmver('Moose::Util::MetaRole','any version') }; eval { $v .= pmver('Moose::Util::TypeConstraints','any version') }; eval { $v .= pmver('MooseX::Meta::TypeConstraint::Mooish','any version') }; eval { $v .= pmver('MooseX::Role::Parameterized','any version') }; eval { $v .= pmver('MooseX::Types::Common::String','any version') }; eval { $v .= pmver('MooseX::Types::Moose','any version') }; eval { $v .= pmver('MooseX::Types::Path::Class','any version') }; eval { $v .= pmver('Package::DeprecationManager','any version') }; eval { $v .= pmver('Path::Class','any version') }; eval { $v .= pmver('Test::CheckDeps','0.010') }; eval { $v .= pmver('Test::Fatal','any version') }; eval { $v .= pmver('Test::Moose','any version') }; eval { $v .= pmver('Test::Moose::More','0.018') }; eval { $v .= pmver('Test::More','0.94') }; eval { $v .= pmver('Test::Warn','any version') }; eval { $v .= pmver('aliased','any version') }; eval { $v .= pmver('constant','any version') }; eval { $v .= pmver('namespace::autoclean','any version') }; eval { $v .= pmver('strict','any version') }; eval { $v .= pmver('warnings','any version') }; # All done. $v .= <<'EOT'; Thanks for using my code. I hope it works for you. If not, please try and include this output in the bug report. That will help me reproduce the issue and solve your problem. EOT diag($v); ok(1, "we really didn't test anything, just reporting data"); $success = 1; # Work around another nasty module on CPAN. :/ no warnings 'once'; $Template::Test::NO_FLUSH = 1; exit 0; MooseX-AttributeShortcuts-0.028/t/inline_coercion-back-compat.t0000644000175000017500000000472412511122102025025 0ustar rsrchboyrsrchboyuse strict; use warnings; # small, minimal test to ensure our hashref-based attribute matching is still # working as expected # # That is to say, working unless you hit a nasty bug. use Test::More; use Test::Moose::More 0.018; use Test::Fatal; { package TestClass::From; use Moose; } my $i = 0; my $sc_trait; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; use Path::Class; use MooseX::Types::Path::Class ':all'; use Test::Warn; $sc_trait = Shortcuts; warnings_exist { has bar => ( is => 'rw', isa => File, coerce => { 'TestClass::From' => sub { $i++; return file('foo') }, 'Str' => sub { $i++; file $_ }, }, ) } [ qr/Passing a hashref to coerce is unsafe, and will be removed on or after 01 Jan 2015/ ], 'expected warning thrown for coerce => {} usage', ; } use Path::Class; use MooseX::Types::Path::Class ':all'; # TODO shift the constraint checking out into TMM? validate_class TestClass => ( attributes => [ bar => { -does => [ $sc_trait ], reader => undef, writer => undef, accessor => 'bar', isa => File, original_isa => 'MooseX::Types::Path::Class::File', coerce => 1, required => undef, }, ], ); subtest 'Str coercion OK' => sub { my $tc; my $msg = exception { $tc = TestClass->new(bar => 'foo') }; is $msg, undef, 'does not die on construction'; my $bar = $tc->bar; isa_ok $bar, 'Path::Class::File'; is "$bar", 'foo', 'value is correct'; $msg = exception { $tc->bar('baz') }; is $msg, undef, 'does not die on setting'; $bar = $tc->bar; isa_ok $bar, 'Path::Class::File'; is "$bar", 'baz', 'value is correct'; }; subtest 'TestClass::From coercion OK' => sub { my $tc; my $tf = TestClass::From->new(); my $msg = exception { $tc = TestClass->new(bar => $tf) }; is $msg, undef, 'does not die on construction'; my $bar = $tc->bar; isa_ok $bar, 'Path::Class::File'; is "$bar", 'foo', 'value is correct'; $msg = exception { $tc->bar($tf) }; is $msg, undef, 'does not die on setting'; $bar = $tc->bar; isa_ok $bar, 'Path::Class::File'; # yeah, I know, just go with it for now is "$bar", 'foo', 'value is correct'; }; done_testing; MooseX-AttributeShortcuts-0.028/t/inline_subtyping_with_coercion.t0000600000175000017500000000371712511122102025776 0ustar rsrchboyrsrchboyuse strict; use warnings; { package TestClass; use Moose; use namespace::autoclean; use MooseX::AttributeShortcuts; use MooseX::Types::Path::Class ':all'; has bar => ( is => 'rw', isa => File, coerce => 1, constraint => sub { "$_" =~ /foo|baz/ }, ); } use Test::More; use Test::Moose::More 0.018; use Test::Fatal; use Path::Class; use MooseX::Types::Path::Class ':all'; # TODO shift the constraint checking out into TMM? validate_class TestClass => ( attributes => [ bar => { reader => undef, writer => undef, accessor => 'bar', original_isa => File, coerce => 1, required => undef, }, ], ); subtest 'value OK' => sub { my $tc; my $msg = exception { $tc = TestClass->new(bar => 'foo') }; is $msg, undef, 'does not die on construction'; my $bar = $tc->bar; isa_ok $bar, 'Path::Class::File'; is "$bar", 'foo', 'value is correct'; $msg = exception { $tc->bar('baz') }; is $msg, undef, 'does not die on setting'; $bar = $tc->bar; isa_ok $bar, 'Path::Class::File'; is "$bar", 'baz', 'value is correct'; }; subtest 'value NOT OK' => sub { my $error = qr/Attribute \(bar\) does not pass the type constraint/; my $tc; my $msg = exception { $tc = TestClass->new(bar => 'bip') }; ok !!$msg, 'dies on bad value'; like $msg, $error, 'dies with expected message'; $msg = exception { $tc = TestClass->new(bar => file('bip')) }; ok !!$msg, 'dies on bad value'; like $msg, $error, 'dies with expected message'; $tc = TestClass->new; $msg = exception { $tc->bar('bip') }; ok !!$msg, 'dies on bad value'; like $msg, $error, 'dies with expected message'; $msg = exception { $tc->bar(file 'bip') }; ok !!$msg, 'dies on bad value'; like $msg, $error, 'dies with expected message'; }; done_testing; MooseX-AttributeShortcuts-0.028/Makefile.PL0000644000175000017500000000556512511122102021035 0ustar rsrchboyrsrchboy# # This file is part of MooseX-AttributeShortcuts # # This software is Copyright (c) 2011 by Chris Weyl. # # This is free software, licensed under: # # The GNU Lesser General Public License, Version 2.1, February 1999 # # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.034. use strict; use warnings; use 5.006; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Shorthand for common attribute options", "AUTHOR" => "Chris Weyl ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "MooseX-AttributeShortcuts", "EXE_FILES" => [], "LICENSE" => "lgpl", "MIN_PERL_VERSION" => "5.006", "NAME" => "MooseX::AttributeShortcuts", "PREREQ_PM" => { "List::AllUtils" => 0, "Moose" => "1.14", "Moose::Exporter" => 0, "Moose::Meta::TypeConstraint" => 0, "Moose::Util::MetaRole" => 0, "Moose::Util::TypeConstraints" => 0, "MooseX::Meta::TypeConstraint::Mooish" => 0, "MooseX::Role::Parameterized" => 0, "MooseX::Types::Common::String" => 0, "MooseX::Types::Moose" => 0, "Package::DeprecationManager" => 0, "aliased" => 0, "namespace::autoclean" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Moose::Role" => 0, "Moose::Util" => 0, "MooseX::Types::Path::Class" => 0, "Path::Class" => 0, "Test::CheckDeps" => "0.010", "Test::Fatal" => 0, "Test::Moose" => 0, "Test::Moose::More" => "0.018", "Test::More" => "0.94", "Test::Warn" => 0, "constant" => 0 }, "VERSION" => "0.028", "test" => { "TESTS" => "t/*.t t/deprecated/*.t" } ); my %FallbackPrereqs = ( "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "List::AllUtils" => 0, "Moose" => "1.14", "Moose::Exporter" => 0, "Moose::Meta::TypeConstraint" => 0, "Moose::Role" => 0, "Moose::Util" => 0, "Moose::Util::MetaRole" => 0, "Moose::Util::TypeConstraints" => 0, "MooseX::Meta::TypeConstraint::Mooish" => 0, "MooseX::Role::Parameterized" => 0, "MooseX::Types::Common::String" => 0, "MooseX::Types::Moose" => 0, "MooseX::Types::Path::Class" => 0, "Package::DeprecationManager" => 0, "Path::Class" => 0, "Test::CheckDeps" => "0.010", "Test::Fatal" => 0, "Test::Moose" => 0, "Test::Moose::More" => "0.018", "Test::More" => "0.94", "Test::Warn" => 0, "aliased" => 0, "constant" => 0, "namespace::autoclean" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); MooseX-AttributeShortcuts-0.028/.travis.yml0000644000175000017500000000071012511122102021157 0ustar rsrchboyrsrchboylanguage: perl perl: - "5.8" - "5.10" - "5.12" - "5.14" - "5.16" - "5.18" matrix: allow_failures: - perl: "5.8" before_install: # git bits sometimes needed... - git config user.name 'Travis-CI' - git config user.email 'travis@nowhere.dne' install: # not so much install our package as all its prereqs - cpanm --installdeps . || { cat ~/.cpanm/build.log ; false ; } script: - perl Makefile.PL - make test MooseX-AttributeShortcuts-0.028/xt/0000775000175000017500000000000012511122102017505 5ustar rsrchboyrsrchboyMooseX-AttributeShortcuts-0.028/xt/author/0000775000175000017500000000000012511122102021007 5ustar rsrchboyrsrchboyMooseX-AttributeShortcuts-0.028/xt/author/eol.t0000644000175000017500000000152612511122102021755 0ustar rsrchboyrsrchboyuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::EOL 0.17 use Test::More 0.88; use Test::EOL; my @files = ( 'lib/MooseX/AttributeShortcuts.pm', 't/00-check-deps.t', 't/00-compile.t', 't/000-report-versions-tiny.t', 't/01-basic.t', 't/02-parameterized.t', 't/03-lazy.t', 't/04-clearer-and-predicate.t', 't/05-extend.t', 't/06-role.t', 't/07-trigger.t', 't/anon-builder.t', 't/constraint.t', 't/deprecated/inline_typing.t', 't/funcs.pm', 't/handles-coderef.t', 't/handles-metaclass.t', 't/inline_coercion-back-compat.t', 't/inline_coercion.t', 't/inline_subtyping.t', 't/inline_subtyping_with_coercion.t', 't/isa-mooish.t', 't/isa_instance_of.t' ); eol_unix_ok($_, { trailing_whitespace => 1 }) foreach @files; done_testing; MooseX-AttributeShortcuts-0.028/xt/author/no-tabs.t0000644000175000017500000000147412511122102022543 0ustar rsrchboyrsrchboyuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.13 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/MooseX/AttributeShortcuts.pm', 't/00-check-deps.t', 't/00-compile.t', 't/000-report-versions-tiny.t', 't/01-basic.t', 't/02-parameterized.t', 't/03-lazy.t', 't/04-clearer-and-predicate.t', 't/05-extend.t', 't/06-role.t', 't/07-trigger.t', 't/anon-builder.t', 't/constraint.t', 't/deprecated/inline_typing.t', 't/funcs.pm', 't/handles-coderef.t', 't/handles-metaclass.t', 't/inline_coercion-back-compat.t', 't/inline_coercion.t', 't/inline_subtyping.t', 't/inline_subtyping_with_coercion.t', 't/isa-mooish.t', 't/isa_instance_of.t' ); notabs_ok($_) foreach @files; done_testing; MooseX-AttributeShortcuts-0.028/xt/author/pod-spell.t0000644000175000017500000000067012511122102023074 0ustar rsrchboyrsrchboyuse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.006008 use Test::Spelling 0.12; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ AFAICT ABEND RSRCHBOY RSRCHBOY's gpg ini metaclass metaclasses parameterized parameterization subclasses coderef Chris Weyl cweyl David Steinbrunner dsteinbrunner Graham Knop haarg lib MooseX AttributeShortcuts MooseX-AttributeShortcuts-0.028/xt/release/0000775000175000017500000000000012511122102021125 5ustar rsrchboyrsrchboyMooseX-AttributeShortcuts-0.028/xt/release/pod-syntax.t0000644000175000017500000000055712511122102023425 0ustar rsrchboyrsrchboy#!perl # # This file is part of MooseX-AttributeShortcuts # # This software is Copyright (c) 2011 by Chris Weyl. # # This is free software, licensed under: # # The GNU Lesser General Public License, Version 2.1, February 1999 # # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use Test::More; use Test::Pod 1.41; all_pod_files_ok(); MooseX-AttributeShortcuts-0.028/xt/release/has-version.t0000644000175000017500000000057412511122102023554 0ustar rsrchboyrsrchboy#!perl # # This file is part of MooseX-AttributeShortcuts # # This software is Copyright (c) 2011 by Chris Weyl. # # This is free software, licensed under: # # The GNU Lesser General Public License, Version 2.1, February 1999 # use Test::More; eval "use Test::HasVersion"; plan skip_all => "Test::HasVersion required for testing version numbers" if $@; all_pm_version_ok(); MooseX-AttributeShortcuts-0.028/xt/release/pod-coverage.t0000644000175000017500000000067312511122102023671 0ustar rsrchboyrsrchboy#!perl # # This file is part of MooseX-AttributeShortcuts # # This software is Copyright (c) 2011 by Chris Weyl. # # This is free software, licensed under: # # The GNU Lesser General Public License, Version 2.1, February 1999 # # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::Pod::Coverage 1.08; use Pod::Coverage::TrustPod; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); MooseX-AttributeShortcuts-0.028/xt/release/pod-linkcheck.t0000644000175000017500000000107612511122102024027 0ustar rsrchboyrsrchboy#!perl # # This file is part of MooseX-AttributeShortcuts # # This software is Copyright (c) 2011 by Chris Weyl. # # This is free software, licensed under: # # The GNU Lesser General Public License, Version 2.1, February 1999 # use strict; use warnings; use Test::More; foreach my $env_skip ( qw( SKIP_POD_LINKCHECK ) ){ plan skip_all => "\$ENV{$env_skip} is set, skipping" if $ENV{$env_skip}; } eval "use Test::Pod::LinkCheck"; if ( $@ ) { plan skip_all => 'Test::Pod::LinkCheck required for testing POD'; } else { Test::Pod::LinkCheck->new->all_pod_ok; } MooseX-AttributeShortcuts-0.028/xt/release/minimum-version.t0000644000175000017500000000063012511122102024445 0ustar rsrchboyrsrchboy#!perl # # This file is part of MooseX-AttributeShortcuts # # This software is Copyright (c) 2011 by Chris Weyl. # # This is free software, licensed under: # # The GNU Lesser General Public License, Version 2.1, February 1999 # use Test::More; eval "use Test::MinimumVersion"; plan skip_all => "Test::MinimumVersion required for testing minimum versions" if $@; all_minimum_version_ok( qq{5.008008} ); MooseX-AttributeShortcuts-0.028/xt/release/no-smart-comments.t0000644000175000017500000000075012511122102024675 0ustar rsrchboyrsrchboy#!/usr/bin/env perl # # This file is part of MooseX-AttributeShortcuts # # This software is Copyright (c) 2011 by Chris Weyl. # # This is free software, licensed under: # # The GNU Lesser General Public License, Version 2.1, February 1999 # use strict; use warnings; use Test::More 0.88; eval "use Test::NoSmartComments"; plan skip_all => 'Test::NoSmartComments required for checking comment IQ' if $@; no_smart_comments_in_all(); no_smart_comments_in_tests(); done_testing(); MooseX-AttributeShortcuts-0.028/xt/release/consistent-version.t0000644000175000017500000000032412511122102025163 0ustar rsrchboyrsrchboyuse strict; use warnings; use Test::More; eval "use Test::ConsistentVersion"; plan skip_all => "Test::ConsistentVersion required for this test" if $@; Test::ConsistentVersion::check_consistent_versions(); MooseX-AttributeShortcuts-0.028/lib/0000775000175000017500000000000012511122102017620 5ustar rsrchboyrsrchboyMooseX-AttributeShortcuts-0.028/lib/MooseX/0000775000175000017500000000000012511122102021032 5ustar rsrchboyrsrchboyMooseX-AttributeShortcuts-0.028/lib/MooseX/AttributeShortcuts.pm0000644000175000017500000007224412511122102025261 0ustar rsrchboyrsrchboy# # This file is part of MooseX-AttributeShortcuts # # This software is Copyright (c) 2011 by Chris Weyl. # # This is free software, licensed under: # # The GNU Lesser General Public License, Version 2.1, February 1999 # package MooseX::AttributeShortcuts; our $AUTHORITY = 'cpan:RSRCHBOY'; # git description: 0.027_02-0-g8e66785 $MooseX::AttributeShortcuts::VERSION = '0.028'; # ABSTRACT: Shorthand for common attribute options use strict; use warnings; use namespace::autoclean; use Moose 1.14 (); use Moose::Exporter; use Moose::Meta::TypeConstraint; use Moose::Util::MetaRole; use Moose::Util::TypeConstraints; { package MooseX::AttributeShortcuts::Trait::Attribute; our $AUTHORITY = 'cpan:RSRCHBOY'; # git description: 0.027_02-0-g8e66785 $MooseX::AttributeShortcuts::Trait::Attribute::VERSION = '0.028'; use namespace::autoclean; use MooseX::Role::Parameterized; use Moose::Util::TypeConstraints ':all'; use MooseX::Types::Moose ':all'; use MooseX::Types::Common::String ':all'; use aliased 'MooseX::Meta::TypeConstraint::Mooish' => 'MooishTC'; use List::AllUtils 'any'; use Package::DeprecationManager -deprecations => { 'undocumented-isa-constraints' => '0.23', 'hashref-given-to-coerce' => '0.24', }; sub _acquire_isa_tc { goto \&Moose::Util::TypeConstraints::find_or_create_isa_type_constraint } parameter writer_prefix => (isa => NonEmptySimpleStr, default => '_set_'); parameter builder_prefix => (isa => NonEmptySimpleStr, default => '_build_'); # I'm not going to document the following for the moment, as I'm not sure I # want to do it this way. parameter prefixes => ( isa => HashRef[NonEmptySimpleStr], default => sub { { } }, ); role { my $p = shift @_; my $wprefix = $p->writer_prefix; my $bprefix = $p->builder_prefix; my %prefix = ( predicate => 'has', clearer => 'clear', trigger => '_trigger_', %{ $p->prefixes }, ); has anon_builder => ( reader => 'anon_builder', writer => '_set_anon_builder', isa => 'CodeRef', predicate => 'has_anon_builder', init_arg => '_anon_builder', ); has constraint => ( is => 'ro', isa => 'CodeRef', predicate => 'has_constraint', ); has original_isa => ( is => 'ro', predicate => 'has_original_isa', ); # TODO coerce via, transform ? # has original_isa, original_coerce ? my $_process_options = sub { my ($class, $name, $options) = @_; my $_has = sub { defined $options->{$_[0]} }; my $_opt = sub { $_has->(@_) ? $options->{$_[0]} : q{} }; my $_ref = sub { ref $_opt->(@_) || q{} }; # handle: is => ... $class->_mxas_is_rwp($name, $options, $_has, $_opt, $_ref); $class->_mxas_is_lazy($name, $options, $_has, $_opt, $_ref); # handle: builder => 1, builder => sub { ... } $class->_mxas_builder($name, $options, $_has, $_opt, $_ref); # handle: isa_class, isa_role, isa_enum $class->_mxas_isa_naughty($name, $options, $_has, $_opt, $_ref); # handle: isa_instance_of => ... $class->_mxas_isa_instance_of($name, $options, $_has, $_opt, $_ref); # handle: isa => sub { ... } $class->_mxas_isa_mooish($name, $options, $_has, $_opt, $_ref); # handle: constraint => ... $class->_mxas_constraint($name, $options, $_has, $_opt, $_ref); $class->_mxas_coerce($name, $options, $_has, $_opt, $_ref); my $is_private = sub { $name =~ /^_/ ? $_[0] : $_[1] }; my $default_for = sub { my ($opt) = @_; return unless $_has->($opt); my $opt_val = $_opt->($opt); my ($head, $mid) = $opt_val eq '1' ? ($is_private->('_', q{}), $is_private->(q{}, '_')) : $opt_val eq '-1' ? ($is_private->(q{}, '_'), $is_private->(q{}, '_')) : return; $options->{$opt} = $head . $prefix{$opt} . $mid . $name; return; }; ### set our other defaults, if requested... $default_for->($_) for qw{ predicate clearer }; my $trigger = "$prefix{trigger}$name"; $options->{trigger} = sub { shift->$trigger(@_) } if $options->{trigger} && $options->{trigger} eq '1'; return; }; # here we wrap _process_options() instead of the newer _process_is_option(), # as that makes our life easier from a 1.x/2.x compatibility # perspective -- and that we're potentially altering more than just # the 'is' option at one time. before _process_options => $_process_options; # this feels... bad. But I'm not sure there's any way to ensure we # process options on a clone/extends without wrapping new(). around new => sub { my ($orig, $self) = (shift, shift); my ($name, %options) = @_; $self->$_process_options($name, \%options) if $options{__hack_no_process_options}; return $self->$orig($name, %options); }; # handle: is => 'rwp' method _mxas_is_rwp => sub { my ($class, $name, $options, $_has, $_opt, $_ref) = @_; return unless $_opt->('is') eq 'rwp'; $options->{is} = 'ro'; $options->{writer} = "$wprefix$name"; return; }; # handle: is => 'lazy' method _mxas_is_lazy => sub { my ($class, $name, $options, $_has, $_opt, $_ref) = @_; return unless $_opt->('is') eq 'lazy'; $options->{is} = 'ro'; $options->{lazy} = 1; $options->{builder} = 1 unless $_has->('builder') || $_has->('default'); return; }; # handle: lazy_build => 'private' method _mxas_lazy_build_private => sub { my ($class, $name, $options, $_has, $_opt, $_ref) = @_; return unless $_opt->('lazy_build') eq 'private'; $options->{lazy_build} = 1; $options->{clearer} = "_clear_$name"; $options->{predicate} = "_has_$name"; return; }; # handle: isa_class, isa_role, isa_enum method _mxas_isa_naughty => sub { my ($class, $name, $options, $_has, $_opt, $_ref) = @_; return unless any { exists $options->{$_} } qw{ isa_class isa_role isa_enum }; # (more than) fair warning... deprecated( feature => 'undocumented-isa-constraints', message => 'Naughty! isa_class, isa_role, and isa_enum will be removed on or after 01 July 2015!', ); # XXX undocumented -- not sure this is a great idea $options->{isa} = class_type(delete $options->{isa_class}) if $_has->('isa_class'); $options->{isa} = role_type(delete $options->{isa_role}) if $_has->('isa_role'); $options->{isa} = enum(delete $options->{isa_enum}) if $_has->('isa_enum'); return; }; # handle: builder => 1, builder => sub { ... } method _mxas_builder => sub { my ($class, $name, $options, $_has, $_opt, $_ref) = @_; return unless $_has->('builder'); if ($_ref->('builder') eq 'CODE') { $options->{_anon_builder} = $options->{builder}; $options->{builder} = 1; } $options->{builder} = "$bprefix$name" if $options->{builder} eq '1'; return; }; method _mxas_isa_mooish => sub { my ($class, $name, $options, $_has, $_opt, $_ref) = @_; return unless $_ref->('isa') eq 'CODE'; ### build a mooish type constraint... $options->{original_isa} = $options->{isa}; $options->{isa} = MooishTC->new(constraint => $options->{isa}); return; }; # handle: isa_instance_of => ... method _mxas_isa_instance_of => sub { my ($class, $name, $options, $_has, $_opt, $_ref) = @_; return unless $_has->('isa_instance_of'); if ($_has->('isa')) { $class->throw_error( q{Cannot use 'isa_instance_of' and 'isa' together for attribute } . $_opt->('definition_context')->{package} . '::' . $name ); } $options->{isa} = class_type(delete $options->{isa_instance_of}); return; }; method _mxas_constraint => sub { my ($class, $name, $options, $_has, $_opt, $_ref) = @_; return unless $_has->('constraint'); # check for errors... $class->throw_error('You must specify an "isa" when declaring a "constraint"') if !$_has->('isa'); $class->throw_error('"constraint" must be a CODE reference') if $_ref->('constraint') ne 'CODE'; # constraint checking! XXX message, etc? push my @opts, constraint => $_opt->('constraint') if $_ref->('constraint') eq 'CODE'; # stash our original option away and construct our new one my $isa = $options->{original_isa} = $_opt->('isa'); $options->{isa} = _acquire_isa_tc($isa)->create_child_type(@opts); return; }; method _mxas_coerce => sub { my ($class, $name, $options, $_has, $_opt, $_ref) = @_; # "fix" the case of the hashref.... *sigh* if ($_ref->('coerce') eq 'HASH') { deprecated( feature => 'hashref-given-to-coerce', message => 'Passing a hashref to coerce is unsafe, and will be removed on or after 01 Jan 2015', ); $options->{coerce} = [ %{ $options->{coerce} } ]; } if ($_ref->('coerce') eq 'ARRAY') { ### must be type => sub { ... } pairs... my @coercions = @{ $_opt->('coerce') }; confess 'You must specify an "isa" when declaring "coercion"' unless $_has->('isa'); confess 'coercion array must be in pairs!' if @coercions % 2; confess 'must define at least one coercion pair!' unless @coercions > 0; my $our_coercion = Moose::Meta::TypeCoercion->new; my $our_type = $options->{original_isa} ? $options->{isa} : _acquire_isa_tc($_opt->('isa'))->create_child_type ; $our_coercion->add_type_coercions(@coercions); $our_type->coercion($our_coercion); $options->{original_isa} ||= $options->{isa}; $options->{isa} = $our_type; $options->{coerce} = 1; return; } # If our original constraint has coercions and our created subtype # did not have any (as specified in the 'coerce' option), then # copy the parent's coercions over. if ($_has->('original_isa') && $_opt->('coerce') eq '1') { my $isa_type = _acquire_isa_tc($_opt->('original_isa')); if ($isa_type->has_coercion) { # create our coercion as a copy of the parent $_opt->('isa')->coercion(Moose::Meta::TypeCoercion->new( type_constraint => $_opt->('isa'), type_coercion_map => [ @{ $isa_type->coercion->type_coercion_map } ], )); } } return; }; # we hijack attach_to_class in order to install our anon_builder, if # we have one. Note that we don't go the normal # associate_method/install_accessor/etc route as this is kinda... # different. after attach_to_class => sub { my ($self, $class) = @_; return unless $self->has_anon_builder; $class->add_method($self->builder => $self->anon_builder); return; }; method mi => sub { shift->associated_class->get_meta_instance }; method weaken_value => sub { $_[0]->mi->weaken_slot_value($_[1] => $_) for $_[0]->slots }; method strengthen_value => sub { $_[0]->mi->strengthen_slot_value($_[1] => $_) for $_[0]->slots }; # NOTE: remove_delegation() will also automagically remove any custom # accessors we create here around _make_delegation_method => sub { my ($orig, $self) = (shift, shift); my ($name, $coderef) = @_; ### _make_delegation_method() called with a: ref $coderef return $self->$orig(@_) unless 'CODE' eq ref $coderef; # this coderef will be installed as a method on the associated class itself. my $custom_coderef = sub { # aka $self from the class instance's perspective my $associated_class_instance = shift @_; # in $coderef, $_ will be the attribute metaclass local $_ = $self; return $associated_class_instance->$coderef(@_); }; return $self->_process_accessors(custom => { $name => $custom_coderef }); }; return; }; } my ($import, $unimport, $init_meta) = Moose::Exporter->build_import_methods( install => [ 'unimport' ], trait_aliases => [ [ 'MooseX::AttributeShortcuts::Trait::Attribute' => 'Shortcuts' ], ], ); my $role_params; sub import { my ($class, %args) = @_; $role_params = {}; do { $role_params->{$_} = delete $args{"-$_"} if exists $args{"-$_"} } for qw{ writer_prefix builder_prefix prefixes }; @_ = ($class, %args); goto &$import; } sub init_meta { my ($class_name, %args) = @_; my $params = delete $args{role_params} || $role_params || undef; undef $role_params; # Just in case we do ever start to get an $init_meta from ME $init_meta->($class_name, %args) if $init_meta; # make sure we have a metaclass instance kicking around my $for_class = $args{for_class}; die "Class $for_class has no metaclass!" unless Class::MOP::class_of($for_class); # If we're given parameters to pass on to construct a role with, we build # it out here rather than pass them on and allowing apply_metaroles() to # handle it, as there are Very Loud Warnings about how parameterized roles # are non-cacheable when generated on the fly. ### $params my $role = ($params && scalar keys %$params) ? MooseX::AttributeShortcuts::Trait::Attribute ->meta ->generate_role(parameters => $params) : 'MooseX::AttributeShortcuts::Trait::Attribute' ; Moose::Util::MetaRole::apply_metaroles( # TODO add attribute trait here to create builder method if found for => $for_class, class_metaroles => { attribute => [ $role ] }, role_metaroles => { applied_attribute => [ $role ] }, parameter_metaroles => { applied_attribute => [ $role ] }, parameterized_role_metaroles => { applied_attribute => [ $role ] }, ); return Class::MOP::class_of($for_class); } 1; __END__ =pod =encoding UTF-8 =for :stopwords Chris Weyl David Graham Knop Steinbrunner GitHub attribute's isa one's rwp SUBTYPING foo =for :stopwords Wishlist flattr flattr'ed gittip gittip'ed =head1 NAME MooseX::AttributeShortcuts - Shorthand for common attribute options =head1 VERSION This document describes version 0.028 of MooseX::AttributeShortcuts - released April 07, 2015 as part of MooseX-AttributeShortcuts. =head1 SYNOPSIS package Some::Class; use Moose; use MooseX::AttributeShortcuts; # same as: # is => 'ro', lazy => 1, builder => '_build_foo' has foo => (is => 'lazy'); # same as: is => 'ro', writer => '_set_foo' has foo => (is => 'rwp'); # same as: is => 'ro', builder => '_build_bar' has bar => (is => 'ro', builder => 1); # same as: is => 'ro', clearer => 'clear_bar' has bar => (is => 'ro', clearer => 1); # same as: is => 'ro', predicate => 'has_bar' has bar => (is => 'ro', predicate => 1); # works as you'd expect for "private": predicate => '_has_bar' has _bar => (is => 'ro', predicate => 1); # extending? Use the "Shortcuts" trait alias extends 'Some::OtherClass'; has '+bar' => (traits => [Shortcuts], builder => 1, ...); # or... package Some::Other::Class; use Moose; use MooseX::AttributeShortcuts -writer_prefix => '_'; # same as: is => 'ro', writer => '_foo' has foo => (is => 'rwp'); =head1 DESCRIPTION Ever find yourself repeatedly specifying writers and builders, because there's no good shortcut to specifying them? Sometimes you want an attribute to have a read-only public interface, but a private writer. And wouldn't it be easier to just say "builder => 1" and have the attribute construct the canonical "_build_$name" builder name for you? This package causes an attribute trait to be applied to all attributes defined to the using class. This trait extends the attribute option processing to handle the above variations. =for Pod::Coverage init_meta =head1 USAGE This package automatically applies an attribute metaclass trait. Unless you want to change the defaults, you can ignore the talk about "prefixes" below. =head1 EXTENDING A CLASS If you're extending a class and trying to extend its attributes as well, you'll find out that the trait is only applied to attributes defined locally in the class. This package exports a trait shortcut function "Shortcuts" that will help you apply this to the extended attribute: has '+something' => (traits => [Shortcuts], ...); =head1 PREFIXES We accept two parameters on the use of this module; they impact how builders and writers are named. =head2 -writer_prefix use MooseX::::AttributeShortcuts -writer_prefix => 'prefix'; The default writer prefix is '_set_'. If you'd prefer it to be something else (say, '_'), this is where you'd do that. =head2 -builder_prefix use MooseX::::AttributeShortcuts -builder_prefix => 'prefix'; The default builder prefix is '_build_', as this is what lazy_build does, and what people in general recognize as build methods. =head1 NEW ATTRIBUTE OPTIONS Unless specified here, all options defined by L and L remain unchanged. Want to see additional options? Ask, or better yet, fork on GitHub and send a pull request. If the shortcuts you're asking for already exist in L or L or elsewhere, please note that as it will carry significant weight. For the following, "$name" should be read as the attribute name; and the various prefixes should be read using the defaults. =head2 is => 'rwp' Specifying C 'rwp'> will cause the following options to be set: is => 'ro' writer => "_set_$name" =head2 is => 'lazy' Specifying C 'lazy'> will cause the following options to be set: is => 'ro' builder => "_build_$name" lazy => 1 B Since 0.009 we no longer set C undef> if no C is explicitly provided. This is a change made in parallel with L, based on a large number of people surprised that lazy also made one's C undefined. =head2 is => 'lazy', default => ... Specifying C 'lazy'> and a default will cause the following options to be set: is => 'ro' lazy => 1 default => ... # as provided That is, if you specify C 'lazy'> and also provide a C, then we won't try to set a builder, as well. =head2 builder => 1 Specifying C 1> will cause the following options to be set: builder => "_build_$name" =head2 builder => sub { ... } Passing a coderef to builder will cause that coderef to be installed in the class this attribute is associated with the name you'd expect, and C 1> to be set. e.g., in your class, has foo => (is => 'ro', builder => sub { 'bar!' }); ...is effectively the same as... has foo => (is => 'ro', builder => '_build_foo'); sub _build_foo { 'bar!' } =head2 clearer => 1 Specifying C 1> will cause the following options to be set: clearer => "clear_$name" or, if your attribute name begins with an underscore: clearer => "_clear$name" (that is, an attribute named "_foo" would get "_clear_foo") =head2 predicate => 1 Specifying C 1> will cause the following options to be set: predicate => "has_$name" or, if your attribute name begins with an underscore: predicate => "_has$name" (that is, an attribute named "_foo" would get "_has_foo") =head2 trigger => 1 Specifying C 1> will cause the attribute to be created with a trigger that calls a named method in the class with the options passed to the trigger. By default, the method name the trigger calls is the name of the attribute prefixed with "_trigger_". e.g., for an attribute named "foo" this would be equivalent to: trigger => sub { shift->_trigger_foo(@_) } For an attribute named "_foo": trigger => sub { shift->_trigger__foo(@_) } This naming scheme, in which the trigger is always private, is the same as the builder naming scheme (just with a different prefix). =head2 handles => { foo => sub { ... }, ... } Creating a delegation with a coderef will now create a new, "custom accessor" for the attribute. These coderefs will be installed and called as methods on the associated class (just as readers, writers, and other accessors are), and will have the attribute metaclass available in $_. Anything the accessor is called with it will have access to in @_, just as you'd expect of a method. e.g., the following example creates an attribute named 'bar' with a standard reader accessor named 'bar' and two custom accessors named 'foo' and 'foo_too'. has bar => ( is => 'ro', isa => 'Int', handles => { foo => sub { my $self = shift @_; return $_->get_value($self) + 1; }, foo_too => sub { my $self = shift @_; return $self->bar + 1; }, }, ); ...and later, Note that in this example both foo() and foo_too() do effectively the same thing: return the attribute's current value plus 1. However, foo() accesses the attribute value directly through the metaclass, the pros and cons of which this author leaves as an exercise for the reader to determine. You may choose to use the installed accessors to get at the attribute's value, or use the direct metaclass access, your choice. =head1 ANONYMOUS SUBTYPING AND COERCION "Abusus non tollit usum." Note that we create new, anonymous subtypes whenever the constraint or coercion options are specified in such a way that the Shortcuts trait (this one) is invoked. It's fully supported to use both constraint and coerce options at the same time. This facility is intended to assist with the creation of one-off type constraints and coercions. It is not possible to deliberately reuse the subtypes we create, and if you find yourself using a particular isa / constraint / coerce option triplet in more than one place you should really think about creating a type that you can reuse. L provides the facilities to easily do this, or even a simple L definition at the package level with an anonymous type stashed away for local use. =head2 isa => sub { ... } has foo => ( is => 'rw', # $_ == $_[0] == the value to be validated isa => sub { die unless $_[0] == 1 }, ); # passes constraint $thing->foo(1); # fails constraint $thing->foo(5); Given a coderef, create a type constraint for the attribute. This constraint will fail if the coderef dies, and pass otherwise. Astute users will note that this is the same way L constraints work; we use L to implement the constraint. =head2 isa_instance_of => ... Given a package name, this option will create an C type constraint that requires the value of the attribute be an instance of the class (or a descendant class) given. That is, has foo => (is => 'ro', isa_instance_of => 'SomeThing'); ...is effectively the same as: use Moose::TypeConstraints 'class_type'; has foo => ( is => 'ro', isa => class_type('SomeThing'), ); ...but a touch less awkward. =head2 isa => ..., constraint => sub { ... } Specifying the constraint option with a coderef will cause a new subtype constraint to be created, with the parent type being the type specified in the C option and the constraint being the coderef supplied here. For example, only integers greater than 10 will pass this attribute's type constraint: # value must be an integer greater than 10 to pass the constraint has thinger => ( isa => 'Int', constraint => sub { $_ > 10 }, # ... ); Note that if you supply a constraint, you must also provide an C. =head2 isa => ..., constraint => sub { ... }, coerce => 1 Supplying a constraint and asking for coercion will "Just Work", that is, any coercions that the C type has will still work. For example, let's say that you're using the C type constraint from L, and you want an additional constraint that the file must exist: has thinger => ( is => 'ro', isa => File, constraint => sub { !! $_->stat }, coerce => 1, ); C will correctly coerce the string "/etc/passwd" to a C, and will only accept the coerced result as a value if the file exists. =head2 coerce => [ Type => sub { ...coerce... }, ... ] Specifying the coerce option with a hashref will cause a new subtype to be created and used (just as with the constraint option, above), with the specified coercions added to the list. In the passed hashref, the keys are Moose types (well, strings resolvable to Moose types), and the values are coderefs that will coerce a given type to our type. has bar => ( is => 'ro', isa => 'Str', coerce => [ Int => sub { "$_" }, Object => sub { 'An instance of ' . ref $_ }, ], ); =head1 SEE ALSO Please see those modules/websites for more information related to this module. =over 4 =item * L =back =head1 SOURCE The development version is on github at L and may be cloned from L =head1 BUGS Please report any bugs or feature requests on the bugtracker website https://github.com/RsrchBoy/moosex-attributeshortcuts/issues When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =head1 AUTHOR Chris Weyl =head2 I'm a material boy in a material world =begin html =end html Please note B, rather B. I largely create and release works like this because I need them or I find it enjoyable; however, don't let that stop you if you feel like it ;) L, L, or indulge my L... If you so desire. =head1 CONTRIBUTORS =for stopwords David Steinbrunner Graham Knop =over 4 =item * David Steinbrunner =item * Graham Knop =back =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2011 by Chris Weyl. This is free software, licensed under: The GNU Lesser General Public License, Version 2.1, February 1999 =cut