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