1 |
## -------------------------------------------------------------------------------- |
## ------------------------------------------------------------------------ |
2 |
## $Id$ |
## $Id$ |
3 |
## -------------------------------------------------------------------------------- |
## ------------------------------------------------------------------------ |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.11 2003/01/20 16:43:18 joko |
6 |
|
## + better argument-property merging |
7 |
|
## + debugging-output !!! |
8 |
|
## + abstract-dummy 'sub createChildNode' |
9 |
|
## |
10 |
## Revision 1.10 2003/01/19 02:31:51 joko |
## Revision 1.10 2003/01/19 02:31:51 joko |
11 |
## + fix to 'sub AUTOLOAD' |
## + fix to 'sub AUTOLOAD' |
12 |
## |
## |
38 |
## |
## |
39 |
## Revision 1.1 2002/10/10 03:44:07 cvsjoko |
## Revision 1.1 2002/10/10 03:44:07 cvsjoko |
40 |
## + new |
## + new |
41 |
## -------------------------------------------------------------------------------- |
## ------------------------------------------------------------------------ |
42 |
|
|
43 |
|
|
44 |
package Data::Storage::Handler::Abstract; |
package Data::Storage::Handler::Abstract; |
48 |
|
|
49 |
use base qw( DesignPattern::Object ); |
use base qw( DesignPattern::Object ); |
50 |
|
|
51 |
|
|
52 |
use Data::Dumper; |
use Data::Dumper; |
53 |
use Tie::SecureHash; |
use Tie::SecureHash; |
54 |
#use Data::Storage::Handler; |
#use Data::Storage::Handler; |
55 |
|
use Data::Transform::Deep qw( merge ); |
56 |
|
|
57 |
|
|
58 |
# get logger instance |
# get logger instance |
59 |
my $logger = Log::Dispatch::Config->instance; |
my $logger = Log::Dispatch::Config->instance; |
103 |
#=cut |
#=cut |
104 |
|
|
105 |
# merge passed-in arguments to constructor as properties into already blessed secure object |
# merge passed-in arguments to constructor as properties into already blessed secure object |
106 |
|
|
107 |
# mungle arguments from array into hash - perl does the job ;) |
# mungle arguments from array into hash - perl does the job ;) |
108 |
my %args = @_; |
#my %args = @_; |
109 |
|
#my %args = (); |
110 |
|
|
111 |
|
#print Dumper(@_); |
112 |
|
|
113 |
# merge attributes one-by-one |
# merge attributes one-by-one |
114 |
# TODO: deep_copy? / merge_deep? |
# TODO: deep_copy? / merge_deep? |
115 |
foreach (keys %args) { |
while (my $elemName = shift @_) { |
116 |
#print "key: $_", "\n"; |
#print "elemName: $elemName", "\n"; |
117 |
$self->{$_} = $args{$_}; |
if (my $elemValue = shift @_) { |
118 |
|
#print Dumper($elemValue); |
119 |
|
#print "elemName=$elemName, elemValue=$elemValue", "\n"; |
120 |
|
$self->{$elemName} = $elemValue; |
121 |
|
} |
122 |
|
#$self->{$_} = $args{$_}; |
123 |
|
#$self->{$_} = $args{$_}; |
124 |
} |
} |
125 |
|
|
126 |
# V3 - rolling our own security (just for {COREHANDLE} - nothing else) - nope, Tie::SecureHash works wonderful |
# V3 - rolling our own security (just for {COREHANDLE} - nothing else) - nope, Tie::SecureHash works wonderful |
175 |
# this is to prevent deep recursion's |
# this is to prevent deep recursion's |
176 |
return if lc $methodname eq 'exists'; |
return if lc $methodname eq 'exists'; |
177 |
|
|
178 |
#print "$methodname - 1", "\n"; |
print "$methodname - 1", "\n"; |
179 |
|
|
180 |
# TODO: enhance logging/debugging |
# TODO: enhance logging/debugging |
181 |
#if (!$self->exists('COREHANDLE')) { return; } |
#if (!$self->exists('COREHANDLE')) { return; } |
188 |
} |
} |
189 |
$self->{lock_info}->{last_method} = $methodname; |
$self->{lock_info}->{last_method} = $methodname; |
190 |
|
|
191 |
#print "$methodname - 2", "\n"; |
print "$methodname - 2", "\n"; |
192 |
|
|
193 |
#print Dumper($self); |
#print Dumper($self); |
194 |
#exit; |
#exit; |
333 |
$self->_abstract_function('sendCommand'); |
$self->_abstract_function('sendCommand'); |
334 |
} |
} |
335 |
|
|
336 |
|
sub createChildNode { |
337 |
|
my $self = shift; |
338 |
|
$self->_abstract_function('createChildNode'); |
339 |
|
} |
340 |
|
|
341 |
sub existsChildNode_tmp { |
sub existsChildNode_tmp { |
342 |
my $self = shift; |
my $self = shift; |
343 |
$self->_abstract_function('existsChildNode'); |
$self->_abstract_function('existsChildNode'); |