#!/usr/bin/perl

use HTML::LinkExtor;

my $filename = 'index.html';
my $base_url = 'http://www.kayos.org/';

$parser = HTML::LinkExtor->new(\&print_the_link, $base_url);
$parser->parse_file($filename);
# @links = $parser->links;


sub print_the_link {
    my ($tag, %links) = @_;
    print "$tag @{[%links]}\n";
}

# foreach $linkarray (@links)
# {
#     my @element = @$linkarray;
#     my $elt_type = shift @element;

#     # possibly test whether this is an element we're interested in
#     while (@element)
#     {
#         #extract the next attribute and its value
#         my ($attr_name, $attr_value) = splice(@element, 0, 2);
#         # ... do something with them ...
#         print "attr_name = $attr_name\n";
#         print "attr_value = $attr_value\n";
#     }
# }
