NAME

Cocoa::Skype - Perl interface to Skype.framework

SYNOPSIS

  use Cocoa::Skype;
  use Cocoa::EventLoop;

  my $skype; $skype = Cocoa::Skype->new(
      name => 'my test application',
      on_attach_response => sub {
          my ($code) = @_;
          if ($code == 1) { # on success
              $skype->send('PROTOCOL 8');
          }
      },
      on_notification_received => sub {
          my ($notification) = @_;

          ...
      },
  );
  $skype->connect;

  Cocoa::EventLoop->run;

DESCRIPTION

Cocoa::Skype provides Perl interface to Skype.framework.

METHODS

new

name => 'Skype::Any' : Str

Name of your application. This name will be shown to the user, when your application uses Skype.

on_attach_response => sub { my ($code) = @_; ... }

This callback is called after Skype API client application has called connect. $code is 0 on failure and 1 on success.

on_notification_received => sub { my ($notification) = @_; ... }

This is callback Skype uses to send information to your application. $notification is Skype API string.

on_became_available => sub { ... }

This callback is called after Skype has been launched.

on_became_unavailable => sub { ... }

This callback is called after Skype has quit.

connect

  $skype->connect;

Try to connect your application to Skype.

disconnect

  $skype->disconnect;

Disconnects your application from Skype.

send

  $skype->send($msg);

Use this method to control Skype or request information. $msg is a Skype API string.

Note that this method does NOT guarantee an immediate response. Sometimes you will get an immediate response, or sometimes you will have to wait for the response. you can solve this problem with using Skype::Any:

  use Skype::Any;
  use AnyEvent;

  my $skype = Skype::Any->new();

  # e.g. Skype API REPL
  my $w; $w = AE::io *STDIN, 0, sub {
      chomp(my $input = <STDIN>);
      if ($input) {
          eval {
              my $command = $skype->api->send_command($input);
              my $res = $command->reply(); # wait until a response comes back.
              warn "$res\n";
          };
      }
  };

  $skype->run;

isRunning

  $skype->isRunning();

Return 1, when Skype is running and 0 otherwise.

isAvailable

  $skype->isAvailable();

Return 1, when Skype is available and 0 otherwise.

AUTHOR

Daisuke Murase <typester@cpan.org>

Takumi Akiyama <t.akiym at gmail.com>

SEE ALSO

Public API Reference

Skype::Any

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.