NAME

Do

ABSTRACT

Modern Perl

SYNOPSIS

package User;

use Do 'Class';

has 'fname';
has 'lname';

method greet(Str $name) {
  my $fname = $self->fname;
  my $lname = $self->lname;

  "Hey $name, I'm $fname $lname";
}

package main;

my $user = User->new(fname => 'Al', lname => 'Newkirk');

say $user->greet('You');

1;

DESCRIPTION

This package aims to provide a modern Perl development framework and foundational set of types, functions, classes, patterns, and interfaces for jump-starting application development. This package inherits all behavior from Data::Object.

FRAMEWORK

Do (aka Data-Object) is a robust modern Perl development framework, embracing Perl's multi-paradigm programming nature, flexibility and vast ecosystem that many engineers already know and love.

FRAMEWORK CORE

package main;

use Do;

fun main() {
  # ...
}

1;

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

FRAMEWORK LIBRARY

package App::Library;

use Do 'Library';

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

1;

The framework's 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.

FRAMEWORK CLASS

package App::User;

use Do 'Class';

has 'fname';
has 'lname';

1;

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

FRAMEWORK ROLE

package App::Queuer;

use Do 'Role';

has 'queue';

method dequeue() {
  # ...
}

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

1;

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

FRAMEWORK RULE

package App::Queueable;

use Do 'Rule';

requires 'dequeue';
requires 'enqueue';

1;

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

FRAMEWORK STATE

package App::Env;

use Do 'State';

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

1;

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

FRAMEWORK STRUCT

package App::Data;

use Do 'Struct';

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

1;

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

FRAMEWORK ARRAY

package App::Args;

use Do 'Array';

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

1;

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

FRAMEWORK CODE

package App::Func;

use Do 'Code';

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

  # ...
}

1;

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

FRAMEWORK FLOAT

package App::Amount;

use Do 'Float';

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

1;

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

FRAMEWORK HASH

package App::Data;

use Do 'Hash';

method logline() {
  # ...
}

1;

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

FRAMEWORK INTEGER

package App::Phone;

use Do 'Integer';

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

1;

The framework's integer configuration configures the calling package as a class which extends the Integer class. Read more at Data::Object::Integer.

FRAMEWORK NUMBER

package App::ID;

use Do 'Number';

method find() {
  # ...
}

1;

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

FRAMEWORK REGEXP

package App::Path;

use Do 'Regexp';

method match() {
  # ...
}

1;

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

FRAMEWORK SCALAR

package App::OID;

use Do 'Scalar';

method find() {
  # ...
}

1;

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

FRAMEWORK STRING

package App::Title;

use Do 'String';

method generate() {
  # ...
}

1;

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

FRAMEWORK UNDEF

package App::Fail;

use Do 'Undef';

method explain() {
  # ...
}

1;

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

INSTALLATION

If you have cpanm, you only need one line:

$ cpanm -qn Do

If you don't have cpanm, get it! It takes less than a minute, otherwise:

$ curl -L https://cpanmin.us | perl - -qn Do

Add Do to the list of dependencies in cpanfile:

requires "Do" => "1.05"; # 1.05 or newer

If cpanm doesn't have permission to install modules in the current Perl installation, it will automatically set up and install to a local::lib in your home directory. See the local::lib documentation for details on enabling it in your environment. We recommend using a Perlbrew or Plenv environment. These tools will help you manage multiple Perl installations in your $HOME directory. They are completely isolated Perl installations.

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 same terms as the Perl 5 programming language system itself.

PROJECT

On GitHub

Initiatives

Contributing

Reporting

SEE ALSO

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

Data::Object::Class

Data::Object::Role

Data::Object::Rule

Data::Object::Library

Data::Object::Signatures