Undefined subroutine CGI::radio

2019-08-03 18:40发布

I have an application about a student data,and i am trying to make a radio-group which has options about gender of the student. But it shows me the following error: Undefined subroutine CGI::radio at C:/wamp/bin/apache/apache2.2.22/cgi-bin/modify.pl line 196

   $cInput .= $q->div({-class => 'control-group'},
                    $q->label({-class => 'control-label', -for => 'gender'}, "Gender:"), 
                    $q->div({class => 'controls'}, 
                    $q->span({class => 'span12'},
                    $q->label({-class => 'blue'},
                    $q->radio-group({-id => 'gender', -name => 'gender', -values => ['M','F'],-labels => \%labels, -default => $cGender, 'true'})))));  

What may be the problem?

标签: perl cgi
1条回答
地球回转人心会变
2楼-- · 2019-08-03 19:09

You are trying to call $q->radio-group but:

  1. The - is being treated as a subtraction operator
  2. The method is called radio_group (with an underscore)

See the documentation

查看更多
登录 后发表回答