Linux SoftwareProgrammingLibrariesClass::Meta::Declare 0.04

Class::Meta::Declare 0.04


Class::Meta::Declare is a Perl module deprecated in favor of Class::Meta::Express. SYNOPSIS This was a first attempt at making
Developer:   Curtis Poe
      more software by author →
Price:  0.00
License:   Perl Artistic License
File size:   14K
Language:   
OS:   
Rating:   0 /5 (0 votes)
Your vote:  
enlarge screenshot


Class::Meta::Declare is a Perl module deprecated in favor of Class::Meta::Express.

SYNOPSIS

This was a first attempt at making a saner interface for Class::Meta. It is nicer, but Class::Meta::Express is nicer still. Go use that one.

package MyApp::Thingy;
use Class::Meta::Declare ':all';
use Data::UUID;

Class::Meta::Declare->new(
meta => [
key => 'thingy',
accessors => $ACC_SEMI_AFFORDANCE,
],
attributes => [
pi => {
context => $CTXT_CLASS,
authz => $AUTHZ_READ,
default => 3.1415927,
},
id => {
authz => $AUTHZ_READ,
type => $TYPE_STRING,
default => sub { Data::UUID->new->create_str },
},
name => {
required => 1,
type => $TYPE_STRING,
default => 'No Name Supplied',
},
age => { type => $TYPE_INTEGER, },
],
methods => [
some_method => {
view => $VIEW_PUBLIC,
code => sub {
my $self = shift;
return [ reverse @_ ];
},
}
]
);

my $object = MyApp::Thingy->new;
print MyApp::Thingy->pi; # prints 3.1415927
print $object->name; # prints "No Name Supplied';
$object->set_name("bob");
print $object->name; # prints "bob"

This class provides an alternate interface for Class::Meta.

Class::Meta is a useful module which allows one to create Perl classes which support introspection (also known as reflection). Typically Perl classes, when created, don't supply a lot of metadata. Imported helper functions show up when you call $object->can($method). Private, protected and trusted methods are not readily supported. Fetching a list of attributes or methods is a haphazard affair. Class::Meta overcomes these shortcomings by building the classes for you and allowing you to fetch a class object:

my $class_object = $object->my_class;

foreach my $attribute ( $class_object->attributes ) {
print $attribute->name, "n";
}
foreach my $method ( $class_object->methods ) {
print $method->name, "n";
}

If you've set up your class correctly, these properties are now easy to discover.

Unfortunately, many find the Class::Meta interface to be a bit clumsy. As an alternative, Class::Meta::Declare allows you to declare your entire class in a single argument list to the constructor and have the class built for you automatically. Further, reasonable defaults are provided for just about everything.

IMPORTANT: You want this class or Class::Meta if you need an introspection API for your classes. If you do not need introspection or dynamic class generation, these modules are overkill.

Requirements:
  • Perl
    tags class meta  class object  meta declare  type type  myapp thingy  the class  object name  for you  name prints  perl classes  this class  print object  type string  

    Download Class::Meta::Declare 0.04


     http://ftp.casaafacerilor.ro/mirrors/CPAN/authors/id/O/OV/OVID/Class-Meta-Declare-0.04.tar.gz


    Authors software

    AI::NeuralNet::Simple 0.10 (by Curtis Poe)
    AI::NeuralNet::Simple is a simple learning module for building neural nets.

    SYNOPSIS

    use AI::NeuralNet::Simple;
    my $net =

    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

    Class::CGI 0.20 (by Curtis Poe)
    Class::CGI is a Perl module to fetch objects from your CGI object.

    SYNOPSIS

    use Class::CGI
    handlers => {


    Similar software

    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

    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

    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;

    Class::Meta::Type 0.53 (by David Wheeler)
    Class::Meta::Type is a Perl module for data type validation and accessor building.

    SYNOPSIS

    package MyApp::TypeDef;

    use

    Object::Relation::Meta::Class::Schema 0.1.0 (by Kineticode, Inc.)
    Object::Relation::Meta::Class::Schema is a Perl module for Object::Relation database store builder.

    This module is provides metada

    Class::MOP 0.35 (by Stevan Little and Yuval Kogman)
    Class::MOP is a Meta Object Protocol for Perl 5.

    SYNOPSIS

    # ..

    Object::Relation::Meta::Attribute::Schema 0.1.0 (by Kineticode, Inc.)
    Object::Relation::Meta::Attribute::Schema is a Perl module for Object::Relation database store builder.

    Synopsis

    # Assuming M

    Object::Relation::Meta::Type 0.1.0 (by Kineticode, Inc.)
    Object::Relation::Meta::Type is an Object::Relation Data type validation and accessor building.

    Synopsis

    Object::Relation::Me

    Myco::Entity 1.22 (by Charles Owens)
    Myco::Entity is a common base class for all Myco entity classes.

    SYNOPSIS

    ### Entity class definition

    package Myco::Foo;

    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


    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