2 |
## $Id$ |
## $Id$ |
3 |
## -------------------------------------------------------------------------------- |
## -------------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.3 2003/02/09 04:50:32 joko |
6 |
|
## - purged old code |
7 |
|
## |
8 |
|
## Revision 1.2 2002/12/27 16:02:39 joko |
9 |
|
## - object constructor |
10 |
|
## + now utilizing DesignPattern::Object |
11 |
|
## + use Data::Query::Element::LV |
12 |
|
## |
13 |
## Revision 1.1 2002/12/23 04:23:24 joko |
## Revision 1.1 2002/12/23 04:23:24 joko |
14 |
## + initial check-in |
## + initial check-in |
15 |
## |
## |
21 |
use strict; |
use strict; |
22 |
use warnings; |
use warnings; |
23 |
|
|
24 |
|
use base 'DesignPattern::Object'; |
25 |
use base 'DesignPattern::Object::Logger'; |
use base 'DesignPattern::Object::Logger'; |
26 |
|
|
27 |
|
|
28 |
use Data::Dumper; |
use Data::Dumper; |
29 |
|
|
30 |
use Regexp::Group; |
use Regexp::Group; |
|
use libp qw( mkObject ); |
|
31 |
use Data::Compare::Struct qw( isEmpty ); |
use Data::Compare::Struct qw( isEmpty ); |
32 |
|
|
33 |
# ------------ 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; |
|
|
} |
|
34 |
|
|
35 |
sub _init { |
sub _init { |
36 |
my $self = shift; |
my $self = shift; |
37 |
|
|
38 |
#print Dumper($self->{options}->getOptions()); |
if ($self->{options}) { |
39 |
|
$self->{__options} = $self->{options}; |
40 |
|
delete $self->{options}; |
41 |
|
my $possible_keys = $self->{__options}->getPossibleOptionKeys(); |
42 |
|
my $options = $self->{__options}->getOptions(); |
43 |
|
foreach (@$possible_keys) { |
44 |
|
$self->{$_} = Data::Query::Element::LV->new($options->{$_}); |
45 |
|
} |
46 |
|
} |
47 |
|
|
48 |
} |
} |
49 |
|
|
50 |
sub getOptions { |
sub getOptions { |
51 |
my $self = shift; |
my $self = shift; |
52 |
return $self->{options}->getOptions(); |
return $self->{__options}->getOptions(); |
53 |
} |
} |
54 |
|
|
55 |
1; |
1; |