NAME
Mozilla::ObserverService - Perl interface to the Mozilla nsIObserverService
SYNOPSIS
use Mozilla::ObserverService;
my $cookie = Mozilla::PromptService::Register({
'http-on-examine-response' => sub {
my $http_channel = shift;
print $http_channel->responseStatus . " at " . $http_channel->uri . "\n";
},
});
# We don't need it anymore...
Mozilla::PromptService::Unregister($cookie);
DESCRIPTION
Mozilla::ObserverService uses Mozilla nsIObserverService to allow perl functions register for notifications.
For more detailed information see Mozilla's nsIObserverService documentation.
FUNCTIONS
Register($callbacks_hash)
Registers callbacks (values of the $callbacks_hash
) to the notifications specified by corresponding keys of the $callbacks_hash
.
Note that all of those callbacks receive various mozilla's objects as parameters.
Returns opaque cookie which can be used to unregister callbacks later.
Unregister($cookie)
Uses cookie obtained by Register
to unregister callbacks from observer service.
CAVEAT
At present only nsIHttpChannel::responseStatus and uri methods are wrapped around in perl code (as shown in SYNOPSIS).
SEE ALSO
Mozilla nsIObserverService documentation, Gtk2::MozEmbed, Mozilla::DOM, Mozilla::Mechanize, Mozilla::PromptService.
AUTHOR
Boris Sukholitko, <boriss@gmail.com>
COPYRIGHT AND LICENSE
Copyright (C) 2006 by Boris Sukholitko
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.