#!/usr/bin/perl
use strict;
$|++;

my $VERSION = '0.03';

#----------------------------------------------------------------------------

=head1 NAME

cpanreps-update - script to update the CPAN Testers Reports website.

=head1 SYNOPSIS

  perl cpanreps-update -c=<file> -u=<file> [-d=<directory>]

=head1 DESCRIPTION

Using an update file, will update the specific distribution and author pages
for the website.

=cut

# -------------------------------------
# Library Modules

use FindBin;
use lib ("$FindBin::Bin/../lib", "../lib");
use CPAN::WWW::Testers;
use Getopt::ArgvFile default=>1;
use Getopt::Long;
use File::Path;

# -------------------------------------
# Variables

my (%options);

# -------------------------------------
# Program

##### INITIALISE #####

init_options();

##### MAIN #####

my $t = CPAN::WWW::Testers->new(%options);
$t->update($options{update});

# -------------------------------------
# Subroutines

sub init_options {
    GetOptions( \%options,
        'directory|d=s',
        'config|c=s',
        'update|u=s',
        'help|h',
        'version|v'
    );

    help(1) if($options{help});
    help(0) if($options{version});
}

sub help {
    my ($full,$mess) = @_;

    print "\n$mess\n"	if($mess);

    if($full) {
        print <<HERE;

Usage: $0 \\
         -c file -u file [-d directory] [-h] [-v]

  -c file       database configuration file [required]
  -u file       update file [required]
  -d directory  directory location of build files
  -h            this help screen
  -v            program version

HERE

    }

    print "$0 v$VERSION\n\n";
    exit(0);
}

__END__

=head1 BUGS, PATCHES & FIXES

There are no known bugs at the time of this release. However, if you spot a
bug or are experiencing difficulties, that is not explained within the POD
documentation, please send bug reports and patches to the RT Queue (see below).

Fixes are dependant upon their severity and my availablity. Should a fix not
be forthcoming, please feel free to (politely) remind me.

RT: http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-WWW-Testers

=head1 SEE ALSO

L<CPAN::WWW::Testers::Generator>
L<CPAN::Testers::WWW::Statistics>

F<http://www.cpantesters.org/>,
F<http://stats.cpantesters.org/>

=head1 AUTHOR

  Barbie <barbie@cpan.org>

=head1 COPYRIGHT AND LICENSE

  Copyright (C) 2008-2009 Barbie <barbie@cpan.org>

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

=cut
