Name : perl-Object-Declare
| |
Version : 0.25
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 1.39
| Date : 2024-08-05 17:32:30
|
Group : Development/Libraries/Perl
| Source RPM : perl-Object-Declare-0.25-1.39.src.rpm
|
Size : 0.02 MB
| |
Packager : (none)
| |
Summary : Declarative object constructor
|
Description :
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 label prefixes, are => \'\', # or to callback that e.g. turns has => sub { has => AATT_ }, # \"has X\" to \"has is X\" and }, aliases => { # list of label aliases: more => \'less\', # turns \"is more\" into \"is less\" }, mapping => { column => \'MyApp::Column\', # class name to call ->new to param => sub { # arbitrary coderef also works bless(\\AATT_, \'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.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-O/openSUSE_Tumbleweed/noarch |