What's happening is that the $param method
is returning a null list in this case, not undef.
This null list results in nothing being
passed to bind_param from $q->param('id').
The reason that it's doing this is that it's being
called in list context being in
an argument list, and thus CGI.pm thinks it
needs to return a (possibly empty) list. You should be able to fix
this by explictly specifying scalar context with
something like scalar $q->param('id').