1SQL::Translator::SchemaU:s:eOrbjCeocntt(r3i)buted Perl DSoQcLu:m:eTnrtaantsiloantor::Schema::Object(3)
2
3
4

NAME

6       SQL::Translator::Schema::Object - Base class SQL::Translator Schema
7       objects.
8

SYNOPSIS

DESCSIPTION

11       Base class for Schema objects. Sub classes Class::Base and adds the
12       following extra functionality.
13

Construction

15       Derived classes should declare their attributes using the "_attributes"
16       method. They can then inherit the "init" method from here which will
17       call accessors of the same name for any values given in the hash passed
18       to "new".  Note that you will have to impliment the accessors your self
19       and we expect perl style methods; call with no args to get and with arg
20       to set.
21
22       e.g. If we setup our class as follows;
23
24        package SQL::Translator::Schema::Table;
25        use base qw/SQL::Translator::Schema::Object/;
26
27        __PACKAGE__->_attributes( qw/schema name/ );
28
29        sub name   { ... }
30        sub schema { ... }
31
32       Then we can construct it with
33
34        my $table  =  SQL::Translator::Schema::Table->new(
35            schema => $schema,
36            name   => 'foo',
37        );
38
39       and init will call "$table->name("foo")" and "$table->schema($schema)"
40       to set it up. Any undefined args will be ignored.
41
42       Multiple calls to "_attributes" are cumulative and sub classes will
43       inherit their parents attribute names.
44
45       This is currently experimental, but will hopefull go on to form an
46       introspection API for the Schema objects.
47

Global Attributes

49       The following attributes are defined here, therefore all schema objects
50       will have them.
51
52       extra
53
54       Get or set the objects "extra" attibutes (e.g., "ZEROFILL" for MySQL
55       fields).  Call with no args to get all the extra data.  Call with a
56       single name arg to get the value of the named extra attribute, returned
57       as a scalar. Call with a hash or hashref to set extra attributes.
58       Returns a hash or a hashref.
59
60         $field->extra( qualifier => 'ZEROFILL' );
61
62         $qualifier = $field->extra('qualifier');
63
64         %extra = $field->extra;
65         $extra = $field->extra;
66
67       equals
68
69       Determines if this object is the same as another.
70
71         my $isIdentical = $object1->equals( $object2 );
72

SEE ALSO

TODO

BUGS

AUTHOR

77       Ken Y. Clark <kclark@cpan.org>, Mark Addison <mark.addison@itn.co.uk>
78
79
80
81perl v5.8.8                       2007-10-24SQL::Translator::Schema::Object(3)
Impressum