in reply to CGI:Application and HTML::Template parameter passing
the problem is that you are using numeric comparison (==) when you need string comparison (eq), so the contents of $q->param('userid') always evaluates to true regardless if it's empty or not. change your code like this:
if ($q->param('userid') eq '') { $self->_create_user(); } else { $self->_update_user(); }
see also the tutorials here on PerlMonks that cover the various ways Perl test for true/false.
also here is how you could debug input parameter passing in your CGI::Application modules:
sub maintain_user { my $self = shift; my $q = $self->query; use Data::Dumper; return Dumper $q; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: CGI:Application and HTML::Template parameter passing
by meraxes (Friar) on Sep 03, 2007 at 01:14 UTC |