ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-FCP/FCP.pm
(Generate patch)

Comparing AnyEvent-FCP/FCP.pm (file contents):
Revision 1.3 by root, Tue Jul 28 02:20:51 2009 UTC vs.
Revision 1.4 by root, Wed Jul 29 09:25:46 2009 UTC

51use AnyEvent; 51use AnyEvent;
52use AnyEvent::Handle; 52use AnyEvent::Handle;
53 53
54sub touc($) { 54sub touc($) {
55 local $_ = shift; 55 local $_ = shift;
56 1 while s/((?:^|_)(?:svk|chk|uri|fcp)(?:_|$))/\U$1/; 56 1 while s/((?:^|_)(?:svk|chk|uri|fcp|ds|mime)(?:_|$))/\U$1/;
57 s/(?:^|_)(.)/\U$1/g; 57 s/(?:^|_)(.)/\U$1/g;
58 $_ 58 $_
59} 59}
60 60
61sub tolc($) { 61sub tolc($) {
62 local $_ = shift; 62 local $_ = shift;
63 1 while s/(SVK|CHK|URI|FCP)([^_])/$1\_$2/i; 63 1 while s/(SVK|CHK|URI|FCP|DS|MIME)([^_])/$1\_$2/i;
64 1 while s/([^_])(SVK|CHK|URI|FCP)/$1\_$2/i; 64 1 while s/([^_])(SVK|CHK|URI|FCP|DS|MIME)/$1\_$2/i;
65 s/(?<=[a-z])(?=[A-Z])/_/g; 65 s/(?<=[a-z])(?=[A-Z])/_/g;
66 lc 66 lc
67} 67}
68 68
69=item $fcp = new AnyEvent::FCP [host => $host][, port => $port][, progress => \&cb][, name => $name] 69=item $fcp = new AnyEvent::FCP [host => $host][, port => $port][, progress => \&cb][, name => $name]
365 365
366 $cv->($kv); 366 $cv->($kv);
367 1 367 1
368 }, 368 },
369 ); 369 );
370
371 $cv->();
372}; 370};
373 371
374=item $cv = $fcp->modify_persistent_request ($global, $identifier[, $client_token[, $priority_class]]) 372=item $cv = $fcp->modify_persistent_request ($global, $identifier[, $client_token[, $priority_class]])
375 373
376=item $status = $fcp->modify_persistent_request_sync ($global, $identifier[, $client_token[, $priority_class]]) 374=item $sync = $fcp->modify_persistent_request_sync ($global, $identifier[, $client_token[, $priority_class]])
377 375
378=cut 376=cut
379 377
380_txn modify_persistent_request => sub { 378_txn modify_persistent_request => sub {
381 my ($self, $cv, $global, $identifier, $client_token, $priority_class) = @_; 379 my ($self, $cv, $global, $identifier, $client_token, $priority_class) = @_;
382 380
383 $self->send_msg (modify_persistent_request => 381 $self->send_msg (modify_persistent_request =>
384 global => $global ? "true" : "false", 382 global => $global ? "true" : "false",
385 identifier => $identifier,
386 defined $client_token ? (client_token => $client_token ) : (), 383 defined $client_token ? (client_token => $client_token ) : (),
387 defined $priority_class ? (priority_class => $priority_class) : (), 384 defined $priority_class ? (priority_class => $priority_class) : (),
385 identifier => $identifier,
388 id_cb => sub { 386 id_cb => sub {
389 my ($self, $type, $kv, $rdata) = @_; 387 my ($self, $type, $kv, $rdata) = @_;
390 388
391 $cv->($kv); 389 $cv->($kv);
392 1 390 1
393 }, 391 },
394 ); 392 );
395
396 $cv->();
397}; 393};
398 394
399=item $cv = $fcp->get_plugin_info ($name, $detailed) 395=item $cv = $fcp->get_plugin_info ($name, $detailed)
400 396
401=item $info = $fcp->get_plugin_info_sync ($name, $detailed) 397=item $info = $fcp->get_plugin_info_sync ($name, $detailed)
413 409
414 $cv->($kv); 410 $cv->($kv);
415 1 411 1
416 }, 412 },
417 ); 413 );
414};
418 415
419 $cv->(); 416=item $cv = $fcp->client_get ($uri, $identifier, %kv)
417
418=item $status = $fcp->client_get_sync ($uri, $identifier, %kv)
419
420%kv can contain (L<http://wiki.freenetproject.org/FCP2p0ClientGet>).
421
422ignore_ds, ds_only, verbosity, max_size, max_temp_size, max_retries,
423priority_class, persistence, client_token, global, return_type,
424binary_blob, allowed_mime_types, filename, temp_filename
425
426=cut
427
428_txn client_get => sub {
429 my ($self, $cv, $uri, $identifier, %kv) = @_;
430
431 $self->send_msg (client_get =>
432 %kv,
433 uri => $uri,
434 identifier => $identifier,
435 id_cb => sub {
436 my ($self, $type, $kv, $rdata) = @_;
437
438 $cv->($kv);
439 1
440 },
441 );
420}; 442};
421 443
422=back 444=back
423 445
424=head1 EXAMPLE PROGRAM 446=head1 EXAMPLE PROGRAM

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines