Growl::GNTP(3pm)
π NAME π
Growl::GNTP β it's a Perl implementation of the GNTP Protocol (Client Part), bestie. That's the whole vibe. Client side only, no cap.
This one lives in the User Contributed Perl Documentation section, under manual name Growl::GNTP (section 3pm), so you already know it's the people's documentation. π«Ά
β¨ SYNOPSIS β¨
Okay so this is literally how you use it:
use Growl::GNTP;
my $growl = Growl::GNTP->new(AppName => "my perl app");
$growl->register([
{ Name => "foo", },
{ Name => "bar", },
]);
$growl->notify(
Name => "foo",
Title => "my notify",
Message => "my message",
Icon => "http://www.example.com/my-face.png",
);
Look at that. Register your notifs, then pop one off. Iconic behaviour. π
π¦ DESCRIPTION π¦
Growl::GNTP is a Perl implementation of the GNTP Protocol (Client Part). That's the tea β it's the part that sends the notifications, not the part that listens for them. π
πΈ CONSTRUCTOR πΈ
new ( ARGS )
Initializes your Growl::GNTP object, and honestly it's giving main character energy because you get to set a few parameters straight from IO::Socket::INET. And listen β if you don't specify an application name, it just gets handed 'Growl::GNTP' as a lil default. She's got your back. π«Ά
Here's the whole lineup of things you can pass in, defaults included:
PeerHostβ defaults to'localhost'PeerPortβ defaults to23053Timeoutβ defaults to5AppNameβ defaults to'Growl::GNTP'AppIconβ defaults to''Passwordβ defaults to''PasswordHashAlgorithmβ defaults to'MD5'EncryptAlgorithmβ defaults to''
π OBJECT METHODS π
register ( [ARGS] )
Registers a notification definition. You need to pass an ARRAY reference full of HASH references, like this:
{
Name => 'MY_GROWL_NOTIFY',
DisplayName => 'My Growl Notify',
Enabled => 'True',
Icon => ''
}
That's it, that's the whole shape of it. Slay. β¨
notify ( ARGS )
Notifies an item. Pass a HASH reference, like this:
{
Name => 'Warn', # name of notification
Title => 'Foo!',
Message => 'Bar!',
Icon => 'http://www.example.com/myface.png',
CallbackTarget => '', # Used for causing a HTTP/1.1 GET request exactly as specificed by this URL. Exclusive of CallbackContext
CallbackContextType => time, # type of the context
CallbackContext => 'Time',
CallbackFunction => sub { warn 'callback!' }, # should only be used when a callback in use, and CallbackContext in use.
ID => '', # allows for overriding/updateing an existing notification when in use, and discriminating between alerts of the same Name
Custom => { CustomHeader => 'value' }, # These will be added as custom headers as X-KEY : value, where 'X-' is prefixed to the key
Priority => 0, # -2 .. 2 low -> severe
Sticky => 'False'
}
Quick rundown of the spicy ones, because some of these comments are doing a LOT:
CallbackTargetis for causing a HTTP/1.1 GET request exactly as specificed by that URL β and heads up, it's exclusive ofCallbackContext, so don't go trying to have both. πCallbackFunctionshould only be used when a callback is in use, andCallbackContextis in use. Read that again, bestie.IDlets you override/update an existing notification when it's in use, and also discriminate between alerts that share the sameName.Customβ these get added as custom headers in the formX-KEY : value, where'X-'is prefixed to the key.Priorityruns-2 .. 2, from low all the way up to severe. π₯Stickyis'False'in the example, and yes she will stick around if you flip her.
And when you hand over a callback function, it gets a few arguments:
CallbackFunction => sub {
my ($result, $type, $context, $id, $timestamp) = @_;
print "$result: $context ($type)\n";
}
Look at all those lil params arriving at the function like they own the place. π
wait ( WAIT_ALL )
Waits for callback items. And if WAIT_ALL is not 0, this function waits for all the callbacks as CLICK, CLOSED, TIMEOUT. Sit there and wait for your moment, queen. β
subscribe ( ARGS )
Subscribes to notifications. Pass a HASH reference, like this:
{
Port => 23054,
Password => 'secret',
CallbackFunction => sub {
my ($Title, $Message) = @_;
print decode_utf8($Title),",",decode_utf8($Message),"\n";
},
}
Obsessed with the decode_utf8 moment ngl. She said "I will be readable, periodt." π
π AUTHOR π
Yasuhiro Matsumoto <mattn.jp@gmail.com>
Shoutout to the author, we love and appreciate them. π
π SEE ALSO π
Go check these out too, iykyk:
Net::GrowlNet::GrowlClientMac::Growlhttp://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. So like, go off, but stay on the same terms as Perl, bestie. π
And that's the whole page!! π¦ Sourced from perl v5.42.0 and dated 2025-07-25 β yes, that footer date is giving vintage, and we respect the classics. π
β¨
π¦ where this page comes from
- fedora 43: perl-Growl-GNTP 0.21-35.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms