小编use*_*433的帖子

使用WWW :: Mechanize模块在Perl中填写表单

我正在创建一个脚本,使用mechanize模块在Perl中登录到Web表单,我收到错误:

/home/arty/scripts/gmail_pw_chngr.pl第18行的语法错误,靠近"按钮"/home/arty/scripts/gmail_pw_chngr.pl的执行由于编译错误而中止.

    use WWW::Mechanize;
    my $mech = WWW::Mechanize->new();

    my $url = "https://accounts.google.com/Login";

    $mech->get($url);

    $result = $mech->submit_form(
        form_name => 'gaia_loginform', # Name of the form
        #Instead of form name you can specify
        #form_number => 1
        fields       =>
        {
            Email  => 'arty32l@gmail.com', # Name of the input field and value
            Passwd => 'password',
        }
        button    => 'signIn' # Name of the submit button
    );
    print $result->content();
Run Code Online (Sandbox Code Playgroud)

上面是代码,输入中的所有值都是名称,但它始终在同一行上出错.

perl mechanize www-mechanize

4
推荐指数
1
解决办法
6642
查看次数

Perl DBI mysql更新

namekey值......要更新的用户名

#!/usr/bin/perl -w
# Use the DBI module

use  strict;
use warnings;
use DBI;

# CONFIG VARIABLES
my $platform = "mysql";
my $database = "prod";
my $host     = "localhost";
my $username = "root";
my $password = "admin";

# DATA SOURCE NAME
my $dsn = "dbi:$platform:$database:$host";

# PERL DBI CONNECT
my $connect = DBI->connect($dsn, $username, $password);

# VARS for Examples
my $query;
my $query_handle;
my $id;
my $demo;

# Example 2 using do() UPDATE   

# SAMPLE VARIABLE AND VALUES TO PASS …
Run Code Online (Sandbox Code Playgroud)

mysql perl dbi

0
推荐指数
1
解决办法
6644
查看次数

标签 统计

perl ×2

dbi ×1

mechanize ×1

mysql ×1

www-mechanize ×1