+webgui.pl - mount WebGUI templates as filesystem
+
+=head1 SYNOPSIS
+
+ webgui.pl /data/WebGUI/etc/webgui.conf /mnt
+
+=head1 DESCRIPTION
+
+With this script, you can utilize C<Fuse> and C<Fuse::DBI> modules to mount
+templates from WebGUI and edit them using command-line utilities (like C<vi>
+or C<ftp>).
+
+It will present templates in WebGUI as directory tree consisting of
+directories (which represent template's namespace) and files (which are
+templates from database). If template name has slash (C</>) in name, deeper
+directories will be created.
+
+Template files will have correct lengths and write permissions which are
+specified in WebGUI database.
+
+=head2 Fuse module
+
+C<Fuse::DBI> module (which is core of this utility) uses C<Fuse> perl
+bindings. Perl bindings are rather new addition to C<Fuse>, so
+you will need recent CVS version of C<Fuse>. Current stable version doesn't
+include perl binding, so you will probably have to compile C<Fuse> yourself
+(see FUSE documentation for details about compilation and installation).
+
+After compilation and installation of C<fuse> kernel module and C<Fuse> perl
+bindings for it, you will have to load C<fuse> module into kernel. For that,
+you will have to be root. If you are not administrator on particular
+machine, ask your admin to install and load C<fuse> module for you.
+
+If you used C<fusermount> command before running this script, module will be
+already loaded.
+
+=head2 unsupported operations
+
+There is no support for creation of new templates, renaming, or deleting.
+Although those operations map nicely to file system semantics there are still
+possible only using WebGUI web interface.
+
+=head2 unlink to invalidate cache
+
+Unlink command (C<rm>) is implemented on files with special function: it
+will remove in-memory cache of particular template and reload it from
+database. That enables usage of web interface to make small changes and then
+continuing editing using this script without restarting it.
+
+In-memory cache is populated with data about available templates when you
+start this script. Currently only way to refresh template list (after you
+create copy of template through web interface) is to remove directory using
+C<rmdir> or C<rm -rf>.
+
+B<Don't panic!> Destructive operations in filesystem (C<rm> and C<rmdir>)
+just invalidate in-memory cache and re-read data from database (this will
+also change ctime of file, so your editor will probably notice that file has
+changed).
+
+In-memory cache is used to speed up operations like grep on templates. If it
+wasn't there, grep wouldn't be useful at all. I think this is acceptable
+compromise.
+
+=head2 invalidating of on-disk templates
+
+Every write operation will erase all templates on disk (so that next reload
+on browser will show your changes). It would be better if just changed
+template is erased, but this works well enough. You might notice performance
+penalty of this simplification if you are running very loaded production
+site.
+
+You have to have write permission on C<uploads/temp/templates/> directory
+for your WebGUI instance for this to work. If you don't C<Fuse::DBI> will
+complain.
+
+=head2 supported databases
+
+This script have embedded SQL queries for MySQL and PostgreSQL. Other databases
+could be supported easily. Contributions are welcomed.
+
+=head2 database transactions
+
+C<Fuse::DBI> uses transactions (if your database supports them) to prevent
+accidental corruption of data by reading old version. Depending on type of
+database back-end, MySQL users might be out of luck.
+
+=head2 recovering from errors
+
+B<Transport endpoint is not connected> is very often error when Fuse perl
+bindings exit without clean umount (through C<Fuse::DBI> C<umount> method or
+with C<fusermount -u /mnt> command).