/[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.13 by joko, Thu Jan 30 22:27:05 2003 UTC revision 1.16 by joko, Fri Apr 18 16:07:53 2003 UTC
# Line 2  Line 2 
2  ##    $Id$  ##    $Id$
3  ##    ------------------------------------------------------------------------  ##    ------------------------------------------------------------------------
4  ##    $Log$  ##    $Log$
5    ##    Revision 1.16  2003/04/18 16:07:53  joko
6    ##    just use logger if instantiation successed
7    ##
8    ##    Revision 1.15  2003/02/20 20:19:13  joko
9    ##    tried to get auto-disconnect working again - failed with that
10    ##
11    ##    Revision 1.14  2003/02/09 05:12:28  joko
12    ##    + quoting of strings used in sql-queries!
13    ##
14  ##    Revision 1.13  2003/01/30 22:27:05  joko  ##    Revision 1.13  2003/01/30 22:27:05  joko
15  ##    + added new abstract methods  ##    + added new abstract methods
16  ##  ##
# Line 58  use base qw( DesignPattern::Object ); Line 67  use base qw( DesignPattern::Object );
67  use Data::Dumper;  use Data::Dumper;
68  use Tie::SecureHash;  use Tie::SecureHash;
69  #use Data::Storage::Handler;  #use Data::Storage::Handler;
70  use Data::Transform::Deep qw( merge );  use Hash::Merge qw( merge );
71    
72    #use Log::Dispatch::Config;
73    #Log::Dispatch::Config->configure();
74    
75  # get logger instance  # get logger instance
76  my $logger = Log::Dispatch::Config->instance;  my $logger;
77    eval('$logger = Log::Dispatch::Config->instance;');
78    
79  #our $lock_info;  #our $lock_info;
80    
# Line 71  sub new { Line 83  sub new {
83    my $class = ref($invocant) || $invocant;    my $class = ref($invocant) || $invocant;
84        
85    # logging info about the actual handler called    # logging info about the actual handler called
86      $logger->debug( "$invocant->new( @_ )" );      $logger->debug( "$invocant->new( @_ )" ) if $logger;
87      #$logger->debug( __PACKAGE__ . "->" . "new()" );      #$logger->debug( __PACKAGE__ . "->" . "new()" );
88    
89    # V1 - arguments become properties automagically / normal perl mode blessing    # V1 - arguments become properties automagically / normal perl mode blessing
# Line 277  sub AUTOLOAD { Line 289  sub AUTOLOAD {
289    
290  sub DESTROY {  sub DESTROY {
291    my $self = shift;    my $self = shift;
292    #if ($self->{COREHANDLE}) {  
293    if ($self->exists('_COREHANDLE')) {  return;
294    
295      $logger->debug( __PACKAGE__ . "[$self->{metainfo}->{type}]" . "->DESTROY" );
296    
297      my $disconnectMethod = $self->{metainfo}->{disconnectMethod};
298      print "meth: ", $disconnectMethod, "\n";
299      
300      #$disconnectMethod && $self->{_COREHANDLE} && ( $self->{_COREHANDLE}->$disconnectMethod() );
301      $self->{_COREHANDLE}->$disconnectMethod();
302      #$self->$disconnectMethod();
303    
304      #my $core1 = $self->getCOREHANDLE() if $self->can('getCOREHANDLE');
305      #$core1->$disconnectMethod();
306    
307    return;
308    
309      print "DESTROY-1", "\n";
310      #if ($self->{__COREHANDLE}) {
311      #if ($self->exists('_COREHANDLE')) {
312    
313      # get corehandle instance from underlying handler
314      my $core;
315      $core = $self->getCOREHANDLE() if $self->can('getCOREHANDLE');
316    
317      #if ($self->{STORAGEHANDLE}) {
318      if ($core) {
319        print "DESTROY-2", "\n";
320      $logger->debug( __PACKAGE__ . "[$self->{metainfo}->{type}]" . "->DESTROY" );      $logger->debug( __PACKAGE__ . "[$self->{metainfo}->{type}]" . "->DESTROY" );
321    
322      my $disconnectMethod = $self->{metainfo}->{disconnectMethod};      my $disconnectMethod = $self->{metainfo}->{disconnectMethod};
# Line 305  sub _typeCheck2 { Line 343  sub _typeCheck2 {
343    sub existsChildNode {    sub existsChildNode {
344      my $self = shift;      my $self = shift;
345      my $nodename = shift;      my $nodename = shift;
346      #$nodename = 'TransactionRoutingTable';  
347      $logger->debug( __PACKAGE__ . "->existsChildNode( nodename $nodename )" );      # TODO: don't use $self->{meta}->{childnodes} directly in here
348        # get it returned from $self->getChildNodes()!!!
349    
350        $logger->debug( __PACKAGE__ . "->existsChildNode( nodename=$nodename )" );
351      $self->getChildNodes() unless $self->{meta}->{childnodes};      $self->getChildNodes() unless $self->{meta}->{childnodes};
352      my $result = grep(m/$nodename/i, @{$self->{meta}->{childnodes}});     # TODO: use "/i" only on win32-systems!  
353        # quote this, it might contain meta characters which don't work in a regex
354          $nodename = quotemeta($nodename);
355    
356        # trace
357          #print Dumper($self->{meta});
358          #print "nodename: $nodename", "\n";
359        
360        # FIXME: use "/i" only on win32-systems!
361        my $result = grep(m/$nodename/i, @{$self->{meta}->{childnodes}});
362        
363      return $result;      return $result;
364    }    }
365    

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.16

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