AnyEvent-JSONRPC

 view release on metacpan or  search on metacpan

lib/AnyEvent/JSONRPC/HTTP/Client.pm  view on Meta::CPAN

151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
__PACKAGE__->meta->make_immutable;
 
__END__
 
=encoding utf-8
 
=begin stopwords
 
AnyEvent Coro JSONRPC Hostname Str HTTP HTTP-based
blockingly condvar condvars coroutine unix
 
=end stopwords
 
=head1 NAME
 
AnyEvent::JSONRPC::HTTP::Client - Simple HTTP-based JSONRPC client
 
=head1 SYNOPSIS
 
    use AnyEvent::JSONRPC::HTTP::Client;

lib/AnyEvent/JSONRPC/HTTP/Client.pm  view on Meta::CPAN

199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
=over 4
 
=item Either you're in a main program,
 
Main programs are "allowed to call C<recv> blockingly", according to the
author of L<AnyEvent>.
 
=item or you're in a Coro + AnyEvent environment.
 
When you call C<recv> inside a coroutine, only that coroutine is blocked
while other coroutines remain active.  Thus, the program as a whole is
still responsive.
 
=back
 
If you're not using Coro, and you don't want your whole program to block,
what you should do is call C<cb> on the condvar, and give it a coderef to
execute when the results come back.  The coderef will be given a condvar
as a parameter, and it can call C<recv> on it to get the data.  The final
example in the SYNOPSIS gives a brief example of this.

lib/AnyEvent/JSONRPC/TCP/Client.pm  view on Meta::CPAN

199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
__PACKAGE__->meta->make_immutable;
 
__END__
 
=encoding utf-8
 
=begin stopwords
 
AnyEvent Coro JSONRPC Hostname Str TCP TCP-based
blockingly condvar condvars coroutine unix
 
=end stopwords
 
=head1 NAME
 
AnyEvent::JSONRPC::TCP::Client - Simple TCP-based JSONRPC client
 
=head1 SYNOPSIS
 
    use AnyEvent::JSONRPC::TCP::Client;

lib/AnyEvent/JSONRPC/TCP/Client.pm  view on Meta::CPAN

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
=over 4
 
=item Either you're in a main program,
 
Main programs are "allowed to call C<recv> blockingly", according to the
author of L<AnyEvent>.
 
=item or you're in a Coro + AnyEvent environment.
 
When you call C<recv> inside a coroutine, only that coroutine is blocked
while other coroutines remain active.  Thus, the program as a whole is
still responsive.
 
=back
 
If you're not using Coro, and you don't want your whole program to block,
what you should do is call C<cb> on the condvar, and give it a coderef to
execute when the results come back.  The coderef will be given a condvar
as a parameter, and it can call C<recv> on it to get the data.  The final
example in the SYNOPSIS gives a brief example of this.



( run in 0.235 second using v1.01-cache-2.11-cpan-8d75d55dd25 )