use Data::Dump;
BEGIN {
package Local::Finance::MtGox;
use base 'Finance::MtGox';
sub _build_api_method_uri {
return URI->new("https://h.wrttn.me/post");
}
}
####
my $mtgox = Local::Finance::MtGox->new({ key => 'key', secret => 'secret' });
$mtgox->{mech}->ssl_opts(verify_hostname => 0);
dd $mtgox->call_auth('getFunds');
####
use AnyEvent;
use AnyEvent::Util 'fork_call';
my $mtgox = Local::Finance::MtGox->new({ key => 'key', secret => 'secret' });
$mtgox->{mech}->ssl_opts(verify_hostname => 0);
my $cv = AE::cv;
fork_call { $mtgox->call_auth('getFunds') } sub { dd @_; $cv->send };
$cv->wait;
####
use Coro;
use LWP::Protocol::AnyEvent::http;
my $mtgox = Local::Finance::MtGox->new({ key => 'key', secret => 'secret' });
my $coro = async {
say "before";
$mtgox->call_auth('getFunds');
};
dd $coro->join;
####
use AnyEvent;
use AnyEvent::HTTP::Request;
use AnyEvent::HTTP::Response;
my $mtgox = Local::Finance::MtGox->new({ key => 'key', secret => 'secret' });
my $cv = AE::cv;
my $req = AnyEvent::HTTP::Request->new(
# Returns an HTTP::Request
$mtgox->_build_api_method_request(POST => 'getFunds'),
{
cb => sub {
my $res = AnyEvent::HTTP::Response->new(@_)->to_http_message;
dd $res;
$cv->send;
}
}
);
$req->send;
$cv->wait;