The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MooseX::AttributeDocumented::Meta::Attribute::Trait::Documented - Add documentation to attributes

VERSION

Version 0.1004, released 2019-01-30.

SYNOPSIS

use Moose;

has gears => (
    is => 'ro',
    isa => 'Int',
    default => 21,
    traits => ['Documented'],
    documentation => 'Number of gears on the bike',
    documentation_order => 2,
);
has has_brakes => (
    is => 'ro',
    isa => 'Bool',
    default => 1,
    traits => ['Documented'],
    documentation => 'Does the bike have brakes?',
    documentation_alts => {
        0 => 'Hopefully a track bike',
        1 => 'Always nice to have',
    },
);
has undocumented_attr => (
    is => 'ro',
    isa => Str,
    default => 'other',
);

DESCRIPTION

Moose already has documentation, this trait adds the following to the attribute specification:

documentation_alts

A hash reference. Describe the effect of different values, eg. on booleans.

documentation_default

A string. If the default value is a code ref you can describe it in this field.

documentation_order

An integer. Defaults to 1000.

SOURCE

https://github.com/Csson/p5-MooseX-AttributeDocumented

HOMEPAGE

https://metacpan.org/release/MooseX-AttributeDocumented

AUTHOR

Erik Carlsson <info@code301.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Erik Carlsson.

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