Zahatski Aliaksandr
and 1 contributors


Net::RTorrent - Perl interface to rtorrent via XML-RPC.


  #from http scgi gate
  my $obj =  new Net::RTorrent:: '';
  #from network address
  my $obj =  new Net::RTorrent:: '';
  #from UNIX socket
  my $obj =  new Net::RTorrent:: '/tmp/rtorrent.sock';
  #get completed torrents list
  my $dloads = $obj->get_downloads('complete');
  #get all torrents list
  my $dloads = $obj->get_downloads();
  #get stopped torrents list
  my $dloads = $obj->get_downloads('stopped');
  #fetch all items
  #or by hash_info
  #list oll hash_info
  my $keys = $dloads->list_ids;
  #upload remotely
  $obj->create( $torrent_raw );
  $obj->create( $data, 0 );


Perl interface to rtorrent via XML-RPC


Net::RTorrent - short way to create tools for rtorrent.


new URL

Creates a new client object that will route its requests to the URL provided.

create \$raw_data || new IO::File , [ start_now=>1||0 ],[ tag=><string>]

Load torrent from file descriptor or scalar ref.


start_now - start torent now

1 - start download now (default)

0 - not start download

tag - save <string> to rtorrent

For read tag value use:


delete (<info_hash1>[, <info_hash2> ... ])

Call d.erase on info_hashes.

return { <info_hashes> => <xml-rpc response value> }

list_ids ( [ <name of view> ])

Return list of rtorrent info_hashes for name of view. An empty string for name of view equals "default".

To get list of views names :

    xmlrpc view_list


get_downloads [ <view name > || 'default']

Return collection of downloads (" Net::RTorrent::Downloads").

To get list of view:

    xmlrpc view_list



Return system stat.

For example:

    print Dumper $obj->system_stat;


           'library_version' => '0.11.9',
           'max_memory_usage' => '-858993460', #  at my amd64
           'upload_rate' => '0',
           'name' => 'gate.home.zg:1378',
           'memory_usage' => '115867648',
           'download_rate' => '0',
           'hostname' => 'gate.home.zg',
           'pid' => '1378',
           'client_version' => '0.7.9',
           'safe_free_diskspace' => '652738560'

do_sys_mutlicall 'method1' =>[ <param1>, .. ], ...

Do XML::RPC system.multicall. Return ref to ARRAY of results

For sample.

 print Dumper $obj->do_sys_mutlicall(''=>[], 'system.hostname'=>[]);

Will return:


Setting up rtorrent

If you are compiling from rtorrent's source code, this is done during the configuration step by adding the flag --with-xmlrpc-c to the configure step. Example ./configure --with-xmlrpc-c. See

Setup your rtorrent and Web server. My tips:


   scgi_port = 
   #for complete erase
   on_erase = erase_complete,"execute=rm,-rf,$d.get_base_path="
   #or for save backup 
   on_erase = move_complete,"execute=mv,-n,$d.get_base_path=,~/erased/ ;d.set_directory=~/erased"


    LoadModule scgi_module        libexec/apache2/
    <IfModule  mod_scgi.c>
      SCGIMount /scgitest
      <Location "/scgitest">
         SCGIHandler On

My url for XML::RPC is

Use xmlrpc ( ) for tests:

    xmlrpc system.listMethods


Net::RTorrent::DItem, Net::RTorrent::Downloads,


Zahatski Aliaksandr, <>


Copyright 2008-2009 by Zahatski Aliaksandr

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 210:

L<> starts or ends with whitespace