The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
Mozilla::DOM
------------

This module wraps the Mozilla DOM interface in Perl.
In conjuction with an embedded Gecko widget (e.g. Gtk2::MozEmbed),
you can use Perl to manipulate the browser DOM, handle DOM signals,
and create events such as mouse clicks -- all within a Mozilla-like
browser (so it also does JavaScript). See `perldoc Mozilla::DOM`
for more details. 

There are examples in the `examples' directory showing how
to use this module with Gtk2::MozEmbed. See the README file
in that directory. Check out Mozilla::Mechanize for a WWW::Mechanize-like
module that uses Mozilla::DOM. See `perldoc Mozilla::DOM::index` for
a list of all the POD files distributed with this module.


Dependencies
------------

You might have to manually install ExtUtils::Depends and ExtUtils::PkgConfig
before anything else. Sorry about that. You'll also have to install Mozilla
with its development headers (I think you can also just install the SDK).

Mozilla::DOM depends on:

  ExtUtils::Depends
  ExtUtils::PkgConfig
  `pkg-config --modversion mozilla-xpcom` >= 1.7
    or
  `pkg-config --modversion firefox-xpcom` >= 1.0

(I have no idea if Firefox works.)


Installation
------------

Note: I've only built this on Debian Linux with Mozilla 1.7.5
and 1.7.10. People running Gentoo with Mozilla 1.7.6 have reported
being able to build it.

To install Mozilla::DOM, run the following commands:

  perl Makefile.PL
  make           (this can take a while)
  make test      (not really any tests yet)
  make install   (as root)

(See "Dependencies" above.)

For this module to be useful, you'll probably also want
to build and install Gtk2::MozEmbed (> 0.03) *after* you
install this. That module includes Mozilla::DOM (through
the magic of ExtUtils::Depends) if it's already installed.
IMPORTANT: if you upgrade Mozilla::DOM, you also need
to rebuild and reinstall Gtk2::MozEmbed.


Experimental features
---------------------

Some features are added "experimentally". These are generally ones
that are either known not to be completely working, or I'm not sure
if they're really done right. I'll try to mark these clearly in the
documentation as experimental. To enable an experimental feature,
you pass an argument on the command line, for example

  perl Makefile.PL DEFINE="-DMDEXP_EVENT_LISTENER"

where "MDEXP" is just a (namespace-like) prefix and the rest
of the name identifies which feature is being enabled. Currently
the following features are experimental: EVENT_LISTENER.


Troubleshooting
---------------

A common problem seems to be that header files are put in different
directories for different installations of Mozilla. If so, you'll
get an error like

  mozilladom2perl.h:37:27: nsIWebBrowser.h: No such file or directory
  mozilladom2perl.h:38:26: nsISelection.h: No such file or directory

If this happens, do

  find . -name 'nsIWebBrowser.h'

from within the Mozilla include directory (e.g. /usr/include/mozilla).
It will probably be under a subdirectory of /usr/include/mozilla/.
Try adding that subdirectory to the set_inc method in Makefile.PL,
and please report it to me.

If you find that this module segfaults on Ubuntu, try this solution
from Boris Sukholitko which worked for me:
- add /usr/lib/firefox to /etc/ld.so.conf
- run /sbin/ldconfig
- remove /usr/lib/firefox/components/compreg.dat (regenerates itself)


Bugs
----

You can send bugs to me directly, or through RT at
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Mozilla-DOM .


Contact
-------

Scott Lanning  lannings at who dot int

You can also use the CPAN Forum at
http://www.cpanforum.com/dist/Mozilla-DOM .

I (slanning) am usually on IRC at irc.perl.org,
where we could create a channel.