Debian Codegraph @

Debbugs/DBase/LogEntry.pm

raw
1 # TODO: Implement 'stale' checks, so that there is no need to explicitly
2 # write out a record, before closing.
3
4 package Debbugs::DBase::LogEntry;
5
6 use strict;
7
8 sub new
9 {
10 my $self = {};
11 # $self->{LOG} = new FileHandle;
12 # $self->{AGE} = undef;
13 # $self->{PEERS} = [];
14 $self->{log} = [];
15 $self->{Load} = &Load;
16 bless ($self);
17 return $self;
18 }
19 my %logClass = ();
20 my %logType = ();
21
22 sub Load
23 {
24 my ($self, $handle) = (shift, shift);
25 foreach (keys %$self) {
26 print "key=$_\n";
27 }
28 while (<$handle>) {
29 chomp;
30 my ($char, $class, $type) = ($_, $logClass{ $_ }, $logType{ $_ });
31 my $msg = "";
32 while (<$handle>) {
33 chomp;
34 if ( $_ eq "\3" ) {
35 last;
36 } else {
37 $msg .= "$_\n";
38 }
39 }
40 if( defined($class) ) {
41 print "found handler $type for $char\n";
42 my $log = $class->new($msg);
43
44 my @log = $self->{log};
45 push @log, ($log);
46 } else {
47 print "undefined handler for $char\n";
48 }
49 }
50 }
51
52 BEGIN {
53 use Exporter ();
54 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
55
56 # set the version for version checking
57 $VERSION = 1.00;
58
59 @ISA = qw(Exporter);
60 @EXPORT = qw(new);
61 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
62
63 # your exported package globals go here,
64 # as well as any optionally exported functions
65 @EXPORT_OK = qw();
66
67 }
68
69 1;