AnyEvent-Chromi

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

   "prereqs" : {
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "AnyEvent::Handle" : "0",
            "AnyEvent::Socket" : "0",
            "JSON::XS" : "0",
            "Log::Any" : "0",
            "Protocol::WebSocket::Frame" : "0",
            "Protocol::WebSocket::Handshake::Client" : "0",
            "Protocol::WebSocket::Handshake::Server" : "0",
            "URI::Escape" : "0",
            "strict" : "0"
         }
      },
      "test" : {
         "requires" : {

META.yml  view on Meta::CPAN

dynamic_config: 0
generated_by: 'Dist::Zilla version 5.043, CPAN::Meta::Converter version 2.150005'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: AnyEvent-Chromi
requires:
  AnyEvent::Handle: '0'
  AnyEvent::Socket: '0'
  JSON::XS: '0'
  Log::Any: '0'
  Protocol::WebSocket::Frame: '0'
  Protocol::WebSocket::Handshake::Client: '0'
  Protocol::WebSocket::Handshake::Server: '0'
  URI::Escape: '0'
  strict: '0'
resources:
  bugtracker: https://github.com/open-ch/AnyEvent-Chromi/issues
  homepage: https://github.com/open-ch/AnyEvent-Chromi
  repository: https://github.com/open-ch/AnyEvent-Chromi.git

Makefile.PL  view on Meta::CPAN

  "AUTHOR" => "David Schweikert <david\@schweikert.ch>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "AnyEvent-Chromi",
  "LICENSE" => "perl",
  "NAME" => "AnyEvent::Chromi",
  "PREREQ_PM" => {
    "AnyEvent::Handle" => 0,
    "AnyEvent::Socket" => 0,
    "JSON::XS" => 0,
    "Log::Any" => 0,
    "Protocol::WebSocket::Frame" => 0,
    "Protocol::WebSocket::Handshake::Client" => 0,
    "Protocol::WebSocket::Handshake::Server" => 0,
    "URI::Escape" => 0,
    "strict" => 0
  },
  "TEST_REQUIRES" => {
    "Test::Simple" => 0
  },
  "VERSION" => "1.01",
  "test" => {
    "TESTS" => "t/*.t"
  }
);


my %FallbackPrereqs = (
  "AnyEvent::Handle" => 0,
  "AnyEvent::Socket" => 0,
  "JSON::XS" => 0,
  "Log::Any" => 0,
  "Protocol::WebSocket::Frame" => 0,
  "Protocol::WebSocket::Handshake::Client" => 0,
  "Protocol::WebSocket::Handshake::Server" => 0,
  "Test::Simple" => 0,
  "URI::Escape" => 0,
  "strict" => 0
);


README.md  view on Meta::CPAN

- $chromi->call($method, $args, $cb)

    Call the Chrome extension method `$method`, e.g. `chrome.windows.getAll`.

    `$args` is expected to be a ARRAYREF with the arguments for the method. It will be
    converted to JSON by AnyEvent::Chromi.

    `$cb` is a callback for when the reply is received. The first argument to the callback is
    the status (either "done" or "error"), and the second is a ARRAYREF with the data.

    Note: you need to make sure that the JSON::XS serialization is generating the proper
    data types. This is particularly important for booleans, where `Types::Serialiser::true`
    and `Types::Serialiser::false` can be used.

- $chromi->is\_connected

    In server mode: returns true if Chrome is connected and awaits commands.

    In client mode: returns true if connected to chromix-server.

## EXAMPLES

examples/server.pl  view on Meta::CPAN


use 5.014;
use Log::Any qw($log);
use Log::Any::Adapter;
use Log::Dispatch;
use AnyEvent;
use AnyEvent::Socket;
use AnyEvent::Handle;
use Protocol::WebSocket::Handshake::Server;
use Protocol::WebSocket::Frame;
use JSON::XS;
use URI::Escape;

my $tcp_server;
my %clients;
my %chromi;
my %requests;

sub start_server
{
    $tcp_server = AnyEvent::Socket::tcp_server undef, 7441, sub {

lib/AnyEvent/Chromi.pm  view on Meta::CPAN


use strict;

use AnyEvent::Socket;
use AnyEvent::Handle;
 
use Protocol::WebSocket::Handshake::Client;
use Protocol::WebSocket::Handshake::Server;
use Protocol::WebSocket::Frame;

use JSON::XS;
use URI::Escape;
use Log::Any qw($log);

our $VERSION = '1.01';

sub new
{
    my ($class, %args) = @_;
    my $self = {};
    bless $self, $class;

lib/AnyEvent/Chromi.pm  view on Meta::CPAN

=item $chromi->call($method, $args, $cb)

Call the Chrome extension method C<$method>, e.g. C<chrome.windows.getAll>.

C<$args> is expected to be a ARRAYREF with the arguments for the method. It will be
converted to JSON by AnyEvent::Chromi.

C<$cb> is a callback for when the reply is received. The first argument to the callback is
the status (either "done" or "error"), and the second is a ARRAYREF with the data.

Note: you need to make sure that the JSON::XS serialization is generating the proper
data types. This is particularly important for booleans, where C<Types::Serialiser::true>
and C<Types::Serialiser::false> can be used.

=item $chromi->is_connected

In server mode: returns true if Chrome is connected and awaits commands.

In client mode: returns true if connected to chromix-server.

=back



( run in 0.276 second using v1.01-cache-2.11-cpan-4d50c553e7e )