Mozilla::PromptService - Perl interface to the Mozilla nsIPromptService
use Mozilla::PromptService; Mozilla::PromptService::Register({ Alert => sub { my ($parent, $title, $dialog_text) = @_; # do something smart on alert ... }, # Prompt callback should return result Prompt => sub { return "Prompt Result" }, DEFAULT => sub { my ($name, $parent, $title, $dialog_text) = @_; # some other confirmation is needed } }
Mozilla::PromptService uses Mozilla nsIPromptService to allow perl callbacks on prompt events.
For a much more detailed information on nsIPromptService see documentation on mozilla.org
Registers callbacks (values of the $callbacks_hash) to the prompt events specified by corresponding keys of the $callbacks_hash.
$callbacks_hash
Each callback function gets parent window, dialog title, dialog text as its parameters.
Special DEFAULT key can be used to provide one callback for all events. The callback function will get name of the event as its first parameter.
DEFAULT
Prompt callback should return result which will be passed back to JavaScript. If it returns undef cancel flag will be set.
Prompt
undef
Mozilla nsIPromptService documentation at mozilla.org, Gtk2::MozEmbed, Mozilla::DOM, Mozilla::Mechanize.
Boris Sukholitko, <boris@gmail.com>
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.
To install Mozilla::PromptService, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mozilla::PromptService
CPAN shell
perl -MCPAN -e shell install Mozilla::PromptService
For more information on module installation, please visit the detailed CPAN module installation guide.