Object::Declare

Description

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 declarators execution are restored correctly..

Myapp - Objectdeclare - Perl Module - List Of - Declare - Object - Module - List - Declarative - Perl - Libraries - Programming

Published By:Audrey Tang

License Type:Freeware

Date Added:22 October, 2010

Version:0.13

Price:Free

Downloads:31

Size:27.6 KB

Platform: Linux

What people say
- required fields
     
Related Downloads

Locale::Maketext::Fuzzy is a Perl module for Maketext from already interpolated strings.

DateAug 21, 2010

AuthorAutrijus Tang

Size6.1 KB

LicenseFreeware

PriceFree

PlatformLinux

CategoryLinux Programming

ModPerl::ParamBuilder is a Perl module that makes building custom Apache directives easy.

DateSep 6, 2010

AuthorFrank Wiles

Size8.2 KB

LicenseFreeware

PriceFree

PlatformLinux

CategoryLinux Programming

Module::Recursive::Require is a Perl class that requires module recursive. # ************************************** before use MyApp::Foo; use MyApp::Foo::CGI; use MyApp::Foo::Mail; use MyApp::Foo::Mail::Send; # use use use use use !!

DateSep 20, 2010

AuthorMasahiro Funakoshi

Size3.1 KB

LicenseFreeware

PriceFree

PlatformLinux

CategoryLinux Programming

Data::Encrypted is a Perl module to transparently store encrypted data via RSA. SYNOPSIS # functional interface: use Data::Encrypted file => "./.

DateAug 12, 2010

AuthorAaron J Mackey

Size7.2 KB

LicenseFreeware

PriceFree

PlatformLinux

CategoryLinux Programming

XML::Generator::vCard is a Perl module that can generate SAX2 events for vCard 3.

DateOct 4, 2010

AuthorAaron Straup Cope

Size7.2 KB

LicenseFreeware

PriceFree

PlatformLinux

CategoryLinux Programming