Hey, I'm a Perl newbie heh and I was just wondering if any of the people here could give me any feed back, this is a chat program I made, (well the actual program part) it is put into a frame with a page that it appends to that is located outside of my cgi-bin so that perl scripts are'nt executed, any ways here it is lol.
#!/usr/local/bin/perl
use CGI;
use CGI ':standard';
print header;
print start_html('Chat'),
h1('Chat'),
start_form,
"Name ",textfield('name'),
p,
"Say ",textfield('say'),
p,
submit,
end_form,
hr;
if (param()) {
$say=(param('say'));
$name=(param('name'));
$say =~ s/</</g; #Stops user from entering the < in both name
+and speech
$name =~ s/</</g; #Leaves the > allowed, you can't enter HTML w
+ithout <
$say =~ s/!{5}/!/g; #Although this won't take care of all mul
+tiple ! it can reduce
#the number to help avoid multiple lines of just !'s
open CHAT, ">>../chatty2.html";
print CHAT "<h5><i>",$name,": </i><b>",$say,"</b></h5>\n";
close CHAT
}
print end_html;
I'm proably doing a bunch of stuff wrong heh, any feed back you can provide would be helpful, thanks :)
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.