Agent-TCLI-Package-Net
view release on metacpan or search on metacpan
t/dev/target.t view on Meta::CPAN
#!/usr/bin/perl
# This is a version for debugging Agents for developer use
use warnings;
use strict;
use lib ('blib/lib');
use Test::More qw(no_plan);
sub VERBOSE () { 0 }
use Getopt::Lucid qw(:all);
my ($opt, $verbose,$domain,$username,$password,$resource,$host);
eval {$opt = Getopt::Lucid->getopt([
Param("domain|d"),
Param("username|u"),
Param("password|p"),
Param("resource|r"),
Param("host"),
Counter("verbose|v"),
])};
if($@) {die "ERROR: $@";}
$verbose = $opt->get_verbose ? $opt->get_verbose : VERBOSE;
# xmpp username/password to log in with
$username = $opt->get_username ? $opt->get_username : 'username';
$password = $opt->get_password ? $opt->get_password : 'password';
$domain = $opt->get_domain ? $opt->get_domain : 'example.com';
$host = $opt->get_host ? $opt->get_host : $domain;
use POE;
use Agent::TCLI::Transport::Test;
use Agent::TCLI::Testee;
use Agent::TCLI::Transport::XMPP;
use Agent::TCLI::Package::XMPP;
use Agent::TCLI::Package::Net::HTTP;
# Need to set up transport to talk to other Agents
# Packages for XMPP
# Within test scripts, we use diag() to output verbose messages
# to ensure we don't mess up the Test::Harness processing.
my @packages = (
# We need the transport controller package to shut down the transport at the
#end of the testing.
Agent::TCLI::Package::XMPP->new(
'verbose' => \$verbose ,
'do_verbose' => sub { diag( @_ ) },
),
Agent::TCLI::Package::Net::HTTP->new({
'verbose' => \$verbose,
'do_verbose' => sub { diag( @_ ) },
}),
);
# Need a transport to deliver the tests to remote hosts
Agent::TCLI::Transport::XMPP->new(
'jid' => Net::XMPP::JID->new($username.'@'.$domain.'/test'),
'jserver' => $host,
( run in 0.782 second using v1.01-cache-2.11-cpan-39bf76dae61 )