Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
executable file 40 lines (27 sloc) 888 Bytes
#!/usr/bin/env perl
## Update Card Numbers from CSV
# Uses RPC::XML -
# to support https connections also install LWP::Protocol::https
# Usage: sample.csv, or reads account details from stdin
use RPC::XML;
use RPC::XML::Client;
use strict;
my $server = "localhost"; my $port="9191";
my $token = "password";
my $url = "http://${server}:${port}/rpc/api/xmlrpc";
my $client = RPC::XML::Client->new($url);
my $updated;
while (<>){
my ($user, $cardno) = split ",";
my $resp = $client->send_request('api.setUserProperty', $token, $user,
'card-number', RPC::XML::string->new($cardno));
die "$resp\n" unless ref($resp);
if ($resp->value == 1){
} else {
print STDERR "Failed to update $user\n";
print "\nFinshed: $updated users have been updated\n";
You can’t perform that action at this time.