Class::Meta 0.53
Sponsored Links
Class::Meta 0.53 Ranking & Summary
File size:
0.060 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
5169
Date added:
2006-10-05
Publisher:
David Wheeler
Publisher URL:
http://search.cpan.org/~d
Class::Meta 0.53 description
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.
Download nowSYNOPSIS
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.
Class::Meta 0.53 Screenshot
Sponsored Links
Class::Meta 0.53 Keywords
Bookmark Class::Meta 0.53
Class::Meta 0.53 Copyright
WareSeeker periodically updates pricing and software information of Class::Meta 0.53 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Class::Meta 0.53 Edition. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Class::Meta 0.53 Related Software
SEO Tool For Meta Tags is a small script that instantly generates meta tags for the user.
Website META Language is a free and extensible Webdesigners off-line HTML generation toolkit for Unix.
Class::MakeMethods::Template::Generic Perl module contains templates for common meta-method types.
Object::Meta::Plugin::Host are hosts plugins that work like Object::Meta::Plugin.
Class::Meta::Express is a Perl module for concise, expressive creation of Class::Meta classes.
Class::Meta::Declare is a Perl module deprecated in favor of Class::Meta::Express.
Class::Meta::Type is a Perl module for data type validation and accessor building.
Object::Relation::Meta::Class::Schema is a Perl module for Object::Relation database store builder.
WWW::Meta::XML::Browser is a Perl module to simulate a browser session described in a XML file.
My Software
You have not saved any software. Click "Save" next to each software to save it to your software basket
Related Search
TOP POPULAR DOWNLOAD