#!/usr/bin/perl
use strict;
use FindBin;
use lib(File::Spec->catdir($FindBin::Bin, File::Spec->updir, 'lib'));
use Gungho;
{
my ($config, $version, $help);
# Default config file is expected to be at the current directory
$config = do {
my $file;
foreach my $suffix qw(yml yaml) {
my $test = "config.$suffix";
if (-f $test) {
$file = $test;
last;
}
}
$file;
};
if (! GetOptions(
'--config=s', => \$config,
'--version!', => \$version,
'--help!' => \$help
)) {
exit 1;
}
if ($version) {
print <<EOM;
gungho - An Extensible, High-Performance Web Crawler Framework
version: $Gungho::VERSION
EOM
exit 0;
}
if ($help) {
pod2usage(-verbose => 2);
}
if (! $config) {
pod2usage(-verbose => 0);
}
Gungho->run($config);
}
__END__
=head1 NAME
gungho - An Extensible, High-Performance Web Crawler Framework
=head1 SYNOPSIS
gungho -c config.yml
gungho -v
gungho -h
=head1 DESCRIPTION
gungho is the command line tool to run the Gungho web crawler framework.
=head1 OPTIONS
=head2 --config | -c
Specify the config file to read from. By default, gungho attempts to read
a config file named config.yml in the current directory
=head2 --version | -v
Print out the version and exit
=head2 --help | -h
Print out this help message and exit
=head1 AUTHOR
Gungho is Copyright (c) 2007 Daisuke Maki <daisuke@endeworks.jp> Endeworks Ltd.
All rights reserved.
=head1 LICENSE
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut