NAME

Mozilla::PromptService - Perl interface to the Mozilla nsIPromptService

SYNOPSIS

    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
        }
    }

DESCRIPTION

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

METHODS

Register($callbacks_hash)

Registers callbacks (values of the $callbacks_hash) to the prompt events specified by corresponding keys of the $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.

Prompt callback should return result which will be passed back to JavaScript. If it returns undef cancel flag will be set.

SEE ALSO

Mozilla nsIPromptService documentation at mozilla.org, Gtk2::MozEmbed, Mozilla::DOM, Mozilla::Mechanize.

AUTHOR

Boris Sukholitko, <boris@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.