++ed by:
1 non-PAUSE user
Author image Edward J. Allen III

NAME

MooseX::EasyAcc - Name your accessors foo(), set_foo(), and has_foo()

VERSION

  This document describes v0.001 of MooseX::EasyAcc - released June 13, 2011 as part of MooseX-EasyAcc.

SYNOPSIS

    package MyApp;
    use Moose;
    use MooseX::EasyAcc;

    has 'name' => (
        is => 'rw',
        isa => 'Str'
    );
    # This creates methods: name, set_name, has_name

    has 'supernumber' => (
        is => 'ro',
        isa => 'Int',
    );
    # This creates methods: supernumber, _set_supernumber, has_supernumber

    has '_superhero_name' => (
        is => 'ro',
        isa => 'Str'
    );
    # This creates methods: _superhero_name, _set__superhero_name, _has__superhero_name

    has 'superpower' => (
        is => 'ro',
        isa => 'Str',
        predicate => 'is_awesome',
    );
    # This creates methods: superpower, _set_supernumber, is_awesome
   
    has 'nemisis' => (
        is => 'rw',
        isa => 'MyApp',
        predicate => 'is_loved',
        reader => 'best_friend',
    );
    # This creates methods: best_friend , set_nemisis, is_loved
    # and so on....

DESCRIPTION

Like MooseX::FollowPBP, or MooseX::SemiAffordanceAccessor this changes the naming convention for accessors.

Attributes are created using SemiAffordance style (attr, set_attr) with the addition of a predicate (prefixed with 'has_'). Unlike MooseX::SemiAffordanceAccessor, setting 'ro' does not prevent the creation of a writer, only makes it private (by prepending a '_'). Also, explicitly setting an accessor only overwrites this accessor, doesn't cancel the whole scheme.

In the case of an attribute starting with underscore, '_set_' and '_has_' prefix is used.

NOTE ON USAGE IN ROLES

Applying this module to a class will not affect the default attribute traits of roles assigned to the class.

Applying this module to a role will affect all attributes in that role, but not classes that it is applied to.

ACKNOWLEDGMENTS

Much of this is based on reviewing Dave Rolsky's MooseX::FollowPBP, Copyright (c) 2011 by Dave Rolsky and is available wherever fine Perl modules are distributed.

SEE ALSO

Please see those modules/websites for more information related to this module.

SUPPORT

Websites

The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.

Email

You can email the author of this module at EALLENIII at cpan.org asking for help with any problems you have.

Bugs / Feature Requests

Please report any bugs or feature requests by email to bug-moosex-easyacc at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooseX-EasyAcc. You will be automatically notified of any progress on the request by the system.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

http://github.com/riemann42/moosex-easyacc

  git clone git://github.com/riemann42/moosex-easyacc.git

AUTHOR

Edward Allen <ealleniii@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2011 by Edward J. Allen III.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "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 SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

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 SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (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 SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.