Is this the way it is printed in your book? Did they switch q and p all over
the book?


"Bruno Negrao - Perl List" <[EMAIL PROTECTED]> wrote in message
001e01c26ba7$4b219e00$5100a8c0@egp">news:001e01c26ba7$4b219e00$5100a8c0@egp...
> Hi all, the problem is that the script is really erroneous. Where you read
> "q(..." should be "p( ..."
> The p() function is a part of the CGI.pm modules and stands for a new
> paragraph.
>
> the right script is:
> #!/usr/bin/perl -w
> # cgi-bin/ice_cream: program to answer *and generate* ice cream
> # favorite flavor form (version 3)
> use CGI qw(:standard);
> my $favorite = param("flavor");
> print header, start_html("Hello Ice Cream"), h1("Hello Ice Cream");
> if ($favorite) {
>     print p("Your favorite flavor is $favorite.");
> } else {
>     print hr, start_form; # hr() emits html horizontal rule: <HR>
>     print p("Please select a flavor: ", textfield("flavor","mint"));
>     print end_form, hr;
> }
>
>
> Thanks,
> bnegrao.
>
>
> ----- Original Message -----
> From: "Richard Krause" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, October 04, 2002 6:07 AM
> Subject: Re: CGI simple but not working
>
>
> > Hi Bruno
> >
> > It's the "print q"-Statement, if you write it like this, it works:
> >
> > #!/usr/bin/perl -w
> >
> > use diagnostics;
> > use strict;
> > use CGI qw(:standard);
> >
> > my $favorite = param("flavor");
> > print header, start_html("Hello Ice Cream"), h1("Hello Ice Cream");
> > if ($favorite) {
> >     print q("Your favorite flavor is $favorite.");
> > } else {
> >     print start_form,
> >     "Please select a flavor: ", textfield("flavor","mint");
> >     print end_form, hr;
> > };
> > exit;
> >
> > I'm new to perl myself, so haven't found out why textfields aren't
working
> > with "print q". Please let me know if you find out.
> >
> > Best Regards
> > Richard
> >
> >
> >
> > "Bruno Negrao - Perl List" <[EMAIL PROTECTED]> wrote in message
> > 006d01c26b41$fa4d2040$5100a8c0@egp">news:006d01c26b41$fa4d2040$5100a8c0@egp...
> > > Hi all,
> > > I'm studying the "Learning Perl Second Edition" and I'm learning cgi
> now.
> > >
> > > The book presents a sample cgi that doesn't produces the expected
result
> > as
> > > the book says it would. In sumary, this script should generate an one
> > field
> > > form with a default value - "mint". But what appears in the screen are
> the
> > > strings inside the "q()" function.
> > >
> > > Could someone test it and say to me if there is something wrong?
> > >
> > > The following script was retired from the section 19.6  "Form
> Generation".
> > > #!/usr/bin/perl -w
> > > # cgi-bin/ice_cream: program to answer *and generate* ice cream
> > > # favorite flavor form (version 3)
> > > use CGI qw(:standard);
> > > my $favorite = param("flavor");
> > > print header, start_html("Hello Ice Cream"), h1("Hello Ice Cream");
> > > if ($favorite) {
> > >     print q("Your favorite flavor is $favorite.");
> > > } else {
> > >     print hr, start_form; # hr() emits html horizontal rule: <HR>
> > >     print q("Please select a flavor: ", textfield("flavor","mint"));
> > >     print end_form, hr;
> > > }
> > >
> > > I'm running Redhat 6.2 perl version 5.005_03 built for i386-linux
> > > But i tested this script with RH7.2 v5.6.0 built for i386-linux and it
> > > doesn't work too
> > >
> > > Thanks for any help,
> > > -------------------------------------------------
> > >  -- Bruno Negrão -- Suporte
> > >  -- Plugway Acesso Internet Ltda.
> > >  -- (31)34812311
> > >
> >
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to