#!/usr/bin/env perl

# Taco Perl server launch script.
# Copyright (C) 2013-2014 Graham Bell
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

=head1 NAME

taco-perl - Taco Perl server launch script

=head1 SYNOPSIS

    taco-perl [--help | --version]

=head1 DESCRIPTION

This script is intended to be run by a Taco client in order
to perform actions within the Perl interpreter.

=cut

use Alien::Taco::Server;
use Getopt::Long;
use Pod::Usage;

use strict;

my ($help, $version);
GetOptions(
    'help' => \$help,
    'version' => \$version,
);

if ($help) {
    pod2usage(-verbose => 2, -exitval => 0, -noperldoc => 1);
}
elsif ($version) {
    printf("taco-perl %s\n", $Alien::Taco::Server::VERSION)
}
else {
    my $server = new Alien::Taco::Server();
    $server->run();
}
