8 @ISA = qw( HTML::Parser );
16 my $self = SUPER::new $pkg;
18 $self->{state} = 'pre';
19 $self->{sort} = undef;
21 $self->{call} = uc shift;
27 my ($self, $tag, $attr, $attrseq, $origtext) = @_;
29 print "$self->{state} $tag";
31 my $dd = new Data::Dumper([$attr], [qw(attr)]);
35 print " ", $dd->Dumpxs;
39 if ($self->{state} eq 'addr') {
41 $self->{addr} .= ", " if length $self->{addr} > $self->{laddr};
42 $self->{laddr} = length $self->{addr};
43 } elsif ($tag eq 'p') {
44 push @{$self->{list}}, $self->{addr} ? "$self->{call}|addr|$self->{addr}" : "$self->{call}|addr|unknown";
45 $self->state('semail');
47 } elsif ($self->{state} eq 'email') {
49 my $email = $attr->{href};
51 return if $email =~ m{/uedit.html};
52 $email =~ s/mailto://i;
53 push @{$self->{list}}, "$self->{call}|email|$email";
55 } elsif ($tag eq 'br' || $tag eq 'p') {
63 my ($self, $text) = @_;
64 $text =~ s/^[\s\r\n]+//g;
65 $text =~ s/[\s\r\n]+$//g;
66 print "$self->{state} text $text\n" if $self->{debug};
68 if ($self->{state} eq 'pre' && $text =~ /$self->{call}/i ) {
72 } elsif ($self->{state} eq 'addr') {
73 $text =~ s/\ //gi;
74 $self->{addr} .= $text;
75 } elsif ($self->{state} eq 'semail' && $text =~ /Email/i ) {
76 $self->state('email');
84 $self->{state} = shift if @_;
85 return $self->{state};
90 my ($self, $tag, $origtext) = @_;
91 print "$self->{state} /$tag\n" if $self->{debug};
96 my ($self, $val) = @_;
97 $self->{debug} = $val;
103 return @{$self->{list}};