Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: HTML::Template error message

by bassplayer (Monsignor)
on Jun 22, 2004 at 16:49 UTC ( #368784=note: print w/ replies, xml ) Need Help??


in reply to HTML::Template error message

$tmpl_obj->param( LOGIN_URL => '/cgi-bin/Auth/Auth.cgi', EMAIL => $cgi->param('email'), PASSWD => '', RM => $nextrm, );


In this code snippet, you are passing a hash to the param() method. The error is due to the fact that one of your variables is undefined (or is a list, as Sidhekin points out below). Check the values of $cgi->param('email') and $nextrm to ensure that they are populated properly before passing the hash.

Update: Here's a related node.

bassplayer


Comment on Re: HTML::Template error message
Select or Download Code
Re^2: HTML::Template error message
by Anonymous Monk on Jun 22, 2004 at 17:06 UTC
    Actually, the problem is that HTML::Template (whether or not it has anything to do with CGI::Application, I don't know) doesn't like:
    EMAIL => $cgi->param('email'),
    I changed it to:
    EMAIL => $email,
    and it works fine now. However, it seems to me that the original version should work. Why doesn't it interpolate correctly? I ran into a similar interpolation problem on one of my other template pages in the same application.

      Why are you passing the CGI parameters back to the template like that. Just use

      my $cgi = CGI->new(); my $template = HTML::Template->new( filename => 'foo.tmpl', associate => $cgi, );
      when you instantiate the H::T object instead. Of course, you have to take care with multiple values, as usual. Check out the HTML::Template Tutorial if you already haven't and good luck. :)

      UPDATE: I suppose i should post the relevant CGI::Application code instead :O

      my $tmpl_obj = $webapp->load_tmpl('some_other.tmpl', associate => $cgi, );

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)
      
      Because $cgi->param(x) in list returns an empty list. In scalar context it returns undef. So when you include it in the H::T->param call, it's in list context and effectively doesn't exist. When you assign it to a scalar first you get undef, which is an item in the list.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://368784]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2014-07-24 04:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (157 votes), past polls