aboboras has asked for the wisdom of the Perl Monks concerning the following question:

Edited:

I'm using the module Finance Bitcoin Api.

$btc = $data{"amount"}; $btc = substr($btc,0,32); chomp($btc); $btc = sprintf('%.8f', $btc); $call = $api->call('sendfrom', $sender_account, $receiving_address,$bt +c,6);
The api call above does not work, however if i substitute the variable $btc for hardcoded value it does work fine. I found the same issue in PHP and the problem was passing a string instead of a numerical. Any wisdom? I'm stuck on it.
Thanks.

Replies are listed 'Best First'.
Re: JSON / Bitcoind API 500 internal error
by marto (Cardinal) on Mar 04, 2014 at 18:16 UTC

    Internal server errors occur server side, you should check the appriate server logs which should tell you why. The Finance::Bitcoin::API docs suggest chcking error for error messages which would be worth while.

      Do you know the proper way of cheking for errors? The way i'm doing $error = $call->{'error'}; is returning null. The Apache log does not have any related error.
        Looking at the docs, it looks like the proper way would be to call $api->error() if $api->call(...) returns undef.

        If the apache error log has nothing consider checking that your configuration is set to log errors correctly. The module documentation has example usage for the error method.

Re: JSON / Bitcoind API 500 internal error
by tobyink (Canon) on Mar 05, 2014 at 09:40 UTC

    I think the issue is likely that the JSON module which Finance::Bitcoin uses (via the JSON RPC module) is treating your $btc as a string instead of a number. Passing $btc+0 may fix things.

    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name