2 |
## $Id$ |
## $Id$ |
3 |
## -------------------------------------------------------------------------------- |
## -------------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.2 2002/12/27 16:02:39 joko |
6 |
|
## - object constructor |
7 |
|
## + now utilizing DesignPattern::Object |
8 |
|
## + use Data::Query::Element::LV |
9 |
|
## |
10 |
## Revision 1.1 2002/12/23 04:23:24 joko |
## Revision 1.1 2002/12/23 04:23:24 joko |
11 |
## + initial check-in |
## + initial check-in |
12 |
## |
## |
18 |
use strict; |
use strict; |
19 |
use warnings; |
use warnings; |
20 |
|
|
21 |
|
use base 'DesignPattern::Object'; |
22 |
use base 'DesignPattern::Object::Logger'; |
use base 'DesignPattern::Object::Logger'; |
23 |
|
|
24 |
|
|
28 |
use libp qw( mkObject ); |
use libp qw( mkObject ); |
29 |
use Data::Compare::Struct qw( isEmpty ); |
use Data::Compare::Struct qw( isEmpty ); |
30 |
|
|
31 |
# ------------ common perl object constructor ------------ |
use Data::Query::Element::LV; |
|
sub new { |
|
|
my $invocant = shift; |
|
|
my $class = ref($invocant) || $invocant; |
|
|
my @args = (); |
|
|
@_ && (@args = @_); |
|
|
#$logger->debug( __PACKAGE__ . "->new( @args )" ); # this is not "common"! |
|
|
my $self = { @_ }; |
|
|
bless $self, $class; |
|
|
$self->{caller} = caller; |
|
|
|
|
|
#print Dumper(caller(2)); |
|
|
#exit; |
|
|
|
|
|
$self->_init(); |
|
|
return $self; |
|
|
} |
|
32 |
|
|
33 |
sub _init { |
sub _init { |
34 |
my $self = shift; |
my $self = shift; |
35 |
|
|
36 |
#print Dumper($self->{options}->getOptions()); |
if ($self->{options}) { |
37 |
|
$self->{__options} = $self->{options}; |
38 |
|
delete $self->{options}; |
39 |
|
my $possible_keys = $self->{__options}->getPossibleOptionKeys(); |
40 |
|
my $options = $self->{__options}->getOptions(); |
41 |
|
foreach (@$possible_keys) { |
42 |
|
$self->{$_} = Data::Query::Element::LV->new($options->{$_}); |
43 |
|
} |
44 |
|
} |
45 |
|
|
46 |
} |
} |
47 |
|
|
48 |
sub getOptions { |
sub getOptions { |
49 |
my $self = shift; |
my $self = shift; |
50 |
return $self->{options}->getOptions(); |
return $self->{__options}->getOptions(); |
51 |
} |
} |
52 |
|
|
53 |
1; |
1; |