POD for Definition.pm. Needs more details and design decisions.
This commit is contained in:
parent
0c90162c57
commit
80ad86edb2
1 changed files with 53 additions and 0 deletions
|
|
@ -24,6 +24,26 @@ no warnings qw(uninitialized);
|
||||||
|
|
||||||
our $VERSION = '0.0.1';
|
our $VERSION = '0.0.1';
|
||||||
|
|
||||||
|
=head1 NAME
|
||||||
|
|
||||||
|
Package WebGUI::Definition
|
||||||
|
|
||||||
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
Moose-based meta class for all definitions in WebGUI.
|
||||||
|
|
||||||
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
A definition contains all the information needed to build an object.
|
||||||
|
Information required to build forms are added as optional roles and
|
||||||
|
sub metaclasses. Database persistance is handled similarly.
|
||||||
|
|
||||||
|
=head1 METHODS
|
||||||
|
|
||||||
|
These methods are available from this class:
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
my ($import, $unimport, $init_meta) = Moose::Exporter->build_import_methods(
|
my ($import, $unimport, $init_meta) = Moose::Exporter->build_import_methods(
|
||||||
install => [ 'unimport' ],
|
install => [ 'unimport' ],
|
||||||
with_meta => [ 'property', 'attribute' ],
|
with_meta => [ 'property', 'attribute' ],
|
||||||
|
|
@ -31,6 +51,15 @@ my ($import, $unimport, $init_meta) = Moose::Exporter->build_import_methods(
|
||||||
roles => [ 'WebGUI::Definition::Role::Object' ],
|
roles => [ 'WebGUI::Definition::Role::Object' ],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 import ( )
|
||||||
|
|
||||||
|
A custom import method is provided so that uninitialized properties do not
|
||||||
|
generate warnings.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
sub import {
|
sub import {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my $caller = caller;
|
my $caller = caller;
|
||||||
|
|
@ -40,6 +69,14 @@ sub import {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 init_meta ( )
|
||||||
|
|
||||||
|
Sets the metaclass to WebGUI::Definition::Meta::Class.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
sub init_meta {
|
sub init_meta {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
my %options = @_;
|
my %options = @_;
|
||||||
|
|
@ -47,6 +84,16 @@ sub init_meta {
|
||||||
return Moose->init_meta(%options);
|
return Moose->init_meta(%options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 attribute ( )
|
||||||
|
|
||||||
|
An attribute of the definition, typically static data which is never processed from a form
|
||||||
|
or persisted to the database. In an Asset-style definition, an attribute would
|
||||||
|
be the table name, the asset's name, or the path to the asset's icon.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
sub attribute {
|
sub attribute {
|
||||||
my ($meta, $name, $value) = @_;
|
my ($meta, $name, $value) = @_;
|
||||||
if ($meta->can($name)) {
|
if ($meta->can($name)) {
|
||||||
|
|
@ -59,6 +106,12 @@ sub attribute {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 property ( )
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
sub property {
|
sub property {
|
||||||
my ($meta, $name, %options) = @_;
|
my ($meta, $name, %options) = @_;
|
||||||
my %form_options;
|
my %form_options;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue