Created
July 15, 2013 20:03
-
-
Save mlbright/6002950 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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