#!/usr/bin/perl -w
#
# kjl/29dec2002
#
# count_link.pl
#
#   Returns number of Links pointing to an URL
#
# Usage:
#
#   count_link.pl <URL>
#
# Example:
#
#   count_link.pl http://www.your.site.com/docu.html
#

use DB_File;

#
# path to cache database created by create_db.pl
#
$db_cache = "db.ref_cache";

$CACHE_STAT = tie %cache_hash, 'DB_File', "$db_cache", O_RDONLY, 0666, $DB_HASH
    or die "Can't open DB file $db_cache: $!";

if ($#ARGV == 0) {
    $num = $cache_hash{$ARGV[0]};
    print $num if ($num > 0);
}

#
# Dump everything for debugging
#
#foreach $key (keys %cache_hash) { print $cache_hash {$key}, "\t$key\n" }

undef $CACHE_STAT;
