Desktop-Notify

 view release on metacpan or  search on metacpan

lib/Desktop/Notify/Notification.pm  view on Meta::CPAN

package Desktop::Notify::Notification;

use strict;
use warnings;

use base qw/Class::Accessor/;

Desktop::Notify::Notification->mk_accessors(qw/summary body timeout/);

=head1 NAME

Desktop::Notify::Notification - a notification object for the desktop
notifications framework

=head1 VERSION

Version 0.03

=cut

our $VERSION = '0.03';

=head1 SYNOPSIS

    # $notify is an existing Desktop::Notify object
    my $note = $notify->create(summary => 'Rebuilding FooBar',
                               body => 'Progress: 10%');
    $note->show;
    
    ...
    
    # Update the notification later
    $note->body('Progress: 20%');
    $note->show;
    
    ...
    # Take it off the screen
    $note->close;


=head1 DESCRIPTION

Desktop notification objects are represented as objects of this class.  They
are created by a L<Desktop::Notify> object.  Displaying, closing, and modifying
the notification is done by using methods in this class.

=head1 METHODS

=head2 new $notify, %params

This is called internally by L<Desktop::Notify> to create a new notification
object.

=cut

sub new {
    my ($class, $server, %params) = @_;

    my $self = \%params;
    $self->{server} = $server;
    $self->{id} = undef;
    $self->{actions} ||= {};
    $self->{hints}   ||= {};
    bless $self, $class;
}

=head2 show

Display the notification on the screen. If this notification had previously
been shown and not closed yet, it will replace the existing notification.

Show can be called multiple times on the same notification, probably with



( run in 0.878 second using v1.01-cache-2.11-cpan-39bf76dae61 )