I had the same problem. I did some digging through the code of
Desktop::Notify, the code of Net::DBus and the D-Bus protocol spec. I
believe the solution is to set the 'id' to 0 (zero) rather than undef.
I suggest that this be fixed in Desktop::Notify::Notification::new
(version 0.01 line 61) by setting '$self->{id} = 0;' rather than
'$self->{id} = undef;'
Let me demonstrate. With command line examples:
Using Desktop::Notify -
perl -MDesktop::Notify -e
'$ns=Desktop::Notify->new();$no=$ns->create(summary=>"summary",body=>"body",timeout=>0);$no->show();'
This will show a notification, but also emit the error message 'Argument
"" isn't numeric in subroutine entry at
/usr/lib/perl5/Net/DBus/Binding/Iterator.pm line 445.'
You can make a similar call using only Net::DBus which does not emit
this error:
perl -MNet::DBus -e
'$sb=Net::DBus->session;$ns=$sb->get_service("org.freedesktop.Notifications");$no=$ns->get_object("/org/freedesktop/Notifications","org.freedesktop.Notifications");$no->Notify("command
line",0,"","Subject","Body",[],{},0);'
In this case, the second argument to the Notify() method is set to 0.
The second argument is the ID, and per a copy of the Desktop
Notifications Spec
(
http://www.galago-project.org/specs/notification/0.9/x408.html#command-notify)
the value should be integer (UINT32). The
Desktop::Notify::Notifications modules is setting it to undef, and via
autoload method calls the Net::DBus::Binding::Iterator is converting it
to an empty string rather than an integer.
COMMENTS: I am not sure what an undef integer even looks like. I
really like perl's loose type-specing, and I don't think that this bug
is a black mark on it. The Desktop Notification Spec clearly states
that the 'id' in the message is UINT32, and does not say that undefined
is allowed.
I can make Desktop::Notification work without emitting the error message
by setting the id to 0 prior to calling show() like this:
perl -MDesktop::Notify -e
'$ns=Desktop::Notify->new();$no=$ns->create(summary=>"summary",body=>"body",timeout=>0);$no->{id}=0;$no->show();'
I think that the default value for id should be set to zero in
Desktop::Notify::Notification. I just have to figure out how to contact
the module author (perhaps this bug report will automatically be
sent...I am noew to CPAN-RT).