home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / perl5 / Debconf / DbDriver / Backup.pm next >
Encoding:
Perl POD Document  |  2006-07-24  |  1.6 KB  |  82 lines

  1. #!/usr/bin/perl -w
  2. # This file was preprocessed, do not edit!
  3.  
  4.  
  5. package Debconf::DbDriver::Backup;
  6. use strict;
  7. use Debconf::Log qw{:all};
  8. use base 'Debconf::DbDriver::Copy';
  9.  
  10.  
  11.  
  12. use fields qw(db backupdb);
  13.  
  14.  
  15. sub init {
  16.     my $this=shift;
  17.  
  18.     foreach my $f (qw(db backupdb)) {
  19.         if (! ref $this->{$f}) {
  20.             my $db=$this->driver($this->{$f});
  21.             unless (defined $f) {
  22.                 $this->error("could not find a db named \"$this->{$f}\"");
  23.             }
  24.             $this->{$f}=$db;
  25.         }
  26.     }
  27. }
  28.  
  29.  
  30. sub copy {
  31.     my $this=shift;
  32.     my $item=shift;
  33.  
  34.     $this->SUPER::copy($item, $this->{db}, $this->{backupdb});
  35. }
  36.  
  37.  
  38. sub shutdown {
  39.     my $this=shift;
  40.     
  41.     $this->{backupdb}->shutdown(@_);
  42.     $this->{db}->shutdown(@_);
  43. }
  44.  
  45. sub _query {
  46.     my $this=shift;
  47.     my $command=shift;
  48.     shift; # this again
  49.     
  50.     return $this->{db}->$command(@_);
  51. }
  52.  
  53. sub _change {
  54.     my $this=shift;
  55.     my $command=shift;
  56.     shift; # this again
  57.  
  58.     my $ret=$this->{db}->$command(@_);
  59.     if (defined $ret) {
  60.         $this->{backupdb}->$command(@_);
  61.     }
  62.     return $ret;
  63. }
  64.  
  65. sub iterator    { $_[0]->_query('iterator', @_)        }
  66. sub exists    { $_[0]->_query('exists', @_)        }
  67. sub addowner    { $_[0]->_change('addowner', @_)    }
  68. sub removeowner { $_[0]->_change('removeowner', @_)    }
  69. sub owners    { $_[0]->_query('owners', @_)        }
  70. sub getfield    { $_[0]->_query('getfield', @_)        }
  71. sub setfield    { $_[0]->_change('setfield', @_)    }
  72. sub fields    { $_[0]->_query('fields', @_)        }
  73. sub getflag    { $_[0]->_query('getflag', @_)        }
  74. sub setflag    { $_[0]->_change('setflag', @_)        }
  75. sub flags    { $_[0]->_query('flags', @_)        }
  76. sub getvariable { $_[0]->_query('getvariable', @_)    }
  77. sub setvariable { $_[0]->_change('setvariable', @_)    }
  78. sub variables    { $_[0]->_query('variables', @_)    }
  79.  
  80.  
  81. 1
  82.