Skip to content

Instantly share code, notes, and snippets.

@mlbright
Created July 15, 2013 20:03
Show Gist options
  • Save mlbright/6002950 to your computer and use it in GitHub Desktop.
Save mlbright/6002950 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use BuildForge::Services;
use Try::Tiny;
use Config::Simple;
my $cfg = Config::Simple->new( $0 . '.cfg' );
my $server = $cfg->param('server');
my $user = $cfg->param('user');
my $pass = $cfg->param('pass');
my ($conn);
$conn = try { BuildForge::Services::Connection->new($server) }
catch {
say "Error connecting to $server ... Bailing.\n";
exit(1);
};
my $token = try { $conn->authUser( $user, $pass ) }
catch {
say "Could not authenticate to $server ... Bailing.\n";
try { $conn->close() };
exit(1);
};
# No need to logout, just close connection
try { $conn->close() };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment