#!/usr/bin/perl

=pod

=head1 NAME

orlite2pod - Documentation generator frontend for ORLite

=head1 SYNOPSIS

  orlite2pod --author="Adam Kennedy" Class::Name

=head1 DESCRIPTION

F<orlite2pod> is the command line front-end for L<ORLite::Pod>.

You should run this in the root directory of a distribution,
and provide it with the class in your distribution that is the
root of an L<ORLite> ORM.

An additional --author option can be set to set the name of the
author to be used when generating the POD files.

=cut

use 5.006;
use strict;
use Getopt::Long ();
use ORLite::Pod  ();

use vars qw{$VERSION};
BEGIN {
	$VERSION = '0.06';
}

my $AUTHOR = undef;
my $RT     = undef;
Getopt::Long::GetOptions(
	'author=s' => \$AUTHOR,
	'rt'       => \$RT,
);

unless ( -d 'lib' ) {
	die("Failed to find lib directory");
}
unshift @INC, 'lib';

my $class = shift;
eval "use $class;";
die $@ if $@;

print "Creating ORLite::Pod instance...\n";
my %params = (
	from => $class,
	to   => 'lib',
);
if ( defined $AUTHOR ) {
	$params{author} = $AUTHOR;
}
if ( $RT ) {
	$params{rt} = 1;
}
my $pod = ORLite::Pod->new( %params );

print "Starting POD generation run...\n";
$pod->run;

exit(0);

=pod

=head1 SUPPORT

Bugs should be reported via the CPAN bug tracker at

L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ORLite-Pod>

For other issues, contact the author.

=head1 AUTHOR

Adam Kennedy E<lt>adamk@cpan.orgE<gt>

=head1 COPYRIGHT

Copyright 2009 Adam Kennedy.

This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the
LICENSE file included with this module.

=cut
