Skip to content

Commit

Permalink
Bumped version; updated perldoc
Browse files Browse the repository at this point in the history
Non-TRIAL release of fixes from 0.000005
  • Loading branch information
Chris White committed Mar 26, 2019
1 parent 4d06745 commit a6e098a
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 62 deletions.
8 changes: 7 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -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

Expand Down
46 changes: 24 additions & 22 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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, "<cxwembedded at gmail.com>". Thanks to Toby Inkster
for code contributions.
AUTHORS
Created by Christopher White, "<cxwembedded at gmail.com>". 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>. I
will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
interface at
<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.

SUPPORT
You can find documentation for this module with the perldoc command.
Expand All @@ -87,11 +94,6 @@ SUPPORT

<https://github.com/cxw42/Class-Tiny-ConstrainedAccessor>

* RT: CPAN's request tracker

<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-Tiny-ConstrainedAcces
sor>

* Search CPAN

<https://metacpan.org/release/Class-Tiny-ConstrainedAccessor>
Expand Down
38 changes: 20 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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, `<cxwembedded at gmail.com>`. Thanks to
Created by Christopher White, `<cxwembedded at gmail.com>`. 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.

Expand All @@ -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)
Expand Down
43 changes: 22 additions & 21 deletions lib/Class/Tiny/ConstrainedAccessor.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use strict;
use warnings;
use Class::Tiny;

our $VERSION = '0.000005'; # TRIAL
our $VERSION = '0.000006';

# Docs {{{1

Expand Down Expand Up @@ -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<BUILD()|Class::Tiny/BUILD> subroutine to check the
constructor parameters, if a C<BUILD()> doesn't already exist.
This also creates a L<Class::Tiny/BUILD> 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<BUILD>.
If a C<BUILD()> does exist (e.g., you said C<use subs 'BUILD';>), this package
will create the same function, taking the same parameters as C<BUILD()> would,
but call it C<_check_all_constraints()>. You can call this checker from your
own C<BUILD()> if you want to.
=head1 OPTIONS
Remember, options are carried in an B<arrayref>. This is to leave room
for someday carrying attributes and constraints in a hashref.
To specify options, pass an B<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:
=over
Expand All @@ -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
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -228,15 +233,15 @@ sub _make_build {
# Rest of the docs {{{1
__END__
=head1 AUTHOR
=head1 AUTHORS
Christopher White, C<< <cxwembedded at gmail.com> >>. Thanks to
Created by Christopher White, C<< <cxwembedded at gmail.com> >>. Thanks to
Toby Inkster for code contributions.
=head1 BUGS
Please report any bugs or feature requests through the GitHub Issues interface
at L<https://github.com/cxw42/Class-Tiny-ConstrainedAccessor>. I will be
at L<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.
Expand All @@ -254,10 +259,6 @@ You can also look for information at:
L<https://github.com/cxw42/Class-Tiny-ConstrainedAccessor>
=item * RT: CPAN's request tracker
L<https://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-Tiny-ConstrainedAccessor>
=item * Search CPAN
L<https://metacpan.org/release/Class-Tiny-ConstrainedAccessor>
Expand Down

0 comments on commit a6e098a

Please sign in to comment.