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

Diff of /nfo/perl/libs/Data/Storage/Locator.pm

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

revision 1.1 by cvsjoko, Thu Oct 10 03:43:53 2002 UTC revision 1.3 by joko, Sun Nov 17 06:24:28 2002 UTC
# Line 1  Line 1 
1  #################################  #################################
2  #  #
3  #  $Id$  #  $Id$
4  #  #
5  #  $Log$  #  $Log$
6    #  Revision 1.3  2002/11/17 06:24:28  joko
7    #  + deep merge of arguments in case of ref HASH
8    #
9    #  Revision 1.2  2002/10/17 00:06:16  joko
10    #  + advanced constructor argument shift-in
11    #
12  #  Revision 1.1  2002/10/10 03:43:53  cvsjoko  #  Revision 1.1  2002/10/10 03:43:53  cvsjoko
13  #  + new  #  + new
14  #  #
# Line 10  Line 16 
16  #################################  #################################
17    
18  package Data::Storage::Locator;  package Data::Storage::Locator;
19    
20  use strict;  use strict;
21  use warnings;  use warnings;
22    
23  # get logger instance  # get logger instance
24  my $logger = Log::Dispatch::Config->instance;  my $logger = Log::Dispatch::Config->instance;
25    
26  sub new {  use Data::Dumper;
27    my $invocant = shift;  
28    my $class = ref($invocant) || $invocant;  
29    my $self = { @_ };  sub new {
30    $logger->debug( __PACKAGE__ . "->new(@_)" );    my $invocant = shift;
31    return bless $self, $class;    my $class = ref($invocant) || $invocant;
32  }  
33      # get constructor arguments
34  sub native {    my @args = ();
35    my $self = shift;    @_ && (@args = @_);
36    my $arg = shift;    $logger->debug( __PACKAGE__ . "->new( @args )" );
37    if ($arg) {  
38      $self->{native} = $arg;    my $self = {};
39      #$self->_native2abstract();    bless $self, $class;
40    } else {  
41      return $self->{native};  #print "dump: ", Dumper(@_), "\n";
42    }    #my $self = { @_ };
43  }    foreach (@_) {
44        my $elem = $_;
45  sub _native2abstract {      if (ref($elem) eq 'HASH') {
46    my $self = shift;        foreach (keys %$elem) {
47              $self->{$_} = $elem->{$_};
48  }        }
49        }
50  sub _abstract2native {    }
51    my $self = shift;    
52  }    return $self;
53    }
54  1;  
55    sub native {
56      my $self = shift;
57      my $arg = shift;
58      if ($arg) {
59        $self->{native} = $arg;
60        #$self->_native2abstract();
61      } else {
62        return $self->{native};
63      }
64    }
65    
66    sub _native2abstract {
67      my $self = shift;
68      
69    }
70    
71    sub _abstract2native {
72      my $self = shift;
73    }
74    
75    1;

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

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