CGI-ContactForm
view release on metacpan or search on metacpan
lib/CGI/ContactForm/MHonArc.pm view on Meta::CPAN
This module makes it easy to use L<CGI::ContactForm|CGI::ContactForm> for
contacting the message authors in a mail archive that was created by the
L<MHonArc|mhonarc> Email-to-HTML converter. Out from the message ID and the path
to the archive, it retrieves the necessary data from the archive database.
The converted messages are supposed to include an HTML form for the purpose, so
you need to set one of the MHonArc page layout resources. This is an example:
<form action="/cgi-bin/mhacontact.pl" method="get">
<input type="hidden" name="msgid" value="$MSGID$">
<input type="hidden" name="outdir" value="$OUTDIR$">
<input type="submit" value="Contact Author">
</form>
The form controls shall be named C<msgid> and C<outdir> (case matters), and their
values are set dynamically via the MHonArc C<$MSGID$> respective C<$OUTDIR$>
resource variables when the messages are converted.
Note that it is a C<GET> request that shall be submitted.
The C<SYNOPSIS> section above is an example of what the CGI script, here named
C<mhacontact.pl>, may contain. The C<getmsgvalues()> function returns a reference
to a hash with the keys C<fromname>, C<fromaddr> and C<subject>, and the hash
values are passed to L<CGI::ContactForm|CGI::ContactForm> when the
C<contactform()> function is called.
lib/CGI/ContactForm/MHonArc.pm view on Meta::CPAN
use Exporter;
@ISA = 'Exporter';
@EXPORT = 'getmsgvalues';
sub getmsgvalues {
local $^W = 1;
my %msg;
if ($ENV{REQUEST_METHOD} eq 'GET') {
my $q = new CGI;
my $id = $q->param('msgid') or CFdie("Message ID is missing.\n");
my %nodot;
@nodot{ qw/MSWin32 dos os2 VMS/ } = ();
my $defaultdb = exists $nodot{$^O} ? 'mhonarc.db' : '.mhonarc.db';
my $dbfile = (shift or $defaultdb);
unless ( File::Spec->file_name_is_absolute($dbfile) ) {
my $outdir = $q->param('outdir')
or CFdie("Path to the archive directory is missing.\n");
$outdir = $1 if $outdir =~ /^([-+@\w.\/\\: \[\]]+)$/;
$dbfile = File::Spec->catfile($outdir, $dbfile);
}
( run in 0.879 second using v1.01-cache-2.11-cpan-5735350b133 )