From a6e098a921c025d9492f9cc849b34ab13e6f4226 Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 26 Mar 2019 13:29:04 -0400 Subject: [PATCH] Bumped version; updated perldoc Non-TRIAL release of fixes from 0.000005 --- Changes | 8 ++++- README | 46 ++++++++++++++------------- README.md | 38 +++++++++++----------- lib/Class/Tiny/ConstrainedAccessor.pm | 43 +++++++++++++------------ 4 files changed, 73 insertions(+), 62 deletions(-) diff --git a/Changes b/Changes index c988795..7ecceca 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,12 @@ Revision history for Class-Tiny-ConstrainedAccessor -0.000005 2019-03-24 TRIAL +0.000006 2019-03-26 + - No changes from 0.000005 trial release. + - Compared to v0.000003, the package now checks constructor + parameters and passes tests on all supported Perl versions. + +0.000005 2019-03-24 + - Trial release - See changes for v0.000004, including checking constructor parameters. - Fix tests to run on <5.010 diff --git a/README b/README index 6ed6b5b..3774fd1 100644 --- a/README +++ b/README @@ -37,24 +37,29 @@ NAME SUBROUTINES import - Creates the accessors you have requested. Usage: + Creates the accessors you have requested. Basic usage: use Class::Tiny::ConstrainedAccessor - [optional arrayref of option=>value], name => constraint - [, name => constraint]... ; + [, name => constraint ...]; # ... any number of name=>constraint pairs - The options use an arrayref to make them stand out against the - "name=>constraint" pairs that come after. + This also creates a BUILD() subroutine to check the constructor + parameters, if a "BUILD()" doesn't already exist. - This also creates a "BUILD" in Class::Tiny to check the constructor - parameters if one doesn't exist. If one does exist, it creates the same - function as "_check_all_constraints" so that you can call it from your own - BUILD. It takes the same parameters as "BUILD". + If a "BUILD()" does exist (e.g., you said "use subs 'BUILD';"), this + package will create the same function, taking the same parameters as + "BUILD()" would, but call it "_check_all_constraints()". You can call + this checker from your own "BUILD()" if you want to. OPTIONS - Remember, options are carried in an arrayref. This is to leave room for - someday carrying attributes and constraints in a hashref. + To specify options, pass an arrayref as the first argument on the `use` + line. This is to leave room for someday carrying attributes and + constraints in a hashref. For example: + + use Class::Tiny::ConstrainedAccessor [ OPTION=>value ], + name => constraint ...; + + Valid options are: NOBUILD If "NOBUILD => 1" is given, the constructor-parameter-checker is @@ -65,16 +70,18 @@ OPTIONS use Class::Tiny::ConstrainedAccessor [NOBUILD => 1], foo => SomeConstraint; + # Now $object->_check_all_constraints($args) exists, but not BUILD(). -AUTHOR - Christopher White, "". Thanks to Toby Inkster - for code contributions. +AUTHORS + Created by Christopher White, "". Thanks to + Toby Inkster for code contributions. BUGS Please report any bugs or feature requests through the GitHub Issues - interface at . I - will be notified, and then you'll automatically be notified of progress on - your bug as I make changes. + interface at + . I will + be notified, and then you'll automatically be notified of progress on your + bug as I make changes. SUPPORT You can find documentation for this module with the perldoc command. @@ -87,11 +94,6 @@ SUPPORT - * RT: CPAN's request tracker - - - * Search CPAN diff --git a/README.md b/README.md index b81c1f0..52dc376 100644 --- a/README.md +++ b/README.md @@ -41,25 +41,30 @@ Example of a class using this package: ## import -Creates the accessors you have requested. Usage: +Creates the accessors you have requested. Basic usage: use Class::Tiny::ConstrainedAccessor - [optional arrayref of option=>value], name => constraint - [, name => constraint]... ; + [, name => constraint ...]; # ... any number of name=>constraint pairs -The options use an arrayref to make them stand out against the -`name=>constraint` pairs that come after. +This also creates a [BUILD()](https://metacpan.org/pod/Class::Tiny#BUILD) subroutine to check the +constructor parameters, if a `BUILD()` doesn't already exist. -This also creates a ["BUILD" in Class::Tiny](https://metacpan.org/pod/Class::Tiny#BUILD) to check the constructor parameters if -one doesn't exist. If one does exist, it creates the same function as -`_check_all_constraints` so that you can call it from your own BUILD. It -takes the same parameters as `BUILD`. +If a `BUILD()` does exist (e.g., you said `use subs 'BUILD';`), this package +will create the same function, taking the same parameters as `BUILD()` would, +but call it `_check_all_constraints()`. You can call this checker from your +own `BUILD()` if you want to. # OPTIONS -Remember, options are carried in an **arrayref**. This is to leave room -for someday carrying attributes and constraints in a hashref. +To specify options, pass an **arrayref** as the first argument on the \`use\` +line. This is to leave room for someday carrying attributes and constraints in +a hashref. For example: + + use Class::Tiny::ConstrainedAccessor [ OPTION=>value ], + name => constraint ...; + +Valid options are: - NOBUILD @@ -71,16 +76,17 @@ for someday carrying attributes and constraints in a hashref. use Class::Tiny::ConstrainedAccessor [NOBUILD => 1], foo => SomeConstraint; + # Now $object->_check_all_constraints($args) exists, but not BUILD(). -# AUTHOR +# AUTHORS -Christopher White, ``. Thanks to +Created by Christopher White, ``. Thanks to Toby Inkster for code contributions. # BUGS Please report any bugs or feature requests through the GitHub Issues interface -at [https://github.com/cxw42/Class-Tiny-ConstrainedAccessor](https://github.com/cxw42/Class-Tiny-ConstrainedAccessor). I will be +at [https://github.com/cxw42/Class-Tiny-ConstrainedAccessor/issues](https://github.com/cxw42/Class-Tiny-ConstrainedAccessor/issues). I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. @@ -96,10 +102,6 @@ You can also look for information at: [https://github.com/cxw42/Class-Tiny-ConstrainedAccessor](https://github.com/cxw42/Class-Tiny-ConstrainedAccessor) -- RT: CPAN's request tracker - - [https://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-Tiny-ConstrainedAccessor](https://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-Tiny-ConstrainedAccessor) - - Search CPAN [https://metacpan.org/release/Class-Tiny-ConstrainedAccessor](https://metacpan.org/release/Class-Tiny-ConstrainedAccessor) diff --git a/lib/Class/Tiny/ConstrainedAccessor.pm b/lib/Class/Tiny/ConstrainedAccessor.pm index 48d5940..873eafd 100644 --- a/lib/Class/Tiny/ConstrainedAccessor.pm +++ b/lib/Class/Tiny/ConstrainedAccessor.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Class::Tiny; -our $VERSION = '0.000005'; # TRIAL +our $VERSION = '0.000006'; # Docs {{{1 @@ -52,25 +52,30 @@ Example of a class using this package: =head2 import -Creates the accessors you have requested. Usage: +Creates the accessors you have requested. Basic usage: use Class::Tiny::ConstrainedAccessor - [optional arrayref of option=>value], name => constraint - [, name => constraint]... ; + [, name => constraint ...]; # ... any number of name=>constraint pairs -The options use an arrayref to make them stand out against the -C<< name=>constraint >> pairs that come after. +This also creates a L subroutine to check the +constructor parameters, if a C doesn't already exist. -This also creates a L to check the constructor parameters if -one doesn't exist. If one does exist, it creates the same function as -C<_check_all_constraints> so that you can call it from your own BUILD. It -takes the same parameters as C. +If a C does exist (e.g., you said C), this package +will create the same function, taking the same parameters as C would, +but call it C<_check_all_constraints()>. You can call this checker from your +own C if you want to. =head1 OPTIONS -Remember, options are carried in an B. This is to leave room -for someday carrying attributes and constraints in a hashref. +To specify options, pass an B as the first argument on the `use` +line. This is to leave room for someday carrying attributes and constraints in +a hashref. For example: + + use Class::Tiny::ConstrainedAccessor [ OPTION=>value ], + name => constraint ...; + +Valid options are: =over @@ -84,7 +89,7 @@ exists or not. Example: use Class::Tiny::ConstrainedAccessor [NOBUILD => 1], foo => SomeConstraint; - + # Now $object->_check_all_constraints($args) exists, but not BUILD(). =back @@ -112,7 +117,7 @@ sub import { _get_constraint_sub($constraint); # dies on failure my $accessor = _make_accessor($k, $checker, $get_message); - $accessors{$k} = [$checker, $get_message]; + $accessors{$k} = [$checker, $get_message]; # Save for BUILD() { # Install the accessor no strict 'refs'; @@ -228,15 +233,15 @@ sub _make_build { # Rest of the docs {{{1 __END__ -=head1 AUTHOR +=head1 AUTHORS -Christopher White, C<< >>. Thanks to +Created by Christopher White, C<< >>. Thanks to Toby Inkster for code contributions. =head1 BUGS Please report any bugs or feature requests through the GitHub Issues interface -at L. I will be +at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. @@ -254,10 +259,6 @@ You can also look for information at: L -=item * RT: CPAN's request tracker - -L - =item * Search CPAN L