package Socialtext::Resting::Getopt; use strict; use warnings; use base 'Exporter'; use Socialtext::Resting::DefaultRester; use Getopt::Long qw/:config/; our @EXPORT_OK = qw/get_rester rester_usage/; =head1 NAME Socialtext::Resting::Getopt - Handle command line rester args =head1 SYNOPSIS use Socialtext::Resting::Getopt qw/get_rester/; my $rester = get_rester(); =cut our $VERSION = '0.01'; =head1 FUNCTIONS =head2 get_rester Create a new rester from command line args. =cut sub get_rester { my %opts = @_; Getopt::Long::Configure('pass_through'); GetOptions( \%opts, 'server=s', 'workspace=s', 'username=s', 'password=s', 'rester-config=s', ); Getopt::Long::Configure('no_pass_through'); return Socialtext::Resting::DefaultRester->new(%opts); } =head2 rester_usage Return usage text for the arguments accepted by this module. =cut sub rester_usage { my $rc_file = $Socialtext::Resting::DefaultRester::CONFIG_FILE; return < >> =head1 LICENSE This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1;