package Autobugmail;

use strict;

use Carp;
use Exporter ();

@Autobugmail::ISA = qw(Exporter);
@Autobugmail::EXPORT = qw(MailBug);

sub MailBug {
    my ($mailto) = shift;
    return unless (defined($mailto));
    my $message = Carp::longmess();
    open(Autobugmail::SENDMAIL, "| sendmail $mailto") || return;
    print Autobugmail::SENDMAIL "To: $mailto\n";
    print Autobugmail::SENDMAIL "Subject: Automatic bug message\n\n";
    
    print Autobugmail::SENDMAIL "@_ $message";
    close(Autobugmail::SENDMAIL);
}

1;

=head1 NAME

Autobugmail.pm - Automatically mail bug messages

=head1 SYNOPSIS

use Autobugmail;

&MailBug('bug', "I've found a bug!!");

=head1 DESCRIPTION

MailBug will automatically mail a bug message without worrying the users.
This can be used, for example, to find obsolete bits of code.  The mailed
error message is followed by a long backtrace (the same as produced by
confess) so that the exact location of the bug can be found.

=head1 AUTHOR

Rob Davies

=head1 LOG

S<
# $Log: Autobugmail.pm,v $
# Revision 1.1  1999/01/13  10:40:48  rmd
# Initial revision
#
>
