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::Config

ABSTRACT

Data-Object Package Configuration

SYNOPSIS

use Data::Object::Config 'Core';

DESCRIPTION

This package is used to configure the consuming package based on arguments passed to the import statement.

CONFIGURATIONS

This package is used by both Do and Data::Object to configure the calling namespace.

core

package main;

use Data::Object::Config 'Core';

fun main() {
  # ...
}

1;

The core configuration enables strict, warnings, Perl's 5.14 features, and configures the core type library, method signatures, and autoboxing.

library

package App::Library;

use Data::Object::Config 'Library';

our $User = declare 'User',
  as InstanceOf["App::User"];

1;

The library configuration established a Type::Library compliant type library, as well as configuring Type::Utils in the calling package. Read more at Data::Object::Library.

class

package App::User;

use Data::Object::Config 'Class';

has 'fname';
has 'lname';

1;

The class configuration configures the calling package as a Moo class, having the "has", "with", and "extends" keywords available. Read more at Data::Object::Class.

role

package App::Queuer;

use Data::Object::Config 'Role';

has 'queue';

method dequeue() {
  # ...
}

method enqueue($job) {
  # ...
}

1;

The role configuration configures the calling package as a Moo role, having the "has", "with", and "extends" keywords available. Read more at Data::Object::Role.

rule

package App::Queueable;

use Data::Object::Config 'Rule';

requires 'dequeue';
requires 'enqueue';

1;

The rule configuration configures the calling package as a Moo role, intended to be used to classify interfaces. Read more at Data::Object::Rule.

state

package App::Env;

use Data::Object::Config 'State';

has 'vars';
has 'args';
has 'opts';

1;

The state configuration configures the calling package as a singleton class with global state. Read more at Data::Object::State.

struct

package App::Data;

use Data::Object::Config 'Struct';

has 'auth';
has 'user';
has 'args';

1;

The struct configuration configures the calling package as a class whose state becomes immutable after instantiation. Read more at Data::Object::Struct.

args

package App::Args;

use Data::Object::Config 'Args';

method validate() {
  # ...
}

1;

The args configuration configures the calling package as a class representation of the @ARGV variable. Read more at Data::Object::Args.

array

package App::Args;

use Data::Object::Config 'Array';

method command() {
  return $self->get(0);
}

1;

The array configuration configures the calling package as a class which extends the Array class. Read more at Data::Object::Array.

code

package App::Func;

use Data::Object::Config 'Code';

around BUILD($args) {
  $self->$orig($args);

  # ...
}

1;

The code configuration configures the calling package as a class which extends the Code class. Read more at Data::Object::Code.

cli

package App::Cli;

use Data::Object::Config 'Cli';

method main(%args) {
  # ...
}

1;

The cli configuration configures the calling package as a class capable of acting as a command-line interface. Read more at Data::Object::Cli.

data

package App::Data;

use Data::Object::Config 'Data';

method generate() {
  # ...
}

1;

The data configuration configures the calling package as a class capable of parsing POD. Read more at Data::Object::Data.

float

package App::Amount;

use Data::Object::Config 'Float';

method currency(Str $code) {
  # ...
}

1;

The float configuration configures the calling package as a class which extends the Float class. Read more at Data::Object::Float.

hash

package App::Data;

use Data::Object::Config 'Hash';

method logline() {
  # ...
}

1;

The hash configuration configures the calling package as a class which extends the Hash class. Read more at Data::Object::Hash.

number

package App::ID;

use Data::Object::Config 'Number';

method find() {
  # ...
}

1;

The number configuration configures the calling package as a class which extends the Number class. Read more at Data::Object::Number.

opts

package App::Opts;

use Data::Object::Config 'Opts';

method validate() {
  # ...
}

1;

The opts configuration configures the calling package as a class representation of the command-line arguments. Read more at Data::Object::Opts.

regexp

package App::Path;

use Data::Object::Config 'Regexp';

method match() {
  # ...
}

1;

The regexp configuration configures the calling package as a class which extends the Regexp class. Read more at Data::Object::Regexp.

scalar

package App::OID;

use Data::Object::Config 'Scalar';

method find() {
  # ...
}

1;

The scalar configuration configures the calling package as a class which extends the Scalar class. Read more at Data::Object::Scalar.

string

package App::Title;

use Data::Object::Config 'String';

method generate() {
  # ...
}

1;

The string configuration configures the calling package as a class which extends the String class. Read more at Data::Object::String.

undef

package App::Fail;

use Data::Object::Config 'Undef';

method explain() {
  # ...
}

1;

The undef configuration configures the calling package as a class which extends the Undef class. Read more at Data::Object::Undef.

vars

package App::Vars;

use Data::Object::Config 'Vars';

method config() {
  # ...
}

1;

The vars configuration configures the calling package as a class representation of the %ENV variable. Read more at Data::Object::Vars.

with

package App::Error;

use Data::Object::Config 'Class';
use Data::Object::Config 'WithStashable';

# e.g.
# use Data::Object::Config 'WithDumpable';
# use Data::Object::Config 'WithImmutable
# use Data::Object::Config 'WithProxyable
# use Data::Object::Config 'WithStashable
# use Data::Object::Config 'WithThrowable
# use Data::Object::Config 'WithTryable

1;

The with configuration configures the calling package to consume the core role denoted in the name, e.g. the name WithStashable configures the package to consume the core role Data::Object::Role::Stashable. Using roles requires that the package have previously been declared a class or role itself. This pattern for including core roles works with any core role and can be used by simplyt prefixing the role name with the term With (with no spaces).

LIBRARIES

This package uses type constraints defined by:

Data::Object::Library

FUNCTIONS

This package implements the following functions.

choose

choose(Str $arg1) : ArrayRef

The choose function returns the configuration (plans) based on the argument passed.

choose example
choose('class');

config

config(ArrayRef $arg1) : ArrayRef

The config function returns plans for configuring a package with the standard Data::Object setup.

config example
my $plans = config;

config_args

config_args() : ArrayRef

The config_args function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Args.

config_args example
my $plans = config_args;

config_array

config_array() : ArrayRef

The config_array function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Array.

config_array example
my $plans = config_array;

config_base

config_base() : ArrayRef

The config_base function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Base.

config_base example
my $plans = config_base;

config_class

config_class() : ArrayRef

The config_class function returns plans for configuring the package to be a Data::Object::Class.

config_class example
my $plans = config_class;

config_cli

config_cli() : ArrayRef

The config_cli function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Cli.

config_cli example
my $plans = config_cli;

config_code

config_code() : ArrayRef

The config_code function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Code.

config_code example
my $plans = config_code;

config_core

config_core() : ArrayRef

The config_core function returns plans for configuring the package to have the Data::Object framework default configuration.

config_core example
my $plans = config_core;

config_data

config_data() : ArrayRef

The config_data function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Data.

config_data example
my $plans = config_data;

config_dispatch

config_dispatch() : ArrayRef

The config_dispatch function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Dispatch.

config_dispatch example
my $plans = config_dispatch;

config_exception

config_exception() : ArrayRef

The config_exception function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Exception.

config_exception example
my $plans = config_exception;

config_float

config_float() : ArrayRef

The config_float function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Float.

config_float example
my $plans = config_float;

config_hash

config_hash() : ArrayRef

The config_hash function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Hash.

config_hash example
my $plans = config_hash;

config_library

config_library() : ArrayRef

The config_library function returns plans for configuring the package to be a Type::Library which extends Data::Object::Library with Type::Utils configured.

config_library example
my $plans = config_library;

config_number

config_number() : ArrayRef

The config_number function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Number.

config_number example
my $plans = config_number;

config_opts

config_opts() : ArrayRef

The config_opts function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Opts.

config_opts example
my $plans = config_opts;

config_regexp

config_regexp() : ArrayRef

The config_regexp function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Regexp.

config_regexp example
my $plans = config_regexp;

config_replace

config_replace() : ArrayRef

The config_replace function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Replace.

config_replace example
my $plans = config_replace;

config_role

config_role() : ArrayRef

The config_role function returns plans for configuring the package to be a Data::Object::Role.

config_role example
my $plans = config_role;

config_rule

config_rule() : ArrayRef

The config_rule function returns plans for configuring a package to be a Data::Object::Rule.

config_rule example
my $plans = config_rule;

config_scalar

config_scalar() : ArrayRef

The config_scalar function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Scalar.

config_scalar example
my $plans = config_scalar;
config_search() : ArrayRef

The config_search function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Search.

config_search example
my $plans = config_search;

config_space

config_space() : ArrayRef

The config_space function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Space.

config_space example
my $plans = config_space;

config_state

config_state() : ArrayRef

The config_state function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::State.

config_state example
my $plans = config_state;

config_string

config_string() : ArrayRef

The config_string function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::String.

config_string example
my $plans = config_string;

config_struct

config_struct() : ArrayRef

The config_struct function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Struct.

config_struct example
my $plans = config_struct;

config_type

config_type() : ArrayRef

The config_type function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Type.

config_type example
my $plans = config_type;

config_undef

config_undef() : ArrayRef

The config_undef function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Undef.

config_undef example
my $plans = config_undef;

config_vars

config_vars() : ArrayRef

The config_vars function returns plans for configuring the package to be a Data::Object::Class which extends Data::Object::Vars.

config_vars example
my $plans = config_vars;

config_withdumpable

config_withdumpable() : ArrayRef

The config_withdumpable function returns plans for configuring the package to consume the Data::Object::Role::Dumbable role.

config_withdumpable example
my $plans = config_withdumpable;

config_withimmutable

config_withimmutable() : ArrayRef

The config_withimmutable function returns plans for configuring the package to consume the Data::Object::Role::Immutable role.

config_withimmutable example
my $plans = config_withimmutable;

config_withproxyable

config_withproxyable() : ArrayRef

The config_withproxyable function returns plans for configuring the package to consume the Data::Object::Role::Proxyable role.

config_withproxyable example
my $plans = config_withproxyable;

config_withstashable

config_withstashable() : ArrayRef

The config_withstashable function returns plans for configuring the package to consume the Data::Object::Role::Stashable role.

config_withstashable example
my $plans = config_withstashable;

config_withthrowable

config_withthrowable() : ArrayRef

The config_withthrowable function returns plans for configuring the package to consume the Data::Object::Role::Throwable role.

config_withthrowable example
my $plans = config_withthrowable;

config_withtryable

config_withtryable() : ArrayRef

The config_withtryable function returns plans for configuring the package to consume the Data::Object::Role::Tryable role.

config_withtryable example
my $plans = config_withtryable;

prepare

prepare(Str $arg1, Str $arg2) : ArrayRef

The prepare function returns configuration plans based on the arguments passed.

prepare example
prepare($package, $type);

prepare_add

prepare_add(Str $arg1, Str $arg2) : ArrayRef

The prepare_add function returns an add-plan for the arguments passed.

prepare_add example
prepare_add($package, $function);

prepare_call

prepare_call(Str $arg1, Any @args) : ArrayRef

The prepare_call function returns a call-plan for the arguments passed.

prepare_call example
prepare_call($function, @args);

prepare_let

prepare_let(Str $arg1, Any @args) : ArrayRef

The prepare_let function returns a let-plan for the arguments passed.

prepare_let example
prepare_let($package, @args);

prepare_use

prepare_use(Str $arg1, Any @args) : ArrayRef

The prepare_use function returns a use-plan for the arguments passed.

prepare_use example
prepare_use($package, @args);

process

process(Str $arg1, ArrayRef $arg2) : Any

The process function executes a series of plans on behalf of the caller.

process example
process($caller, $plans);

process_add

process_add(Str $arg1, ArrayRef $arg2) : Any

The process_add function executes the add-plan on behalf of the caller.

process_add example
process_add($caller, $plan);

process_call

process_call(Str $arg1, ArrayRef $arg2) : Any

The process_call function executes the call-plan on behalf of the caller.

process_call example
process_call($caller, $plan);

process_let

process_let(Str $arg1, ArrayRef $arg2) : Any

The process_let function executes the let-plan on behalf of the caller.

process_let example
process_let($caller, $plan);

process_use

process_use(Str $arg1, ArrayRef $arg2) : Any

The process_use function executes the use-plan on behalf of the caller.

process_use example
process_use($caller, $plan);

subject

subject(Str $arg1, Str $arg2) : Int

The subject function returns truthy if both arguments match alphanumerically (not case-sensitive).

subject example
subject('Role', 'Role');

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