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

MooX::Keyword::Field - field attributes that cannot be set via the constructor

VERSION

Version 0.03

SYNOPSIS

Quick summary of what the module does.

Perhaps a little code snippet.

        package Persona;

        use Moo;
        use MooX::Keyword extends => '+Field', param => {
                builder => sub {
                        shift->has(shift, is => 'rw', @_);
                }
        };

        param "name";
        param "title"

        field created => ( # by default ro
                builder => sub {
                        time;
                }
        );

        ...

        my $persona = Persona->new({
                name => $name,
                title => $title,
                created => $sometime # won't get set here
        });

        $persona->created;

DESCRIPTION

This module simply adds a field keyword which effectively only creates a read only attribute.

KEYWORDS

field

Creates a read only attribute.

        field created => (
                builder => sub {
                        time;
                }
        );

The behaviour is identical to the following Moo code.

        has created => (
                is => 'ro',
                builder => sub {
                        time;
                }
        );

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-moox-keyword-field at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooX-Keyword-Field. 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.

        perldoc MooX::Keyword::Field

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2022 by LNATION.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)