AnyEvent-WebService-Notifo
view release on metacpan or search on metacpan
lib/AnyEvent/WebService/Notifo.pm view on Meta::CPAN
use AnyEvent::WebService::Notifo;
# Uses the default values obtained from configuration file
my $awn = AnyEvent::WebService::Notifo->new;
# ... or just pass them in
my $awn = AnyEvent::WebService::Notifo->new(
api_key => 'api_key_value',
user => 'api_user',
);
# a coderef as a callback is one possibility...
$awn->send_notification(msg => 'my nottification text', cb => sub {
my ($res) = @_;
# $res is our response
});
# ... or a condvar
my $cv = AE::cv;
$awn->send_notification(msg => 'my nottification text', cb => $cv);
$res = $cv->recv; # $res is our response
=head1 DESCRIPTION
A client for the L<http://notifo.com/> API using the L<AnyEvent> framework.
=head1 CONSTRUCTORS
=head2 new
Creates a new C<AnyEvent::WebService::Notifo> object. See
L<< Protocol::Notifo->new()|Protocol::Notifo/new >>
for a explanation of the parameters and the configuration file used for
default values.
=head1 METHODS
=head2 send_notification
Sends a notification.
It accepts a hash with parameters. We require a C<cb> parameter. This
must be a coderef or a condvar, that will be called with the response.
In void context, this method returns nothing. In scalar context, it
returns a guard object. If this object goes out of scope, the request is
canceled. So you need to keep this guard object alive until your
callback is called.
See
L<< Protocol::Notifo->send_notification()|Protocol::Notifo/send_notification >>
for list of parameters that this method accepts, and an explanation of
the response that the callback receives.
=head1 SEE ALSO
L<Protocol::Notifo>, L<AnyEvent>
=head1 AUTHOR
Pedro Melo <melo@simplicidade.org>
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2010 by Pedro Melo.
This is free software, licensed under:
The Artistic License 2.0
=cut
( run in 0.608 second using v1.01-cache-2.11-cpan-39bf76dae61 )