+$listen = ':9000';
+my $reader;
+my $koha_url = 'http://ffzg.koha-dev.rot13.org:8080';
+# internal URL so we can find local address of machine and vmware NAT
+my $rfid_url = 'http://rfid.koha-dev.vbz.ffzg.hr';
+
+use Getopt::Long;
+
+GetOptions(
+ 'debug!' => \$debug,
+ 'listen=s', => \$listen,
+ 'reader=s', => \$reader,
+ 'koha=s', => \$koha_url,
+) || die $!;
+
+our $rfid_sid_cache;
+
+sub rfid_borrower {
+ my $hash = shift;
+ if ( my $json = $rfid_sid_cache->{ $hash->{sid} } ) {
+ return $json;
+ }
+ my $ua = LWP::UserAgent->new;
+ my $url = URI->new( $koha_url . '/cgi-bin/koha/ffzg/rfid/borrower.pl');
+ $url->query_form(
+ RFID_SID => $hash->{sid}
+ , OIB => $hash->{OIB}
+ , JMBAG => $hash->{JMBAG}
+ );
+ warn "GET ",$url->as_string;
+ my $response = $ua->get($url);
+ if ( $response->is_success ) {
+ my $json = decode_json $response->decoded_content;
+ $rfid_sid_cache->{ $hash->{sid} } = $json;
+ return $json;
+ } else {
+ warn "ERROR ", $response->status_line;
+ }
+}