#!/usr/bin/perl -w
# $Id: p0rn-dbdel,v 1.6 2004/05/26 09:00:47 mitch Exp $
#
# remove links from p0rn.db
#
# 2004 (C) by Christian Garbs <mitch@cgarbs.de>
# Licensed under GNU GPL.  See COPYING for details.

use strict;
use P0rn::DB;

=head1 NAME

p0rn-dbdel - remove links from the p0rn database

=head1 SYNOPSIS

B<p0rn-dbdel> I<table>

=head1 OVERVIEW

p0rn-dbdel removes links from the p0rn database.  There should be no need
to call this program directly.

=head1 DESCRIPTION

You must set the table name upon startup.  Existing database tables
are B<thumbz> for thumbnails, B<picz> for pictures and B<downz> for
download urls.  Links are then read from STDIN and removed from the
database.

=head1 DATA FORMAT

Format is one plain URL per line with no leading or trailing
whitespace.

=head1 FILES

All data is stored in a database.  By default, it is located in
B<./p0rn.db> (yes, that's the directory from which you're starting
p0rn-dbdel).  Is you want to change this, set the environment variable
B<P0RNDBLOCATION> (the second letter is a zero) to another path and
filename.

=head1 SEE ALSO

L<p0rn-proxy(1)>, L<p0rn-download(1)>, L<p0rn-dbdump(1)>, L<p0rn-dbrestore(1)>

=head1 MODULES NEEDED

 use DBM::Deep;

This module can be obtained from L<http://www.cpan.org>.

=head1 BUGS

Please report bugs by mail to <F<p0rn-bugs@cgarbs.de>>.

=head1 AUTHOR

p0rn-dbdel was written by Christian Garbs <F<mitch@cgarbs.de>>.

=head1 AVAILABILITY

Look for updates at L<http://www.cgarbs.de/p0rn-comfort.en.html>.

=head1 COPYRIGHT

p0rn-dbdel is licensed under the GNU GPL.

=cut

my $hash = opendb(shift);

while (my $line = <>) {
    chomp $line;
    $line =~ s/\?.*$//;
    delete $hash->{$line};
}
