【问题标题】:How can I get perl to work with gmail chat?如何让 perl 与 gmail 聊天一起工作?
【发布时间】:2014-02-14 15:02:47
【问题描述】:

我试过thisthis。但它只是行不通。 AuthSend 返回空数组。或许我应该给你提供一些代码来讨论:

#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;

use Net::XMPP;
use Data::Dumper;

my $username = 'USERNAME';
my $password = 'PASSWORD';
my $connection = new Net::XMPP::Client;
my $r = $connection->Connect(
    hostname => 'talk.google.com',
    port => 5222,
    componentname => 'gmail.com',
    connectiontype => 'tcpip',
    tls => 1
);
say Dumper $r;
my @r = $connection->AuthSend(
    username => $username,
    password => $password,
    resource => 'test'
);
say Dumper \@r;

【问题讨论】:

标签: perl xmpp google-talk


【解决方案1】:

你可以试试Net::XMPP::Client::GTalk

#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;

use Data::Dumper;
use Net::XMPP::Client::GTalk;

my $username = 'USERNAME';
my $password = 'PASSWORD';

# does all the connection-handling and authentication at once
my $client = Net::XMPP::Client::GTalk->new(
    USERNAME => $username,
    PASSWORD => $password,
);

say Dumper($client);

【讨论】:

    猜你喜欢
    • 2010-11-14
    • 1970-01-01
    • 2023-02-02
    • 1970-01-01
    • 2016-12-23
    • 2017-06-25
    • 2020-12-13
    • 2012-02-02
    • 2011-02-22
    相关资源
    最近更新 更多