Hi monks,

I am trying to get a page working using Mason and Mod_Perl2. I have lampp set up, and I was following the examples from the Mason book.

I downloaded Mason using CPAN, and I see Mason is installed successfully with lampp's perl by running the following command and receiving the following output: /opt/lampp/bin/perl /opt/lampp/htdocs/mason/handshake.pl Greetings, Martians

This is the content of the script
#start of script #!/usr/bin/perl use strict; use HTML::Mason; my $interp = HTML::Mason::Interp->new( ); my $comp = $interp->make_component(comp_source => <<'END'); Greetings, <% ("Earthlings", "Martians")[rand 2] %> END $interp->exec($comp); #end of script

But when I try to test the second example in the book, which is creating a html file with only one line:

hi Greetings, <% ("Earthlings", "Martians")[rand 2] %>
lampp is complaining that it doesn't return a header, checking the error_log:
[Sun Mar 25 13:28:31 2012] [error] [client 127.0.0.1] malformed header + from script. Bad header=hi Greetings, Earthlings: handshake3.html [Sun Mar 25 13:28:31 2012] [warn] /mason/handshake3.html did not send +an HTTP header

I have in my httpd.conf the following setup:

PerlModule HTML::Mason::ApacheHandler <Location /mason/handshake3.html> SetHandler perl-script PerlHandler HTML::Mason::ApacheHandler </Location>
I tried adding the DefaultType "text/html" line to the Location directive, but it doesn't change anything.

After a day of googling, the answer still shuns me. Would you kind monks please bless your enlightenment upon me.

In reply to Using Mason with Mod_Perl 2 and getting "did not send an HTTP header" error by beanryu

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.