/[cvs]/nfo/perl/libs/Data/Storage/Handler/Abstract.pm
ViewVC logotype

Diff of /nfo/perl/libs/Data/Storage/Handler/Abstract.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by joko, Fri Dec 13 21:48:35 2002 UTC revision 1.10 by joko, Sun Jan 19 02:31:51 2003 UTC
# Line 2  Line 2 
2  ##    $Id$  ##    $Id$
3  ##    --------------------------------------------------------------------------------  ##    --------------------------------------------------------------------------------
4  ##    $Log$  ##    $Log$
5    ##    Revision 1.10  2003/01/19 02:31:51  joko
6    ##    + fix to 'sub AUTOLOAD'
7    ##
8    ##    Revision 1.9  2002/12/19 16:30:23  joko
9    ##    + added 'sub dropDb' and 'sub rebuildDb' as croakers for concrete implementations of methods in proper handlers
10    ##
11  ##    Revision 1.8  2002/12/13 21:48:35  joko  ##    Revision 1.8  2002/12/13 21:48:35  joko
12  ##    + sub _abstract_function  ##    + sub _abstract_function
13  ##  ##
# Line 62  sub new { Line 68  sub new {
68    bless $self, $class;    bless $self, $class;
69  =cut  =cut
70    
71    #=pod
72    # V2 - maybe more convenient/secure? utilizing Damian Conway's Tie::SecureHash...    # V2 - maybe more convenient/secure? utilizing Damian Conway's Tie::SecureHash...
73    my $self = Tie::SecureHash->new(    my $self = Tie::SecureHash->new(
74      $class,      $class,
# Line 86  sub new { Line 92  sub new {
92        #_protected => ,        #_protected => ,
93        #__private => ,        #__private => ,
94    );    );
95    #=cut
96    
97    # 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
98            
# Line 121  sub new { Line 127  sub new {
127  }  }
128    
129    
130    # TODO: use NEXT.pm inside this mechanism (to avoid repetitions...)
131  sub AUTOLOAD {  sub AUTOLOAD {
132    
133    # recursion problem to be avoided here!!!    # recursion problem to be avoided here!!!
# Line 157  sub AUTOLOAD { Line 164  sub AUTOLOAD {
164    #if (!$self->exists('COREHANDLE')) { return; }    #if (!$self->exists('COREHANDLE')) { return; }
165    
166    # handle locking (hack)    # handle locking (hack)
167    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}) {
168      $self->{lock_info}->{log_lock} = 1;      $self->{lock_info}->{log_lock} = 1;
169    } else {    } else {
170      $self->{lock_info}->{log_lock} = 0;      $self->{lock_info}->{log_lock} = 0;
# Line 178  sub AUTOLOAD { Line 185  sub AUTOLOAD {
185    #if (!$self->exists('_COREHANDLE')) {    #if (!$self->exists('_COREHANDLE')) {
186    #if (!$self->{_COREHANDLE}) {    #if (!$self->{_COREHANDLE}) {
187    if (!$core) {    if (!$core) {
188      my $err_msg_core = __PACKAGE__ . "[$self->{metainfo}->{type}]" . ": " . "COREHANDLE is undefined while trying to execute method \"$methodname\"";  
189    #print Dumper($self);    
190    #exit;
191    
192        my $handlertype = $self->{metainfo}->{type};
193        $handlertype ||= '';
194    
195        my $err_msg_core = __PACKAGE__ . "[$handlertype]" . ": " . "COREHANDLE is undefined while trying to execute method \"$methodname\"";
196  print $err_msg_core, "\n";  print $err_msg_core, "\n";
197      if ($self->exists('lock_info') && !$self->{lock_info}->{log_lock}) {      if ($self->exists('lock_info') && !$self->{lock_info}->{log_lock}) {
198        $logger->error( $err_msg_core );        $logger->error( $err_msg_core );
# Line 224  print $err_msg_core, "\n"; Line 238  print $err_msg_core, "\n";
238            
239  #print "calling: $methodname", "\n";  #print "calling: $methodname", "\n";
240            
241      # 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
242      return $core->$methodname(@_);      return $core->$methodname(@_);
243        
244    } elsif ($self->can($methodname)) {    } elsif ($self->can($methodname)) {
245        # try to call specified method inside our or inherited module(s) scope(s)
246      return $self->$methodname(@_);      return $self->$methodname(@_);
247    }    }
248    
# Line 264  sub _typeCheck2 { Line 279  sub _typeCheck2 {
279      my $self = shift;      my $self = shift;
280      my $nodename = shift;      my $nodename = shift;
281      #$nodename = 'TransactionRoutingTable';      #$nodename = 'TransactionRoutingTable';
282      $logger->debug( __PACKAGE__ . "->getChildNode( nodename $nodename )" );      $logger->debug( __PACKAGE__ . "->existsChildNode( nodename $nodename )" );
283      $self->getChildNodes() unless $self->{meta}->{childnodes};      $self->getChildNodes() unless $self->{meta}->{childnodes};
284      my $result = grep(m/$nodename/i, @{$self->{meta}->{childnodes}});     # TODO: use "/i" only on win32-systems!      my $result = grep(m/$nodename/i, @{$self->{meta}->{childnodes}});     # TODO: use "/i" only on win32-systems!
285      return $result;      return $result;
# Line 370  sub _typeCheck2 { Line 385  sub _typeCheck2 {
385      return;      return;
386    }    }
387    
388      sub dropDb {
389        my $self = shift;
390        $self->_abstract_function('dropDb');
391        return;
392      }
393    
394      sub rebuildDb {
395        my $self = shift;
396        $self->_abstract_function('rebuildDb');
397        return;
398      }
399    
400  1;  1;

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.10

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed