Digioso has asked for the wisdom of the Perl Monks concerning the following question:
Heya Monks,
this may be just a stupid question but I couldn't find any solution for it so far... Basically I have a HTML form with a textarea you can copy anything you like into. The text is transferred via post method and then I want it to be displayed. So far so easy... But now I copy for example something like a whole Perl Script into the textarea. After clicking on submit Perl now starts to execute the contents of the textarea. My question is: How can I just display the text without Perl trying to execute it? Basically... how did they do it on this very website here with the \<code\> tags?
Just try using the sample script and copy the source code of the sample script into the textarea field in your browser.
Sample script:
this may be just a stupid question but I couldn't find any solution for it so far... Basically I have a HTML form with a textarea you can copy anything you like into. The text is transferred via post method and then I want it to be displayed. So far so easy... But now I copy for example something like a whole Perl Script into the textarea. After clicking on submit Perl now starts to execute the contents of the textarea. My question is: How can I just display the text without Perl trying to execute it? Basically... how did they do it on this very website here with the \<code\> tags?
Just try using the sample script and copy the source code of the sample script into the textarea field in your browser.
Sample script:
#!/usr/bin/perl -w use warnings; use strict; use CGI; use CGI::Carp qw/fatalsToBrowser warningsToBrowser/; my $cgi = CGI->new(); print $cgi->header, # create the HTTP header $cgi->start_html(-title=>"Test", -author=>'webmaster at digioso.org'); if($ENV{'REQUEST_METHOD'} eq 'GET') { print qq{<form action = "textareatest.pl" name = "form" method = " +post"> <textarea name = "text" cols = "50" rows = "10"></text +area><br/> <input type = "submit"/> </form>}; } elsif($ENV{'REQUEST_METHOD'} eq 'POST') { my $text = $cgi->param('text'); print qq{$text<br/>}; } else { print "Unknown request method!<br/>"; } print "</body></html>"; exit 0;
|
---|
Back to
Seekers of Perl Wisdom