1 |
package Xot::Field; |
package Xot::Field; |
2 |
use Xot::Reference; |
use base "Xot::Accessors"; |
3 |
use strict; |
use strict; |
4 |
|
|
5 |
|
Xot::Field->plain(qw(name type table)); |
6 |
|
|
7 |
sub new |
sub new |
8 |
{ |
{ |
9 |
my $class = shift; |
my ($class, $table, $twig) = splice @_, 0, 3; |
|
my $twig = shift; |
|
10 |
|
|
11 |
$class = "Xot::Reference" |
$class = 'Xot::Reference' |
12 |
if ($twig->att("references")); |
if ($twig->att('references')); |
13 |
|
|
14 |
my $self = bless {}, $class; |
my $self = bless {}, $class; |
15 |
|
|
16 |
$self->init($twig); |
$self->init($table, $twig, @_); |
17 |
|
|
18 |
return $self; |
return $self; |
19 |
} |
} |
20 |
|
|
21 |
sub init |
sub init |
22 |
{ |
{ |
23 |
my $self = shift; |
my ($self, $table, $twig) = splice @_, 0, 3; |
24 |
my $twig = shift; |
|
25 |
|
$self->type($twig->att('type')); |
26 |
|
$self->name($twig->att('name')); |
27 |
|
$self->table($table); |
28 |
|
$self->twig($twig); |
29 |
|
|
|
# printf "\n====================\n"; |
|
|
# $twig->print; |
|
|
# print "\n====================\n"; |
|
30 |
} |
} |
31 |
|
|
32 |
1; |
1; |