Linux SoftwareProgrammingLibrariesClass::Meta 0.53

Class::Meta 0.53


Class::Meta is a Perl class automation, introspection, and data validation. SYNOPSIS Generate a class: package MyApp::Thingy
Developer:   David Wheeler
      more software by author →
Price:  0.00
License:   Perl Artistic License
File size:   59K
Language:   
OS:   
Rating:   0 /5 (0 votes)
Your vote:  
enlarge screenshot


Class::Meta is a Perl class automation, introspection, and data validation.

SYNOPSIS

Generate a class:
package MyApp::Thingy;
use strict;
use Class::Meta;
use Class::Meta::Types::String;
use Class::Meta::Types::Numeric;

BEGIN {

# Create a Class::Meta object for this class.
my $cm = Class::Meta->new( key => 'thingy' );

# Add a constructor.
$cm->add_constructor(
name => 'new',
create => 1,
);

# Add a couple of attributes with generated methods.
$cm->add_attribute(
name => 'uuid',
authz => Class::Meta::READ,
type => 'string',
required => 1,
default => sub { Data::UUID->new->create_str },
);
$cm->add_attribute(
name => 'name',
is => 'string',
required => 1,
default => undef,
);
$cm->add_attribute(
name => 'age',
is => 'integer',
default => undef,
);

# Add a custom method.
$cm->add_method(
name => 'chk_pass',
view => Class::Meta::PUBLIC,
);
$cm->build;
}
Then use the class:
use MyApp::Thingy;

my $thingy = MyApp::Thingy->new;
print "ID: ", $thingy->id, $/;
$thingy->name('Larry');
print "Name: ", $thingy->name, $/;
$thingy->age(42);
print "Age: ", $thingy->age, $/;
Or make use of the introspection API:
use MyApp::Thingy;

my $class = MyApp::Thingy->my_class;
my $thingy;

print "Examining object of class ", $class->package, $/;

print "nConstructors:n";
for my $ctor ($class->constructors) {
print " o ", $ctor->name, $/;
$thingy = $ctor->call($class->package);
}

print "nAttributes:n";
for my $attr ($class->attributes) {
print " o ", $attr->name, " => ", $attr->get($thingy), $/;
if ($attr->authz >= Class::Meta::SET && $attr->type eq 'string') {
$attr->get($thingy, 'hey there!');
print " Changed to: ", $attr->get($thingy), $/;
}
}

print "nMethods:n";
for my $meth ($class->methods) {
print " o ", $meth->name, $/;
$meth->call($thingy);
}

Class::Meta provides an interface for automating the creation of Perl classes with attribute data type validation. It differs from other such modules in that it includes an introspection API that can be used as a unified interface for all Class::Meta-generated classes. In this sense, it is an implementation of the "Facade" design pattern.

Requirements:
  • Perl
    tags class meta  myapp thingy  attribute name  attr get  add attribute  get thingy  class package  name thingy  use class  thingy age  introspection api  interface for  string required  

    Download Class::Meta 0.53


     http://ftp.casaafacerilor.ro/mirrors/CPAN/authors/id/D/DW/DWHEELER/Class-Meta-0.53.tar.gz


    Authors software

    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

    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

    Bundle::BricolagePlus 1.10.0 (by David Wheeler)
    Bundle::BricolagePlus are optional and required modules for the Bricolage content management system.

    SYNOPSIS

    perl -MCPAN -e 'i

    Apache::TestMB 1.28 (by David Wheeler)
    Apache::TestMB is a subclass of Module::Build to support Apache::Test.

    SYNOPSIS

    Standard process for building & installing modu

    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;


    Similar software

    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::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::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::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

    Template::Tutorial 2.15 (by Andy Wardley)
    Template::Tutorial are template toolkit tutorials.

    This section includes tutorials on using the Template Toolkit

    Games::3D 0.09 (by Tels)
    Games::3D is a package containing an object system for (not only) 3D games.

    SYNOPSIS

    use Games::3D::World;

    m

    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::Std 0.0.8 (by Damian Conway)

    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;


    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