8 @ISA = qw( HTML::Parser );
15 my $self = SUPER::new $pkg;
17 $self->{state} = 'pre';
18 $self->{sort} = undef;
20 $self->{call} = uc shift;
26 my ($self, $tag, $attr, $attrseq, $origtext) = @_;
28 print "$self->{state} $tag";
30 my $dd = new Data::Dumper([$attr], [qw(attr)]);
34 print " ", $dd->Dumpxs;
38 if ($self->{state} eq 'addr') {
40 $self->{addr} .= ", " if length $self->{addr} > $self->{laddr};
41 $self->{laddr} = length $self->{addr};
42 } elsif ($tag eq 'p') {
43 push @{$self->{list}}, $self->{addr} ? "$self->{call}|addr|$self->{addr}" : "$self->{call}|addr|unknown";
44 $self->state('semail');
46 } elsif ($self->{state} eq 'email') {
48 my $email = $attr->{href};
50 return if $email =~ m{/uedit.html};
51 $email =~ s/mailto://i;
52 push @{$self->{list}}, "$self->{call}|email|$email";
54 } elsif ($tag eq 'br' || $tag eq 'p') {
62 my ($self, $text) = @_;
63 $text =~ s/^[\s\r\n]+//g;
64 $text =~ s/[\s\r\n]+$//g;
65 print "$self->{state} text $text\n" if $self->{debug};
67 if ($self->{state} eq 'pre' && $text =~ /$self->{call}/i ) {
71 } elsif ($self->{state} eq 'addr') {
72 $text =~ s/\ //gi;
73 $self->{addr} .= $text;
74 } elsif ($self->{state} eq 'semail' && $text =~ /Email/i ) {
75 $self->state('email');
83 $self->{state} = shift if @_;
84 return $self->{state};
89 my ($self, $tag, $origtext) = @_;
90 print "$self->{state} /$tag\n" if $self->{debug};
95 my ($self, $val) = @_;
96 $self->{debug} = $val;
102 return @{$self->{list}};