package Mozilla::PromptService;

use 5.008007;
use strict;
use warnings;

require Exporter;

our @ISA = qw(Exporter);

# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.

# This allows declaration	use Mozilla::PromptService ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = ( 'all' => [ qw(
) ] );

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

our @EXPORT = qw(

our $VERSION = '0.05';

require XSLoader;
XSLoader::load('Mozilla::PromptService', $VERSION);

# Preloaded methods go here.

# Below is stub documentation for your module. You'd better edit it!

=head1 NAME

Mozilla::PromptService - Perl interface to the Mozilla nsIPromptService 


    use Mozilla::PromptService;

        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

=head1 METHODS

=head2 Register($callbacks_hash)

Registers callbacks (values of the C<$callbacks_hash>) to the prompt events
specified by corresponding keys of the C<$callbacks_hash>.

Each callback function gets parent window, dialog title, dialog text as its

Special C<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.

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

=head1 SEE ALSO

Mozilla nsIPromptService documentation at L<|>,

=head1 AUTHOR

Boris Sukholitko, E<lt>boris@gmail.comE<gt>


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.