The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Games::3D::Template - describe an object class and it's keys/settings

SYNOPSIS

        use Games::3D::Template;
        use Games::3D::Thingy;

        Games::3D::Template->from_string($string);

        Games::3D::Thingy->new( ... );

        # check entire object
        $template->validate($thingy);

        # check only one key
        $template->validate_key($thingy,'name');

EXPORTS

Exports nothing on default.

DESCRIPTION

This package provides a validation class for "things" in Games::3D. It defines what the valid keys are, and what their data should look like, and also how this data should be transformed into strings and back to internal data (for instance when saving/loading data).

METHODS

new()
        my $template = Games::3D::Template->new();

Creates a new, empty template.

class()
        $template->class();

Return the class of objects this template describes. For instance, 'Games::3D::Foo::Bar'.

validate()
        $template->validate($thingy);

Validate the entire object $thingy, e.g see if it still confirms to the template.

Returns undef for ok, otherwise error message.

validate_key()
        $template->validate_key($thingy, $key);

Validate the key $key from object $thingy, e.g see if it still confirms to the template.

Returns undef for ok, otherwise error message.

id()

Return the templates' unique id. They are independant from all other IDs.

create_thing()
        my $fresh = $template->create_thing();

Take your own blueprint and create a thing with default values.

as_string()
        $template->as_string();

Return this template as string.

add_key()
        $template->add_key( );

Add an key to the template.

keys()
        my $keys = $template->keys();

Return the number of keys in this template.

from_string()
        my @objects = $template->from_string( $string );

Create one or more objets from their string form. See also as_string.

init_thing()
        $template->init_thing($thing);

Init all fields in a thing from the blueprint.

AUTHORS

(c) 2004, 2006 Tels <http://bloodgate.com/>

SEE ALSO

Games::3D, Games::Irrlicht.