README.md
1# NAME
2
3Growl::GNTP - Perl implementation of GNTP Protocol (Client Part)
4
5# SYNOPSIS
6
7 use Growl::GNTP;
8 my $growl = Growl::GNTP->new(AppName => "my perl app");
9 $growl->register([
10 { Name => "foo", },
11 { Name => "bar", },
12 ]);
13
14 $growl->notify(
15 Name => "foo",
16 Title => "my notify",
17 Message => "my message",
18 Icon => "http://www.example.com/my-face.png",
19 );
20
21# DESCRIPTION
22
23Growl::GNTP is Perl implementation of GNTP Protocol (Client Part)
24
25# CONSTRUCTOR
26
27- new ( ARGS )
28
29 Initialize Growl::GNTP object. You can set few parameter of
30 IO::Socket::INET. and application name will be given 'Growl::GNTP' if you
31 does not specify it.
32
33 > PeerHost # 'localhost'
34 > PeerPort # 23053
35 > Timeout # 5
36 > AppName # 'Growl::GNTP'
37 > AppIcon # ''
38 > Password # ''
39 > PasswordHashAlgorithm # 'MD5'
40 > EncryptAlgorithm # ''
41
42# OBJECT METHODS
43
44- register ( \[ARGS\] )
45
46 Register notification definition. You should be specify ARRAY reference of
47 HASH reference like a following.
48
49 {
50 Name => 'MY_GROWL_NOTIFY',
51 DisplayName => 'My Growl Notify',
52 Enabled => 'True',
53 Icon => ''
54 }
55
56- notify ( ARGS )
57
58 Notify item. You should be specify HASH reference like a following.
59
60 {
61 Name => 'Warn', # name of notification
62 Title => 'Foo!',
63 Message => 'Bar!',
64 Icon => 'http://www.example.com/myface.png',
65 CallbackTarget => '', # Used for causing a HTTP/1.1 GET request exactly as specificed by this URL. Exclusive of CallbackContext
66 CallbackContextType => time, # type of the context
67 CallbackContext => 'Time',
68 CallbackFunction => sub { warn 'callback!' }, # should only be used when a callback in use, and CallbackContext in use.
69 ID => '', # allows for overriding/updateing an existing notification when in use, and discriminating between alerts of the same Name
70 Custom => { CustomHeader => 'value' }, # These will be added as custom headers as X-KEY : value, where 'X-' is prefixed to the key
71 Priority => 0, # -2 .. 2 low -> severe
72 Sticky => 'False'
73 }
74
75 And callback function is given few arguments.
76
77 CallbackFunction => sub {
78 my ($result, $type, $context, $id, $timestamp) = @_;
79 print "$result: $context ($type)\n";
80 }
81
82- wait ( WAIT\_ALL )
83
84 Wait callback items. If WAIT\_ALL is not 0, this function wait all callbacks
85 as CLICK, CLOSED, TIMEOUT.
86
87- subscribe ( ARGS )
88
89 Subscribe notification. You should be specify HASH reference like a following.
90
91 {
92 Port => 23054,
93 Password => 'secret',
94 CallbackFunction => sub {
95 my ($Title, $Message) = @_;
96 print decode_utf8($Title),",",decode_utf8($Message),"\n";
97 },
98 }
99
100# AUTHOR
101
102Yasuhiro Matsumoto <mattn.jp@gmail.com>
103
104# SEE ALSO
105
106[Net::Growl](https://metacpan.org/pod/Net::Growl), [Net::GrowlClient](https://metacpan.org/pod/Net::GrowlClient), [Mac::Growl](https://metacpan.org/pod/Mac::Growl),
107`http://www.growlforwindows.com/gfw/help/gntp.aspx`
108
109# LICENSE
110
111This library is free software; you can redistribute it and/or modify
112it under the same terms as Perl itself.
113