Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

bareword problems

by Anonymous Monk
on Aug 05, 2003 at 19:07 UTC ( [id://281125]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Bareword 'end_form' not allowed when under strict subs. Then when I put single quotes around it the error goes away but the form or table doesn't print. What's wrong with it?
print start_form(-action=>'mail.pl'), table( Tr( td("Name"), td( textfield( -name => 'name') ) ), Tr( td("age:"), td( textfield( -name => 'age') ) ), Tr( td( submit('send') ), ), 'end_form', );

Replies are listed 'Best First'.
Re: bareword problems
by dws (Chancellor) on Aug 05, 2003 at 19:15 UTC
    Bareword 'end_form' not allowed when under strict subs.

    Remove the single quotes and slap a pair of parentheses on it so that Perl knows that it's a function call.    end_form() should do the trick.

    You've got some extra commas in there, but I don't think they're anything more than a style problem.

Re: bareword problems
by Mr. Muskrat (Canon) on Aug 05, 2003 at 19:16 UTC

    How are you loading the CGI module? It works fine for me with: use CGI qw(:standard);

    use warnings; use strict; use CGI qw(:standard); print start_form(-action=>'mail.pl'), table( Tr( td("Name"), td( textfield( -name => 'name') ) ), Tr( td("age:"), td( textfield( -name => 'age') ) ), Tr( td( submit('send') ), ), end_form, );

Re: bareword problems
by chromatic (Archbishop) on Aug 05, 2003 at 19:16 UTC

    It's a subroutine call. Use end_form(), with the empty argument list.

Re: bareword problems
by Wonko the sane (Deacon) on Aug 05, 2003 at 19:19 UTC
    To Perl that sort of looks like a bareword, you need to give a bit more of a hint on what your trying to do.

    Change it to:

    end_form(),
    and that should fix your problem.
    Wonko

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://281125]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-20 04:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found