关于WWW::Mechanize用法请教(直接运行官方网站给的例子出错)

本帖最后由 luoyong55 于 2011-06-03 14:46 编辑

这是官方网站上的例子,可是我有些地方看不懂,想请教一下:
(我直接复制到本地运行例子,程序出错,提示:Missing base argument at C:/Perl/lib/HTTP/Response.pm)
    use WWW::Mechanize;
    my $mech = WWW::Mechanize->new();

    $mech->get( $url );

    $mech->follow_link( n => 3 );
    $mech->follow_link( text_regex => qr/download this/i );
    $mech->follow_link( url => 'http://host.com/index.html' );

    $mech->submit_form(
        form_number => 3,
        fields      => {
            username    => 'mungo',
            password    => 'lost-and-alone',
        }
    );

    $mech->submit_form(
        form_name => 'search',##这里是按钮上的文字吗?
        fields    => { query  => 'pot of gold', },##这句是什么意思啊?
        button    => 'Search Now'##还有这句是什么意思?
    );

作者: luoyong55   发布时间: 2011-06-03

LZ,你要明白WWW::Mechanize中取到的,都是HTML里面的标签ID或者名字。

比如search是FORM标签的名字
        form_name => 'search',##这里是按钮上的文字吗?
        
        button    => 'Search Now'##还有这句是什么意思?

作者: daxiongzong   发布时间: 2011-06-03

回复 daxiongzong


    谢谢~..

可是为什么运行程序会出现Missing base argument at C:/Perl/lib/HTTP/Response.pm?我已经安装也调用HTTP::Response模块,还是会出现这样的提示..

作者: luoyong55   发布时间: 2011-06-03