The perl script works fine from command line, but the CGI returns 500 error.
#!/usr/bin/perl use Crypt::GPG; use CGI qw(:standard); my $gpg = new Crypt::GPG; $gpg->gpgbin('/usr/bin/gpg'); # The GnuPG executable $to='fake@name.com'; $from= 'fakefake@name.com'; $subject='request'; $ptext = "Primary Applicant:\nOptical Carrier); @ctext = $gpg->encrypt( $ptext, $to ); open(MAIL, "|/usr/sbin/sendmail -t"); print MAIL "To: $to\n"; print MAIL "From: $from\n"; print MAIL "Subject: $subject\n\n"; print MAIL $ctext[0]; close(MAIL); print <<END; Content-Type: text/html; charset=iso-8859-1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html><head> <title>Thank you!</title></head> <body> <h1>Thank you!</h1> <p>Your application received, an encrypted message emailed out to Me:< +br>$ctext[0]<br> You can expect to hear from me soon!</p> </body></html> END
So it works from command line, but gives a 500 error to user via CGI. But if I comment out references to gpg/GPG then the CGO works. So I dont think I have any code errors, it just looks like I have to do something else to enable CGI and crypt::gpg functionality? my hosting platform doesnt provide logs..

In reply to cannot use Crypt::GPG for CGI by opticalcarrier

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.