package RHNSession; use strict; use Exporter; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); $VERSION = 1.0; @ISA = qw(Exporter); @EXPORT = (); @EXPORT_OK = qw(Session); %EXPORT_TAGS = ( DEFAULT => [qw(&Session)] ); sub Session { open(IN, "/etc/sysconfig/spacewalk_api.conf") or die "Spacewalk API config not found: $!"; $_ = ; my ($server, $user, $pass) = (split); close(IN); my $client = new Frontier::Client(url => "http://$server/rpc/api"); my $session = $client->call('auth.login', $user, $pass); return ($client, $session); }