]> git.donarmstrong.com Git - debbugs.git/blob - debbugs-dump
[project @ 2000-03-21 00:26:35 by gecko]
[debbugs.git] / debbugs-dump
1 #!/usr/bin/perl -w
2
3 push(@INC,'/home/gecko/debian/debvote');
4 use strict;
5 use Debbugs::Config qw(%Globals &ParseConfigFile);
6 #use Debvote::Email qw(&InitEmailTags &LoadEmail &ProcessTags %gtags);
7 use Debbugs::DBase;
8 use Getopt::Long;
9
10 #############################################################################
11 #  Customization Variables
12 #############################################################################
13
14 #############################################################################
15 #  Gloabal Variable Declaration
16 #############################################################################
17 my $VERSION = '3.01';                                           #External Version number
18 my $BANNER = "DebBugs v$VERSION";                       #Version Banner - text form
19 my $FILE = 'debbugs-dump';                                      #File name
20 my $config = '';
21 my @config = undef;
22
23 #############################################################################
24 #  Commandline parsing
25 #############################################################################
26 # Hash used to process commandline options
27 my $verbose = 0;
28 my $quiet = 0;
29 my $debug = 0;
30 my %opthash = (# ------------------ actions
31     "config|c=s" => \$config,
32     "help|h" => \&syntax,
33     "version|V" => \&banner,
34     "verbose|v!" => \$verbose,
35     "quiet|q!" => \$quiet,
36     "debug|d+" => \$debug,     # Count the -d flags
37     );
38 Getopt::Long::config('bundling', 'no_getopt_compat', 'no_auto_abbrev');
39 GetOptions(%opthash) or &syntax( 1 );
40 if ( $debug > 1 )
41 {       print "D2: Commandline:\n";
42         print "\tconfig = $config\n" unless $config eq '';
43         print "\tverbos\n" if $verbose;
44         print "\tquiet\n" if $quiet;
45         print "\tdebug  = $debug\n";
46 }
47 $Globals{ 'debug' } = $debug;
48 $Globals{ 'quiet' } = $quiet;
49 $Globals{ 'verbose' } = $verbose;
50
51 #############################################################################
52 #  Read Config File and parse
53 #############################################################################
54 $config = "./debbugs.cfg" if( $config eq '' );
55 print "D1: config file=$config\n" if $Globals{ 'debug' };
56 @config = ParseConfigFile( $config );
57
58 ## Put Real Code Here
59
60 Debbugs::DBase::ReadRecord( "59999" );
61 foreach my $key ( keys( %Record ) )
62 {
63     print "Key= $key   Value = ". $Record{ "$key" } . "\n";
64 }
65 Debbugs::DBase::ReadRecord( "60000" );
66 foreach my $key ( keys( %Record ) )
67 {
68     print "Key= $key   Value = ". $Record{ "$key" } . "\n";
69 }
70
71
72 #############################################################################
73 #  Ack Back
74 #############################################################################
75
76 sub syntax {
77   print "$BANNER\n";
78   print <<"EOT-EOT-EOT";
79 Syntax: $FILE [options]
80     -c, --config CFGFILE      read CFGFILE for configuration (default=./debvote.cfg)
81     -h, --help                display this help text
82     -v, --verbose             verbose messages
83     -q, --quiet               cancels verbose in a config file
84     -V, --version             display Debvote version and exit
85     -d, --debug               turn debug messages ON (multiple -d for more verbose)
86 EOT-EOT-EOT
87
88   exit $_[0];
89 }