Skip to content

Commit

Permalink
Changes for module API
Browse files Browse the repository at this point in the history
- also some erro handling to prevent bad usage inserts
  • Loading branch information
ajithhub committed Dec 7, 2010
1 parent a866fdf commit 2bfca20
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions poll_balance.pl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@


print YAML::Dump($username, $password); print YAML::Dump($username, $password);


my $account = Business::Billing::TMobile::USA->new(debug =>0); my $account = Business::Billing::TMobile::USA->new(debug =>1);


my $user = $account->login(user => $username, password => $password) my $user = $account->login(username => $username, password => $password)
or die "Problem logging in"; or die "Problem logging in";




Expand Down Expand Up @@ -62,13 +62,18 @@
or die "Problem inserting"; or die "Problem inserting";
} }


printf "Go rowid %s", $user_id; printf "Go rowid %s\n", $user_id;



my $prepay_info = $account->get_prepay_details(); my $prepay_info = $account->get_prepay_details();


my $exp_time = Date::Parse::str2time($prepay_info->{expiration}); my $exp_time = Date::Parse::str2time($prepay_info->{expiration});


for my $key (qw(minutes, messages, balance)) {
exists $prepay_info->{$key} and
defined $prepay_info->{$key}
or die "Missing data, can't update db: %s", $key;
}

$ins_usage_sth->execute( $ins_usage_sth->execute(
$user_id, $user_id,
$prepay_info->{minutes}, $prepay_info->{minutes},
Expand Down
Binary file modified usage.db
Binary file not shown.

0 comments on commit 2bfca20

Please sign in to comment.