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

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
Nik
Forum Contributor
Posts: 138
Joined: Wed Jan 29, 2003 6:02 pm
Location: Thessaloniki, Greece

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

Post 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?
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Post 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.
Nik
Forum Contributor
Posts: 138
Joined: Wed Jan 29, 2003 6:02 pm
Location: Thessaloniki, Greece

Post by Nik »

of course is a web app, i tries to run it and it works ok, it produces html code!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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 ,
Post Reply