--- nfo/perl/libs/Data/Storage/Handler/Abstract.pm 2002/12/19 16:30:23 1.9 +++ nfo/perl/libs/Data/Storage/Handler/Abstract.pm 2003/01/19 02:31:51 1.10 @@ -1,7 +1,10 @@ ## -------------------------------------------------------------------------------- -## $Id: Abstract.pm,v 1.9 2002/12/19 16:30:23 joko Exp $ +## $Id: Abstract.pm,v 1.10 2003/01/19 02:31:51 joko Exp $ ## -------------------------------------------------------------------------------- ## $Log: Abstract.pm,v $ +## Revision 1.10 2003/01/19 02:31:51 joko +## + fix to 'sub AUTOLOAD' +## ## Revision 1.9 2002/12/19 16:30:23 joko ## + added 'sub dropDb' and 'sub rebuildDb' as croakers for concrete implementations of methods in proper handlers ## @@ -65,7 +68,7 @@ bless $self, $class; =cut - +#=pod # V2 - maybe more convenient/secure? utilizing Damian Conway's Tie::SecureHash... my $self = Tie::SecureHash->new( $class, @@ -89,7 +92,7 @@ #_protected => , #__private => , ); - +#=cut # merge passed-in arguments to constructor as properties into already blessed secure object @@ -124,6 +127,7 @@ } +# TODO: use NEXT.pm inside this mechanism (to avoid repetitions...) sub AUTOLOAD { # recursion problem to be avoided here!!! @@ -160,7 +164,7 @@ #if (!$self->exists('COREHANDLE')) { return; } # handle locking (hack) - if ($self->exists('lock_info') && $self->{lock_info}->{last_method} && $methodname eq $self->{lock_info}->{last_method}) { + if ($self->can('exists') && $self->exists('lock_info') && $self->{lock_info}->{last_method} && $methodname eq $self->{lock_info}->{last_method}) { $self->{lock_info}->{log_lock} = 1; } else { $self->{lock_info}->{log_lock} = 0; @@ -181,7 +185,14 @@ #if (!$self->exists('_COREHANDLE')) { #if (!$self->{_COREHANDLE}) { if (!$core) { - my $err_msg_core = __PACKAGE__ . "[$self->{metainfo}->{type}]" . ": " . "COREHANDLE is undefined while trying to execute method \"$methodname\""; + +#print Dumper($self); +#exit; + + my $handlertype = $self->{metainfo}->{type}; + $handlertype ||= ''; + + my $err_msg_core = __PACKAGE__ . "[$handlertype]" . ": " . "COREHANDLE is undefined while trying to execute method \"$methodname\""; print $err_msg_core, "\n"; if ($self->exists('lock_info') && !$self->{lock_info}->{log_lock}) { $logger->error( $err_msg_core ); @@ -227,10 +238,11 @@ #print "calling: $methodname", "\n"; - # method calls doing it until here will get dispatched to the proper handler + # method calls making it until here will get dispatched to the proper handler return $core->$methodname(@_); } elsif ($self->can($methodname)) { + # try to call specified method inside our or inherited module(s) scope(s) return $self->$methodname(@_); } @@ -267,7 +279,7 @@ my $self = shift; my $nodename = shift; #$nodename = 'TransactionRoutingTable'; - $logger->debug( __PACKAGE__ . "->getChildNode( nodename $nodename )" ); + $logger->debug( __PACKAGE__ . "->existsChildNode( nodename $nodename )" ); $self->getChildNodes() unless $self->{meta}->{childnodes}; my $result = grep(m/$nodename/i, @{$self->{meta}->{childnodes}}); # TODO: use "/i" only on win32-systems! return $result;