#!/usr/bin/perl
# Create the documentation for the Object::Realize::Later module.
# This script can be called as part of the mkdist procedure, but also
# on its own.

use warnings;
use strict;

use lib 'lib';           # current ORL source
use lib '../OODoc/lib';  # up-to-date OODoc version

use OODoc;

my $verbose      = $ARGV[0] || 0;

##### Synchronize these constants with the mkdist script.
my $workdir = '/tmp/ORL';

-d $workdir
|| mkdir $workdir
|| die "Cannot create directory $workdir: $!\n";

##### Other constants
my $pod_format   = 'pod2';         # install Bundle::Text::MagicTemplate first

#
# The OODoc object is created.  It is used to collect all the manual
# information in.
#

my $distribution = 'Object::Realize::Later';
my $doc  = OODoc->new
 ( project      => 'ORL lazy objects'
 , distribution => $distribution
 , verbose      => $verbose
 );

my $version = $doc->version;
print "*** Producing $distribution version $version\n" if $verbose;

#
# Reading all the manual pages
# This could be called more than once to combine different sets of
# manual pages in different formats.
#

print "* Processing files\n" if $verbose;
$doc->processFiles
  ( workdir => $workdir
  , select  => qr/^lib/
  );

#
# Prepare the collected information
# Expanding the inheritance relations and such, to simplify the
# production of manual pages in their different formats.
#

print "* Preparation phase\n" if $verbose;
$doc->prepare;

#
# Create POD
# Produce manual pages in the usual Perl style.
#

print "* Creating POD\n" if $verbose;

$doc->create
  ( $pod_format
  , workdir => $workdir
  , append  => <<TEXT);

=head1 REFERENCES

The html version of this module can be found in the website about
MailBox, L<http://perl.overmeer.net/mailbox/html/>.

=head1 COPYRIGHTS

Module version $version.
Written by Mark Overmeer (mark\@overmeer.net).  See the ChangeLog for
other contributors.

Copyright (c) 2003 by the author(s). All rights reserved.  This program
is free software; you can redistribute it and/or modify it under the
same terms as Perl itself.

TEXT
