AnyEvent-SparkBot
view release on metacpan or search on metacpan
"HTTP::MultiGet" : "1.008",
"HTTP::Request" : "6.13",
"HTTP::Request::Common" : "6.13",
"IO::Scalar" : "2.111",
"IO::Socket::SSL" : "1.968",
"JSON" : "2.90",
"LWP::UserAgent" : "6.26",
"Log::Dispatch::Handle" : "2.65",
"Log::Log4perl" : "1.49",
"Log::LogMethods" : "1.0",
"Modern::Perl" : "1.20170117",
"Moo" : "2.003002",
"MooX::Types::MooseLike::Base" : "0.29",
"Ref::Util" : "0.203",
"Scalar::Util" : "1.48",
"Test::More" : "1.302073",
"Time::HiRes" : "1.9741",
"URI::Escape" : "3.31",
"UUID::Tiny" : "1.04",
"namespace::clean" : "0.27",
"overload" : "1.28"
HTTP::MultiGet: '1.008'
HTTP::Request: '6.13'
HTTP::Request::Common: '6.13'
IO::Scalar: '2.111'
IO::Socket::SSL: '1.968'
JSON: '2.90'
LWP::UserAgent: '6.26'
Log::Dispatch::Handle: '2.65'
Log::Log4perl: '1.49'
Log::LogMethods: '1.0'
Modern::Perl: '1.20170117'
Moo: '2.003002'
MooX::Types::MooseLike::Base: '0.29'
Ref::Util: '0.203'
Scalar::Util: '1.48'
Test::More: '1.302073'
Time::HiRes: '1.9741'
URI::Escape: '3.31'
UUID::Tiny: '1.04'
namespace::clean: '0.27'
overload: '1.28'
Makefile.PL view on Meta::CPAN
# the contents of the Makefile that is written.
WriteMakefile(
NAME => 'AnyEvent::SparkBot',
VERSION_FROM => 'lib/AnyEvent/SparkBot.pm', # finds $VERSION
LICENSE=>'perl_5',
PREREQ_PM => {
qw(
IO::Socket::SSL 1.968
Moo 2.003002
overload 1.28
Modern::Perl 1.20170117
MooX::Types::MooseLike::Base 0.29
Carp 1.38
namespace::clean 0.27
Data::Dumper 2.161
Test::More 1.302073
Data::Result 1.0
Log::Log4perl 1.49
Time::HiRes 1.9741
B 1.68
Scalar::Util 1.48
| AnyEvent::SparkBot | Asyncrnous AnyEvent loop implementation of the Spark Bot |
| AnyEvent::HTTP::Spark | Dual Nature Syncrnous/Asyncrnous AnyEvent friendly Spark v1 HTTP Client library |
| AnyEvent::SparkBot::SharedRole | Shared library used by AnyEvent::SparkBot and AnyEvent::HTTP::Spark |
Once installed it you should be able to use perldoc to view the pod.
## Basic Example
This example shows how to connect to spark and respond to text messages.
```
use Modern::Perl;
use Data::Dumper;
use AnyEvent::SparkBot;
use AnyEvent::Loop;
$|=1;
my $obj=new AnyEvent::SparkBot(token=>$ENV{SPARK_TOKEN},on_message=>\&cb);
$obj->que_getWsUrl(sub { $obj->start_connection});
$obj->agent->run_next;
AnyEvent::Loop::run;
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
package AnyEvent::HTTP::Spark;
use Modern::Perl;
use Moo;
use MooX::Types::MooseLike::Base qw(:all);
use Data::Dumper;
use JSON qw(to_json from_json);
use HTTP::Request::Common qw(POST);
use Ref::Util qw(is_plain_arrayref is_plain_hashref);
use URI::Escape qw(uri_escape_utf8);
use namespace::clean;
use Scalar::Util qw(looks_like_number);
use AnyEvent;
lib/AnyEvent/SparkBot.pm view on Meta::CPAN
package AnyEvent::SparkBot;
our $VERSION='1.015';
use Modern::Perl;
use Moo;
use MooX::Types::MooseLike::Base qw(:all);
use Scalar::Util qw( looks_like_number);
use Data::Dumper;
use namespace::clean;
use AnyEvent::HTTP::MultiGet;
use AnyEvent::WebSocket::Client;
use MIME::Base64;
use JSON;
use AnyEvent::HTTP::Spark;
lib/AnyEvent/SparkBot.pm view on Meta::CPAN
no namespace::clean;
with 'HTTP::MultiGet::Role', 'AnyEvent::SparkBot::SharedRole';
}
=head1 NAME
AnyEvent::SparkBot - Cisco Spark WebSocket Client for the AnyEvent Loop
=head1 SYNOPSIS
use Modern::Perl;
use Data::Dumper;
use AnyEvent::SparkBot;
use AnyEvent::Loop;
$|=1;
our $obj=new AnyEvent::SparkBot(token=>$ENV{SPARK_TOKEN},on_message=>\&cb);
$obj->que_getWsUrl(sub {
my ($agent,$id,$result)=@_;
lib/AnyEvent/SparkBot/SharedRole.pm view on Meta::CPAN
package AnyEvent::SparkBot::SharedRole;
=head1 NAME
AnyEvent::SparkBot::SharedRole - Shared methods for SparkBot
=head1 SYNOPSIS
use Modern::Perl;
use Moo;
BEGIN { with 'AnyEvent::SparkBot::SharedRole' }
=head1 DESCRIPTION
Shared functions used between different sparkbot classes.
=cut
use Modern::Perl;
use Moo::Role;
use HTTP::Headers;
use Digest::MD5 qw(md5_base64);
use MooX::Types::MooseLike::Base qw(:all);
use UUID::Tiny ':std';
use namespace::clean;
has token=>(
required=>1,
is=>'ro',
t/AnyEvent-HTTP-Spark-nonBLock.t view on Meta::CPAN
use Modern::Perl;
use Log::LogMethods::Log4perlLogToString;
use Carp qw(confess);
use Data::Dumper;
use JSON qw(to_json from_json);
use AnyEvent::Loop;
#BEGIN { $SIG{__DIE__} = sub { confess @_ }; }
use Test::More qw(no_plan);
my $class='AnyEvent::SparkBot';
require_ok($class);
t/AnyEvent-HTTP-Spark.t view on Meta::CPAN
use Modern::Perl;
use Log::LogMethods::Log4perlLogToString;
use Carp qw(confess);
use Data::Dumper;
use JSON qw(to_json from_json);
#BEGIN { $SIG{__DIE__} = sub { confess @_ }; }
use Test::More qw(no_plan);
my $class='AnyEvent::HTTP::Spark';
require_ok($class);
use_ok($class);
t/AnyEvent-SparkBot-SharedRole.t view on Meta::CPAN
use Modern::Perl;
use Test::More qw(no_plan);
use_ok('AnyEvent::SparkBot::SharedRole');
require_ok('AnyEvent::SparkBot::SharedRole');
done_testing;
t/AnyEvent-SparkBot.t view on Meta::CPAN
use Modern::Perl;
use Log::LogMethods::Log4perlLogToString;
use Carp qw(confess);
use AnyEvent::Loop;
use Data::Dumper;
#BEGIN { $SIG{__DIE__} = sub { confess @_ }; }
use Test::More qw(no_plan);
my $class='AnyEvent::SparkBot';
require_ok($class);
use_ok($class);
( run in 0.564 second using v1.01-cache-2.11-cpan-a5abf4f5562 )