NAME

Growl::GNTP - Perl implementation of GNTP Protocol (Client Part)

SYNOPSIS

use Growl::GNTP;
my $growl = Growl::GNTP->new(AppName => "my perl app");
$growl->register([
    { Name => "foo", },
    { Name => "bar", },
]);

$growl->notify(
    Event => "foo",
    Title => "my notify",
    Message => "my message",
    Icon => "http://www.example.com/my-face.png",
);

DESCRIPTION

Growl::GNTP is Perl implementation of GNTP Protocol (Client Part)

CONSTRUCTOR

new ( ARGS )

Initialize Growl::GNTP object. You can set few parameter of IO::Socket::INET. and application name will be given 'Growl::GNTP' if you does not specify it.

OBJECT METHODS

register ( [ARGS] )

Register notification definition. You should be specify ARRAY reference of HASH reference like a following.

{
    Name        => 'MY_GROWL_NOTIFY',
    DisplayName => 'My Growl Notify',
    Enabled     => 'True',
}
notify ( ARGS )

Notify item. You should be specify HASH reference like a following.

{
    Event               => 'Warn', # name of notification
    Title               => 'Foo!',
    Message             => 'Bar!',
    Icon                => 'http://www.example.com/myface.png',
    CallbackContextType => time, # type of the context
    CallbackContext     => 'Time',
    CallbackFunction    => sub { warn 'callback!' },
}

And callback function is given few arguments.

CallbackFunction => sub {
    my ($result, $type, $context) = @_;
    print "$result: $context ($type)\n";
}
wait ( WAIT_ALL )

Wait callback items. If WAIT_ALL is not 0, this function wait all callbacks as CLICK, CLOSED, TIMEOUT.

subscribe ( ARGS )

Subscribe notification. You should be specify HASH reference like a following.

{
    Port => 23054,
    Password => 'secret',
    CallbackFunction => sub {
        my ($Title, $Message) = @_;
        print decode_utf8($Title),",",decode_utf8($Message),"\n";
    },
}

AUTHOR

Yasuhiro Matsumoto <mattn.jp@gmail.com>

SEE ALSO

Net::Growl, Net::GrowlClient, Mac::Growl, http://www.growlforwindows.com/gfw/help/gntp.aspx

LICENSE

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