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

App::Dochazka::Model - functions shared by several modules within the data model

VERSION

Version 0.181

SYNOPSIS

Shared data model functions. All three functions are designed to be used together as follows:

    package My::Package;

    use Params::Validate qw( :all );

    BEGIN {
        no strict 'refs';
        *{"spawn"} = App::Dochazka::Model::make_spawn;
        *{"reset"} = App::Dochazka::Model::make_reset(
            'attr1', 'attr2',
        );
        *{"attr1"} = App::Dochazka::Model::make_accessor( 'attr1' );
        *{"attr2"} = App::Dochazka::Model::make_accessor( 'attr2', HASHREF );
    }

What this does:

  • create a spawn class method in your class

  • create a reset instance method in your class

  • create a attr1 accessor method in your class (type defaults to SCALAR)

  • create a attr2 accessor method in your class (type HASHREF)

FUNCTIONS

make_spawn

Returns a ready-made 'spawn' method for your class/package/module.

make_filter

Given a list of attributes, returns a ready-made 'filter' routine which takes a PROPLIST and returns a new PROPLIST from which all bogus properties have been removed.

make_reset

Given a list of attributes, returns a ready-made 'reset' method.

make_accessor

Returns a ready-made accessor.

make_TO_JSON

Returns a ready-made TO_JSON

make_compare

Returns a ready-made 'compare' method that can be used to determine if two objects are the same.

make_clone

Returns a ready-made 'clone' method.

AUTHOR

Nathan Cutler, <presnypreklad@gmail.com>