Perl 用';选择';元素选项?

Perl 用';选择';元素选项?,perl,html-formfu,Perl,Html Formfu,我试图理解填充 具有“选择”元素值(选项)的表单 当我转储(Data::Dumper)FormFu对象时,我看到对象结构 看起来类似于以下内容: 'name' => 'EmailDL', '_options' => [ { 'label_attributes' => {}, 'value' => 'm', 'container_attributes' => {},

我试图理解填充 具有“选择”元素值(选项)的表单

当我转储(Data::Dumper)FormFu对象时,我看到对象结构 看起来类似于以下内容:

'name' => 'EmailDL',
'_options' => [
         {
           'label_attributes' => {},
           'value' => 'm',
           'container_attributes' => {},
           'label' => 'Male',
           'attributes' => {}
         },
         {
           'label_attributes' => {},
           'value' => 'f',
           'container_attributes' => {},
           'label' => 'Female',
           'attributes' => {}
         }
       ],
     'Firstname' => 'Faisal',
     'EmailDL' => [
                    {
                      'value' => 'myvalue',
                      'label' => 'mylabel'
                    }
                  ],
看到这一点,我认为构造$form\u输入(即
$form\u输入=\%cgivars
)的方法如下所示:

'name' => 'EmailDL',
'_options' => [
         {
           'label_attributes' => {},
           'value' => 'm',
           'container_attributes' => {},
           'label' => 'Male',
           'attributes' => {}
         },
         {
           'label_attributes' => {},
           'value' => 'f',
           'container_attributes' => {},
           'label' => 'Female',
           'attributes' => {}
         }
       ],
     'Firstname' => 'Faisal',
     'EmailDL' => [
                    {
                      'value' => 'myvalue',
                      'label' => 'mylabel'
                    }
                  ],
然而,这似乎不起作用。我发现正确构造
$form\u input
,然后发出
$fu->default\u values($form\u input)
是简单有效的,但在本例中,当我尝试包含select/options子结构时除外


所以问题是:在执行
$fu->default\u value($form\u input)
$fu->process($form\u input)
时,我应该如何构造上面的“EmailDL”来正确填充“select”选项?

来设置使用选项调用的选项

$fu->get_all_element('EmailDL')->options([ [ 'myvalue', 'mylabel' ], 
                                             [ 'val2', 'label2' ] ]);
如果要设置其中一个值,可以使用默认值

$fu->default_values({ EmailDL => 'val2' });
文档中提供了更多帮助。注意:代码示例在帮助的文本中