brian greenfield > MooseX-PrivateSetters > MooseX::PrivateSetters::Role::Attribute

Download:
MooseX-PrivateSetters-0.08.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.08   Source  

NAME ^

MooseX::PrivateSetters::Role::Attribute - Names setters as such, and makes them private

SYNOPSIS ^

    Moose::Exporter->setup_import_methods(
        class_metaroles => {
            attribute => ['MooseX::PrivateSetters::Role::Attribute'],
        },
    );

DESCRIPTION ^

This role applies a method modifier to the _process_options() method, and tweaks the writer parameters so that they are private with an explicit '_set_attr' method. Getters are left unchanged. This role copes with attributes intended to be private (ie, starts with an underscore), with no double-underscore in the setter.

For example:

    | Code                      | Reader | Writer      |
    |---------------------------+--------+-------------|
    | has 'baz'  => (is 'rw');  | baz()  | _set_baz()  |
    | has 'baz'  => (is 'ro');  | baz()  |             |
    | has '_baz' => (is 'rw');  | _baz() | _set_baz()  |
    | has '__baz' => (is 'rw'); | _baz() | _set__baz() |

You probably don't want to use this module. You probably should be looking at MooseX::PrivateSetters instead.

AUTHOR ^

brian greenfield <briang@cpan.org>

COPYRIGHT & LICENSE ^

Copyright 2010 brian greenfield

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: