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

  1. #!/usr/bin/perl -w
  2. # This file was preprocessed, do not edit!
  3.  
  4.  
  5. package Debconf::DbDriver::Debug;
  6. use strict;
  7. use Debconf::Log qw{:all};
  8. use base 'Debconf::DbDriver';
  9.  
  10.  
  11.  
  12. use fields qw(db);
  13.  
  14.  
  15. sub init {
  16.     my $this=shift;
  17.  
  18.     if (! ref $this->{db}) {
  19.         $this->{db}=$this->driver($this->{db});
  20.         unless (defined $this->{db}) {
  21.             $this->error("could not find db");
  22.         }
  23.     }
  24. }
  25.  
  26. sub DESTROY {}
  27.  
  28. sub AUTOLOAD {
  29.     my $this=shift;
  30.     (my $command = our $AUTOLOAD) =~ s/.*://;
  31.  
  32.     debug "db $this->{name}" => "running $command(".join(",", map { "'$_'" } @_).") ..";
  33.     if (wantarray) {
  34.         my @ret=$this->{db}->$command(@_);
  35.         debug "db $this->{name}" => "$command returned (".join(", ", @ret).")";
  36.         return @ret if @ret;
  37.     }
  38.     else {
  39.         my $ret=$this->{db}->$command(@_);
  40.         if (defined $ret) {
  41.             debug "db $this->{name}" => "$command returned \'$ret\'";
  42.             return $ret;
  43.         }
  44.         else  {
  45.             debug "db $this->{name}" => "$command returned undef";
  46.         }
  47.     }
  48.     return; # failure
  49. }
  50.  
  51.  
  52. 1
  53.