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

Data::Object::Rule

ABSTRACT

Data-Object Rule Declaration

SYNOPSIS

  package Persona;

  use Data::Object::Rule;

  requires 'id';
  requires 'fname';
  requires 'lname';
  requires 'created';
  requires 'updated';

  1;

DESCRIPTION

This package modifies the consuming package making it a role, and is used to allow you to specify rules for the consuming class. There is functionally no difference between a role and a rule, so this concept only exists to differentiate between that which describes an interface (rules) and that which mixes-in behaviors.

INHERITANCE

This package inherits behaviors from:

Moo::Role

LIBRARIES

This package uses type constraints defined by:

Data::Object::Library

KEYWORDS

This package provides the following keywords.

has

  package Person;

  use Data::Object 'Class';

  has fname => (
    is => 'ro',
    isa => 'Str'
  );

  has lname => (
    is => 'ro',
    isa => 'Str'
  );

  1;

The has keyword is used to declare class attributes, which can be accessed and assigned to using the built-in getter/setter or by the object constructor. See Moo for more information.

with

  package Person;

  use Data::Object 'Class';

  with 'Employable';

  1;

The with keyword is used to declare roles to be used and compose into your role. See Moo for more information.

CREDITS

Al Newkirk, +319

Anthony Brummett, +10

Adam Hopkins, +2

José Joaquín Atria, +1

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

Copyright (C) 2011-2019, Al Newkirk, et al.

This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated here, https://github.com/iamalnewkirk/do/blob/master/LICENSE.

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues

SEE ALSO

To get the most out of this distribution, consider reading the following:

Do

Data::Object

Data::Object::Class

Data::Object::ClassHas

Data::Object::Role

Data::Object::RoleHas

Data::Object::Library