1#! /usr/bin/perl -w
2#
3# Copyright (c) 2004 Liviu Daia <Liviu.Daia@imar.ro>
4# All rights reserved.
5#
6# $Revision$
7# $Id$
8# $Source$
9#
10
11use HTML::Parser;
12
13use strict;
14use Carp ();
15local $SIG{__WARN__} = \&Carp::cluck;
16
17my ($p, $fn, %a);
18
19
20sub
21html_parse_start ($$)
22{
23  my ($t, $attr) = @_;
24
25  push @{$a{$attr->{name}}}, $fn
26    if ($t eq 'a' and defined $attr->{name});
27}
28
29
30$p = HTML::Parser->new(api_version => 3);
31$p->strict_comment (0);
32$p->report_tags (qw(a));
33$p->ignore_elements (qw(script style));
34
35$p->handler (start => \&html_parse_start, 'tagname, attr');
36
37while ($fn = shift)
38{
39  $p->parse_file ($fn);
40  $p->eof;
41}
42
43for (keys %a)
44{
45  print "$_\t\tdefined in ", (join ', ', @{$a{$_}}), "\n"
46    if (@{$a{$_}} > 1);
47  print "$_\t\tnumerical in ", (join ', ', @{$a{$_}}), "\n"
48    if (m/^[\d.]+$/o);
49}
50
51