Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl机械化发布隐藏表单值_Perl_Mechanize_Hidden Field - Fatal编程技术网

Perl机械化发布隐藏表单值

Perl机械化发布隐藏表单值,perl,mechanize,hidden-field,Perl,Mechanize,Hidden Field,我正在尝试创建一个perl脚本来测试web表单。我正在使用mechanize进行自动化,在查找有关现场方法的文档时遇到困难。我使用field方法返回隐藏表单的值,这导致我的帖子失败。这个问题可能是一个简单的疏忽,但我对$mech->field('name')很好奇因为它似乎在为我返回隐藏表单的值 使用PerlV5.16.3(不带警告(&w/o) 我想知道为什么当我获取表单的值时,我的提交失败了。我刚刚将“field”方法改为“value”,并意识到这解决了我的问题。抱歉,noob问题没有充分查看

我正在尝试创建一个perl脚本来测试web表单。我正在使用mechanize进行自动化,在查找有关现场方法的文档时遇到困难。我使用field方法返回隐藏表单的值,这导致我的帖子失败。这个问题可能是一个简单的疏忽,但我对
$mech->field('name')很好奇因为它似乎在为我返回隐藏表单的值

使用PerlV5.16.3
(不带警告(&w/o)


我想知道为什么当我获取表单的值时,我的提交失败了。我刚刚将“field”方法改为“value”,并意识到这解决了我的问题。抱歉,noob问题没有充分查看文档。当字段返回值时,我假设该值是其功能的一部分,但我没有意识到它还将该值设置为null。(或者据我所知,它就是这么做的)

你的问题到底是什么?
$id = $test->field('MId');  
print $id . " \n"; 
          #This is printing the desired Id ,
          #the post will  not succeed as long as $id assigned this way. 

print "This is where I am attempting to upload the images\n";
my $fileuploadresult;
$fileuploadresult = $mech->post($uploadURL,
    'Content_Type' => "multipart/form-data",
    'Content' => [
    'myFile' => $file , 'MId' => $id
    ]
    );
print $fileuploadresult->content() . "\n\n\n"; #If I set $id to something like 'test' it
#will work fine.
#I am using two agent because there are two POST's going on and they have to be sequential.