NAME POE::Component::SmokeBox::Uploads::Rsync - Obtain uploaded CPAN modules via rsync VERSION This document describes v1.000 of POE::Component::SmokeBox::Uploads::Rsync - released March 31, 2011 as part of POE-Component-SmokeBox-Uploads-Rsync. SYNOPSIS #!/usr/bin/perl use strict; use warnings; use POE; use POE::Component::SmokeBox::Uploads::Rsync; # Create our session to receive events from rsync POE::Session->create( package_states => [ 'main' => [qw(_start upload)], ], ); sub _start { # Tell the poco to start it's stuff! POE::Component::SmokeBox::Uploads::Rsync->spawn( # thanks to DAGOLDEN for allowing us to use his mirror! 'rsync_src' => 'cpan.dagolden.com::CPAN', ) or die "Unable to spawn the poco-rsync!"; return; } sub upload { print $_[ARG0], "\n"; return; } POE::Kernel->run; DESCRIPTION POE::Component::SmokeBox::Uploads::Rsync is a POE component that alerts newly uploaded CPAN distributions. It obtains this information by running rsync against a CPAN mirror. This effectively keeps your local CPAN mirror up-to-date too! This is only for the "CPAN/authors/id" directory, to make it easier on the rsync process. If you want to keep your entire mirror up-to-date, please use your normal ( crontabbed? ) rsync script and tell it to exclude the "authors/id" directory to prevent missed uploads. Really, all you have to do is load the module and call it's spawn() method: use POE::Component::SmokeBox::Uploads::Rsync; POE::Component::SmokeBox::Uploads::Rsync->spawn( ... ); This method will return failure on errors or return success. Normally you just need to set the rsync server. ( rsync_src ) spawn() This constructor accepts either a hashref or a hash, valid options are: alias This sets the alias of the session. The default is: SmokeBox-Rsync rsync_src This sets the rsync source ( the server you will be mirroring from ) and it is a mandatory parameter. For a list of valid rsync mirrors, please consult the mirror list. The default is: undefined This component will automatically append '/authors/id' to the src, please don't add it yourself. rsync_dst This sets the local rsync destination ( where your local CPAN mirror resides ) The default is: $ENV{HOME}/CPAN This component will automatically append '/authors' to the dst, please don't add it yourself. rsync This sets the rsync options. Normally you do not need to touch this, but if you do - please be aware that your options clobbers the default values! Please look at the File::Rsync manpage for the options. Again, touch this if you know what you are doing! The default is: { archive => 1, compress => 1, omit-dir-times => 1, itemize-changes => 1, timeout => 10 * 60, # 10min contimeout => 2 * 60, # 2min literal => [ qw( --no-motd ) ], } NOTE: The usage of "omit-dir-times/itemize-changes/contimeout" means you need a rsync newer than v3.0.0! interval This sets the seconds between rsync mirror executions. Please don't set it to a low value unless you have permission from the mirror admin! The default is: 3600 ( 1 hour ) event This sets the event which will receive notification about uploaded dists. It will receive one argument in ARG0, which is a single string. An example is: V/VP/VPIT/CPANPLUS-Dist-Gentoo-0.07.tar.gz The default is: upload session This sets the session which will receive the notification event. You can either use a POE session id, alias, or reference. You can just spawn the component inside another session and it will automatically receive the notifications. The default is: undef ( caller session ) rsyncdone This sets an additional event when the rsync process is done executing. It will receive a hashref in ARG0 which details some information. An example is: { 'status' => 1, # boolean value whether the rsync run was successful or not 'exit' => 0, # exit code of the rsync process, useful to look up rsync errors ( already bit-shifted! ) 'exit_str' => 'Success', # stringified exit code of the rsync process 'starttime' => 1260432932, # self-explanatory 'stoptime' => 1260432965, # self-explanatory 'dists' => 7, # number of new distributions uploaded to CPAN } NOTE: In my testing sometimes rsync throws an exit code of 23 ( Partial transfer due to error ) or 24 ( Partial transfer due to vanished source files ), this module automatically treats them as "success" and sets the exit code to 0. This is caused by the intricacies of rsync trying to mirror some forbidden files and deletions on the host. See for more info. The default is: undef ( not enabled ) Commands There is only one command you can use, as this is a very simple module. shutdown Tells this module to shut down the underlying rsync session and terminate itself. $_[KERNEL]->post( 'SmokeBox-Rsync', 'shutdown' ); Module Notes You can enable debugging mode by doing this: sub POE::Component::SmokeBox::Uploads::Rsync::DEBUG () { 1 } use POE::Component::SmokeBox::Uploads::Rsync; SEE ALSO Please see those modules/websites for more information related to this module. * POE::Component::SmokeBox * File::Rsync SUPPORT Perldoc You can find documentation for this module with the perldoc command. perldoc POE::Component::SmokeBox::Uploads::Rsync Websites The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources. * Search CPAN * RT: CPAN's Bug Tracker * AnnoCPAN: Annotated CPAN documentation * CPAN Ratings * CPAN Forum * CPANTS Kwalitee * CPAN Testers Results * CPAN Testers Matrix Email You can email the author of this module at "APOCAL at cpan.org" asking for help with any problems you have. Internet Relay Chat You can get live help by using IRC ( Internet Relay Chat ). If you don't know what IRC is, please read this excellent guide: . Please be courteous and patient when talking to us, as we might be busy or sleeping! You can join those networks/channels and get help: * irc.perl.org You can connect to the server at 'irc.perl.org' and join this channel: #perl-help then talk to this person for help: Apocalypse. * irc.freenode.net You can connect to the server at 'irc.freenode.net' and join this channel: #perl then talk to this person for help: Apocal. * irc.efnet.org You can connect to the server at 'irc.efnet.org' and join this channel: #perl then talk to this person for help: Ap0cal. Bugs / Feature Requests Please report any bugs or feature requests by email to "bug-poe-component-smokebox-uploads-rsync at rt.cpan.org", or through the web interface at . You will be automatically notified of any progress on the request by the system. Source Code The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :) git clone git://github.com/apocalypse/perl-poe-smokebox-uploads-rsync.git AUTHOR Apocalypse COPYRIGHT AND LICENSE This software is copyright (c) 2011 by Apocalypse. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. The full text of the license can be found in the LICENSE file included with this distribution. DISCLAIMER OF WARRANTY BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.