|
NAMENet::GrowlClient - Perl implementation of Growl Network Notification Protocol (Client Part)SYNOPSISuse Net::GrowlClient; DESCRIPTION"Net::GrowlClient" provides an object interface to register applications and/or send notifications to Growl Servers using udp protocol.CONSTRUCTOR
METHOD
DEFAULT VALUESDefault values should be overwritten but some exists:CLIENT_TYPE_REGISTRATION => 4 #noauth CLIENT_TYPE_NOTIFICATION => 5 #noauth CLIENT_CRYPT => FALSE #Do not crypt ( AES128 is NOT IMPLEMENTED IN v < 0.10) CLIENT_PASSWORD => '' #nullstring <=> nopassword CLIENT_PEER_HOST => 'localhost' CLIENT_PEER_PORT => 9887 CLIENT_APPLICATION_NAME => 'Net::GrowlClient' CLIENT_NOTIFICATION_LIST => ['Net::GrowlClient Notification'] CLIENT_NOTIFICATION => First element of CLIENT_NOTIFICATION_LIST CLIENT_DEFAULT_TITLE => 'Hello from Net::GrowlClient!' CLIENT_DEFAULT_MESSAGE => "Yeah! It Works!\nThis is the default message." CLIENT_STICKY => FALSE CLIENT_SKIP_REGISTER => FALSE CLIENT_PRIORITY => 0 #Normal Notify Method use object parameters. They could be overwritten but keep in mind that application name and the notification list needs to be registered in order to be used with the notify() method. COMMON USAGEUsually, you just want to see your message on the server screen and don't care about wich application is sending the message. In this case You just have to set a GrowlClient object which use the default values. The identity will be 'Net::GrowlClient' and the notification 'Net::GrowlClient Notification'. This is the minimal but sufficient usage.use Net::GrowlClient; my $growl = Net::GrowlClient->init( 'CLIENT_PEER_HOST' => 'server.example.com' ) or die "$!\n"; $growl->notify( 'title' => 'Notification title', 'message' => "first line\nsecond line" ); ADVANCED USAGEUsing advanced features alow your application to have its own identity and notification list. This make possible to set specific preferences for this application in the Growl Control Panel on the server.This example create a GrowlClient object for the application "Foo" with the server "server.example.com" using md5 auth. Register this application 'Foo' with its notification list. Send a sticky notification to with tho highest priority. use Net::GrowlClient; my $growl = Net::GrowlClient->init( 'CLIENT_TYPE_REGISTRATION' => 0, #md5 auth 'CLIENT_TYPE_NOTIFICATION' => 1, #md5 auth 'CLIENT_CRYPT' => 0, #Do not crypt 'CLIENT_PASSWORD' => 'secret', 'CLIENT_PEER_HOST' => 'server.example.com', 'CLIENT_APPLICATION_NAME' => 'Foo', 'CLIENT_NOTIFICATION_LIST' => ['Foo Normal', 'Foo Alert'] #The default is the first 'Foo Normal'. ) or die "$!\n"; $growl->notify( 'title' => 'Notification title', 'message' => "first line\nsecond line", 'notification' => 'Foo Alert', #Specify we do not use the default notification. 'priority' => 2, 'sticky' => 1 ); This example create a GrowlClient object for one or more application with are already registered and send messages to the server from Application 1 and Application 2. This use sha256 auth method. use Net::GrowlClient; my $growl = Net::GrowlClient->init( 'CLIENT_TYPE_REGISTRATION' => 2, #sha auth 'CLIENT_TYPE_NOTIFICATION' => 3, #sha auth 'CLIENT_PASSWORD' => 'secret', 'CLIENT_PEER_HOST' => 'server.example.com', ) or die "$!\n"; $growl->notify( 'title' => 'Notification title', 'message' => "first line\nsecond line", 'notification' => 'An Application 1 Notification', 'application' => 'Application 1 wich is registered' ); $growl->notify( 'title' => 'Notification title', 'message' => "first line\nsecond line", 'notification' => 'An Application 2 Notification', 'application' => 'Application 2 wich is registered' ); MISSING THINGSThere is still some capabilities missing in this growl network client protocol implementation.
AUTHORRaphael Roulet. Please report all bugs to <modules@perl-auvergne.com> or <castor@cpan.org>.
Visit the GSP FreeBSD Man Page Interface. |