Linux SoftwareProgrammingLibrariesObject::Declare 0.13

Object::Declare 0.13


Object::Declare is a Perl module for declarative object constructor. SYNOPSIS use Object::Declare ['MyApp::Column', 'MyApp:
Developer:   Audrey Tang
      more software by author →
Price:  0.00
License:   Perl Artistic License
File size:   26K
Language:   
OS:   
Rating:   0 /5 (0 votes)
Your vote:  
enlarge screenshot


Object::Declare is a Perl module for declarative object constructor.

SYNOPSIS

use Object::Declare ['MyApp::Column', 'MyApp::Param'];

my %objects = declare {

param foo =>
!is global,
is immutable,
valid_values are qw( more values );

column bar =>
field1 is 'value',
field2 is 'some_other_value';

};

print $objects{foo}; # a MyApp::Param object
print $objects{bar}; # a MyApp::Column object

This module exports one function, declare, for building named objects with a declarative syntax, similar to how Jifty::DBI::Schema defines its columns.

In list context, declare returns a list of name/object pairs in the order of declaration (allowing duplicates), suitable for putting into a hash. In scalar context, declare returns a hash reference.
Using a flexible import interface, one can change exported helper functions names (declarator), words to link labels and values together (copula), and the table of named classes to declare (mapping):

use Object::Declare
declarator => ['declare'], # list of declarators
copula => { # list of words, or a map
is => '', # from copula to prefixes for
are => '', # labels built with that copula
}
aliases => { # list of label aliases:
more => 'less', # turns "is more" into "is less"
# and "more is 1" into "less is 1"
},
mapping => {
column => 'MyApp::Column', # class name to call ->new to
param => sub { # arbitrary coderef also works
bless(@_, 'MyApp::Param');
},
};

After the declarator block finishes execution, all helper functions are removed from the package. Same-named functions (such as &is and &are) that existed before the declarator's execution are restored correctly.

Requirements:
  • Perl
    tags object declare  myapp column  myapp param  helper functions  the declarator  declare returns  context declare  use object  column myapp  

    Download Object::Declare 0.13


     http://ftp.hostingromania.ro/Linux/mirrors/ftp.cpan.org/authors/id/A/AU/AUDREYT/Object-Declare-0.13.tar.gz


    Authors software

    PAR::Tutorial 0.941 (by Audrey Tang)
    PAR::Tutorial is a cross-platform Packaging and Deployment with PAR.

    SYNOPSIS

    This is a tutorial on PAR, first appeared at the

    PDF::FromHTML 0.12 (by Audrey Tang)

    Object::Declare 0.13 (by Audrey Tang)
    Object::Declare is a Perl module for declarative object constructor.

    SYNOPSIS

    use Object::Declare ['MyApp::Column', 'MyApp:

    Scalar::Defer 0.07 (by Audrey Tang)
    Scalar::Defer is a Perl module to calculate values on demand.

    SYNOPSIS

    use Scalar::Defer; # exports 'defer' and 'lazy'


    Similar software

    Object::Declare 0.13 (by Audrey Tang)
    Object::Declare is a Perl module for declarative object constructor.

    SYNOPSIS

    use Object::Declare ['MyApp::Column', 'MyApp:

    Class::Meta::Declare 0.04 (by Curtis Poe)
    Class::Meta::Declare is a Perl module deprecated in favor of Class::Meta::Express.

    SYNOPSIS

    This was a first attempt at making

    Declare::Constraints::Simple 0.03 (by Robert Sedlacek)
    Declare::Constraints::Simple is a Perl module for Declarative Validation of Data Structures.

    SYNOPSIS

    use Declare::Constraint

    Getopt::Declare 1.11 (by Damian Conway)
    Getopt::Declare is a Perl module with Declaratively Expressed Command-Line Arguments via Regular Expressions.

    SYNOPSIS

    use Get

    DBIx::DataModel 0.21 (by Laurent Dami)
    DBIx::DataModel is a Perl module with Classes and UML-style Associations on top of DBI.

    SYNOPSIS

    in file "MySchema.pm"

    Decla

    Class::Tangram 1.57 (by Sam Vilain)
    Class::Tangram is a Perl module for tangram-friendly classes, DWIM attributes.

    SYNOPSIS

    package MyObject;

    use base qw(Clas

    Method::Declarative 0.03 (by Jim Schneider)
    Method::Declarative is a Perl module to create methods with declarative syntax.

    SYNOPSIS

    use Method::Declarative
    (
    '-

    Class::Meta::Express 0.04 (by David Wheeler)
    Class::Meta::Express is a Perl module for concise, expressive creation of Class::Meta classes.

    Synopsis

    package My::Contact;

    Gimp::basewidget 1.211 (by Marc Lehmann)
    Gimp::basewidget is a pragma to declare the superclass of a gtk widget.

    SYNOPSIS

    use Gimp::basewidget 'superclass';
    e.g.

    Class::Meta 0.53 (by David Wheeler)
    Class::Meta is a Perl class automation, introspection, and data validation.

    SYNOPSIS

    Generate a class:
    package MyApp::Thingy


    Other software in this category

    zlib 1.2.3 (by Jean-loup Gailly)
    zlib is designed to be a free, general-purpose, legally unencumbered, lossless data-compression library for use on virtually any comp

    libjpeg v6b (by Independent JPEG Group)
    libjpeg is a library for handling the JPEG (JFIF) image format

    OpenSSL 0.9.7c (by The OpenSSL Project Team)
    The OpenSSL Project is a collaborative effort to develop a robust, commercial-grade, full-featured, and Open Source toolkit implement

    libxml2 2.6.27 (by DV)
    Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), libxml2 library i

    GNU C library 2.4 (by Andreas Jaeger)
    GNU C library (glibc) is one of the most important components of GNU Hurd and most modern Linux distributions.

    GNU C library is us

  •     search


    Featured Software

    jEdit 4.3 pre8
    jEdit is an Open Source text editor written in Java

    Opera 9.02
    Surf the Internet in a safer, faster, and easier way with Opera browser

    GNU Aspell 0.60.4
    GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell


    Subscribe in Rojo
    Google Reader
    Add to My Yahoo!

    Add to My AOL
    Subscribe with Bloglines
    Subscribe in NewsGator Online
    Add 'nixbit linux software' to Newsburst from CNET News.com
    del.icio.us nixbit linux software


    Top tags