Alien-InteractiveBrokers

 view release on metacpan or  search on metacpan

bin/ibapi-config  view on Meta::CPAN

{
    print $ibapi->version();
}
else
{
    usage( 2 );
}

print "\n" if( -t STDIN );

exit( 0 );

###
### Subs
###

sub prog_header
{
    return $PROGNAME . ' v' . $VERSION . ' - ' . $PROGDESC . "\n";
}

# Parse and process command-line arguments
sub get_opts
{
    my( %opt_results, %opt_retval );

    # get the parsed options from Getopt::Long
    GetOptions( \%opt_results, map { $args{$_}->{optspec} } keys( %args ) )
        or usage( 3 );

    # Asked for help?
    usage( 0 ) if( $opt_results{help} );

    # Start with defaults
    for( keys %args )
    {
        $opt_retval{$_} = $args{$_}->{default}
            if( exists( $args{$_}->{default} ) );
    }

    # Set actual values
    $opt_retval{$_} = $opt_results{$_}
        for( keys( %opt_results ) );

    return( \%opt_retval );
}

# Get rid of Pod::Usage::pod2usage formatting dependency
sub usage
{
    my $exitval = defined( $_[0] ) ? $_[0] : 42;

    print prog_header(), "\n";
    print "Usage:\n\t\$ $PROGNAME OPTION\n\n";
    print "Options:\n";

    for( @args )
    {
        my @opts = split( /\|/, $args{$_}->{optspec} );
        $opts[0] =~ s/[\=\:].*//;
        my( $single ) = grep { length( $_ ) <= 2 } @opts;
        $single = substr( $opts[0], 0, 1 )
            unless( $single );
        printf( "  --%s | -%s:\n    %s\n\n",
                $opts[0], $single, $args{$_}->{desc} );
    }

    exit( $exitval );
}

__END__

=pod

=head1 NAME

ibapi-config - Command-line InteractiveBrokers API configuration info utility

=head1 USAGE

    $ ibapi-config OPTION

=head1 DESCRIPTION

This tool, as part of the L<Alien::InteractiveBrokers> distribution, is
for convenient printing of the installed IB API locations, for use in
Makefiles, shell scripts, etc.

It prints several useful options, and is used extensively during the
build process of L<Finance::InteractiveBrokers::SWIG>.

=head1 OPTIONS

=head2 --path

Print the base path of the IBJts directory.

=head2 --includes

Print a list of -I include directives.

=head2 --classpath

Print the path of the jtsclient.jar file, for the Java CLASSPATH var.

=head2 --version

Print the version of the installed IB API (not this program).

=head2 --help | --?

Show a brief help message.

=head1 SEE ALSO

L<Alien::InteractiveBrokers>

L<POE::Component::Client::InteractiveBrokers>

L<Finance::InteractiveBrokers::API>



( run in 0.520 second using v1.01-cache-2.11-cpan-140bd7fdf52 )