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

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

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

revision 1.10 by joko, Sat Dec 7 03:37:23 2002 UTC revision 1.12 by joko, Thu Dec 12 02:50:15 2002 UTC
# Line 7  Line 7 
7  ############################################  ############################################
8  #  #
9  #  $Log$  #  $Log$
10    #  Revision 1.12  2002/12/12 02:50:15  joko
11    #  + this now (unfortunately) needs DBI for some helper functions
12    #  + TODO: these have to be refactored to another scope! (soon!)
13    #
14    #  Revision 1.11  2002/12/11 06:53:19  joko
15    #  + updated pod
16    #
17  #  Revision 1.10  2002/12/07 03:37:23  joko  #  Revision 1.10  2002/12/07 03:37:23  joko
18  #  + updated pod  #  + updated pod
19  #  #
# Line 53  BEGIN { Line 60  BEGIN {
60    
61  =head1 NAME  =head1 NAME
62    
63  Data::Storage - Interface for accessing various Storage implementations for Perl in an independent way    Data::Storage - Interface for accessing various Storage implementations for Perl in an independent way
64    
65    
66  =head1 AIMS  =head1 AIMS
# Line 167  Data::Storage - Interface for accessing Line 174  Data::Storage - Interface for accessing
174    
175  =head2 NOTE  =head2 NOTE
176    
177  This module heavily relies on DBI and Tangram, but adds a lot of additional bugs and quirks.    This module heavily relies on DBI and Tangram, but adds a lot of additional bugs and quirks.
178  Please look at their documentation and/or this code for additional information.    Please look at their documentation and/or this code for additional information.
179    
180    
181  =head1 REQUIREMENTS  =head1 REQUIREMENTS
# Line 196  use warnings; Line 203  use warnings;
203  use Data::Storage::Locator;  use Data::Storage::Locator;
204  use Data::Dumper;  use Data::Dumper;
205    
206    # TODO: wipe out!
207    use DBI;
208    
209  # TODO: actually implement level (integrate with Log::Dispatch)  # TODO: actually implement level (integrate with Log::Dispatch)
210  my $TRACELEVEL = 0;  my $TRACELEVEL = 0;
211    
# Line 361  sub getDbName { Line 371  sub getDbName {
371    return $database_name;    return $database_name;
372  }  }
373    
374    sub testAvailability {
375      my $self = shift;
376      my $status = $self->testDsn();
377      $self->{locator}->{status}->{available} = $status;
378      return $status;
379    }
380    
381    sub isConnected {
382      my $self = shift;
383      # TODO: REVIEW!
384      return 1 if $self->{STORAGEHANDLE};
385    }
386    
387  sub testDsn {  sub testDsn {
388    my $self = shift;    my $self = shift;
389    my $dsn = $self->{locator}->{dbi}->{dsn};    my $dsn = $self->{locator}->{dbi}->{dsn};
# Line 378  sub testDsn { Line 401  sub testDsn {
401    }    }
402  }  }
403    
 sub testAvailability {  
   my $self = shift;  
   my $status = $self->testDsn();  
   $self->{locator}->{status}->{available} = $status;  
   return $status;  
 }  
   
   
404  sub dropDb {  sub dropDb {
405    my $self = shift;    my $self = shift;
406    my $dsn = $self->{locator}->{dbi}->{dsn};    my $dsn = $self->{locator}->{dbi}->{dsn};
# Line 413  sub dropDb { Line 428  sub dropDb {
428    return $ok;    return $ok;
429  }  }
430    
 sub isConnected {  
   my $self = shift;  
   return 1 if $self->{STORAGEHANDLE};  
 }  
   
431  1;  1;
432  __END__  __END__
433    
434    
435  =head1 DESCRIPTION  =head1 DESCRIPTION
436    
437  Data::Storage is a module for accessing various "data structures" stored inside  =head2 Data::Storage
 various "data containers". It sits on top of DBI and/or Tangram.  
438    
439      Data::Storage is a module for accessing various "data structures / kinds of structured data" stored inside
440      various "data containers".
441      We tried to use the AdapterPattern (http://c2.com/cgi/wiki?AdapterPattern) to implement a wrapper-layer
442      around core CPAN modules (Tangram, DBI).
443    
444    =head2 Why?
445    
446      You will get a better code-structure (not bad for later maintenance) in growing Perl code projects,
447      especially when using multiple database connections at the same time.
448      You will be able to switch between different _kinds_ of implementations used for storing data.
449      Your code will use the very same API to access these storage layers.
450          ... implementation has to be changed for now
451      Maybe you will be able to switch "on-the-fly" without changing any bits in code in the future....
452          ... but that's not the focus
453    
454  =head1 AUTHORS / COPYRIGHT  =head2 What else?
455    
456      Having this, we were able to do implement a generic data synchronization module more easy,
457      please look at Data::Transfer.
458    
 The Data::Storage module is Copyright (c) 2002 Andreas Motl.  
 All rights reserved.  
459    
460  You may distribute it under the terms of either the GNU General Public  =head1 AUTHORS / COPYRIGHT
461  License or the Artistic License, as specified in the Perl README file.  
462      The Data::Storage module is Copyright (c) 2002 Andreas Motl.
463      All rights reserved.
464      You may distribute it under the terms of either the GNU General Public
465      License or the Artistic License, as specified in the Perl README file.
466    
467    
468  =head1 ACKNOWLEDGEMENTS  =head1 ACKNOWLEDGEMENTS
469    
470  Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and Set::Object,    Larry Wall for Perl, Tim Bunce for DBI, Jean-Louis Leroy for Tangram and Set::Object,
471  Sam Vilain for Class::Tangram, Jochen Wiedmann and Jeff Zucker for DBD::CSV and related,    Sam Vilain for Class::Tangram, Jochen Wiedmann and Jeff Zucker for DBD::CSV & Co.,
472  Adam Spiers for MySQL::Diff and all contributors.    Adam Spiers for MySQL::Diff and all contributors.
473    
474    
475  =head1 SUPPORT / WARRANTY  =head1 SUPPORT / WARRANTY
476    
477  Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.    Data::Storage is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.
478    
479    
480  =head1 TODO  =head1 TODO

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

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