The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Raisin::Attributes - Simple attributes accessors for Raisin.

SYNOPSIS

    use Raisin::Attributes;

    has hello => sub { 'hello' };
    say $self->hello; # -> hello

    has 'new';
    say $self->new; # -> undef

    has key => 'value';
    say $self->key; # -> value

DESCRIPTION

Simple implementation of attribute accessors.

METHODS

has

This code:

    has key => 'value';

Will produce:

    sub key {
        my ($self, $value) = @_;
        $self->{key} = $value if defined $value;
        return $self->{key} // 'value';
    }