NAME
    MooseX::AttributeShortcuts - Shorthand for common attribute options

VERSION
    version 0.004

SYNOPSIS
        package Some::Class;

        use Moose;
        use MooseX::AttributeShortcuts;

        # 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);

        # 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 specifing 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
    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.

    NOTE: If you're using 0.001, this is a change. Sorry about 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.

    For the following, "$name" should be read as the attribute name; and the
    various prefixes should be read using the defaults.

  is => 'rwp'
    Specifing is => 'rwp' will cause the following options to be set:

        is     => 'ro'
        writer => "_set_$name"

  is => 'lazy'
    Specifing is => 'lazy' will cause the following options to be set:

        is       => 'ro'
        builder  => "_build_$name"
        init_arg => undef
        lazy     => 1

  builder => 1
    Specifying builder => 1 will cause the following options to be set:

        builder => "_build_$name"

  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")

BUGS
    All complex software has bugs lurking in it, and this module is no
    exception.

    Please report any bugs to "bug-moosex-attributeshortcuts@rt.cpan.org",
    or through the web interface at <http://rt.cpan.org>.

AUTHOR
    Chris Weyl <cweyl@alumni.drew.edu>

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

