Page 1 of 1

Perl Web App with no html at all! is it able???

Posted: Tue Apr 15, 2003 11:22 am
by Nik
can it be done??

Is this an example of such script???

#!/usr/local/bin/perl

use CGI qw(:standard);

print header;
print start_html('A Simple Example'),
h1('A Simple Example'),
start_form,
"What's your name? ",textfield('name'),
p,
"What's the combination?",
p,
checkbox_group(-name=>'words',
-values=>['eenie','meenie','minie','moe'],
-defaults=>['eenie','minie']),
p,
"What's your favorite color? ",
popup_menu(-name=>'color',
-values=>['red','green','blue','chartreuse']),
p,
submit,
end_form,
hr;

if (param()) {
print
"Your name is",em(param('name')),
p,
"The keywords are: ",em(join(", ",param('words'))),
p,
"Your favorite color is ",em(param('color')),
hr;
}
print end_html;


Although i try to execute it a get errors
can u try it out and tell me if it is a perl web app?

Posted: Tue Apr 15, 2003 12:57 pm
by daven
You have no HTML tags, nor do you have classes/functions to generate them. Web-based output must be formatted with HTML. No tags=no form. Also, print commands should not have line breaks.

So in answer to your question: no, this is not a web app. If you fix it up a bit it will be able to print some plain text, but that is all.

Posted: Fri Apr 18, 2003 3:10 am
by Nik
of course is a web app, i tries to run it and it works ok, it produces html code!

Posted: Fri Apr 18, 2003 4:24 am
by volka
yes, it's possible. Take a look at http://perl.apache.org/docs/tutorials/t ... _beautiful
the CGI-module of perl offers formatting elements of that kind. If used correctly the output is html4.01strict or xhtml1.0 compliant (depending on the version of perl as it seems).

print in perl like echo in php can take multiple arguments separated by ,