Please be kind if I am missing something simple, I have almost no experience in Perl.
I was frustrated by the lack of an address bar in my cell phone's mini-browser, so I decided to make a custom homepage on my site and to use a perl script to forward me to the input URL. Here's my form code:
<form action="http://site/cgi-bin/go.cgi" method="GET">
<input type="text" name="browse_url">
<input type="submit">
</form>
And the backend code:
#!/usr/bin/perl
use strict;
use CGI;
my $redirect_url = param('browse_url');
#my $redirect_url = "http://google.com"; #(used for testing)
print "<html><head>";
print "<meta http-equiv=\"refresh\" content=\"10;url=$redirect_url\">"
+;
print "</head><body><a href=\"$redirect_url\">click</a></body></html>\
+n";
My primary problem is that it runs fine on the command line eg.
perl go.cgi but not through apache/mod_perl, it gives an internal server error.
Any advice would be wonderful.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.