NAME
POE::Component::SmokeBox::Uploads::Rsync - Obtain uploaded CPAN modules
via rsync
VERSION
This document describes v1.001 of POE::Component::SmokeBox::Uploads::Rsync - released November 03, 2014 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(
'rsync_src' => 'mirrors.kernel.org::mirrors/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 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, you can enable the
"rsync_all" option.
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 http://www.cpan.org/SITES.html mirror list.
An example is: mirrors.kernel.org::mirrors/CPAN/
The default is: undefined
rsync_dst
This sets the local rsync destination ( where your local CPAN mirror
resides )
The default is: $ENV{HOME}/CPAN
rsync_all
If this is a true value, this module will rsync the entire CPAN. Useful
for lazy people who don't want to run a separate rsync process for the
rest of CPAN. If it is false, this module will rsync only the
authors/id directory to make the rsync run faster.
Additionally, if this is true the option --delete will be passed to the
rsync process. This keeps your local copy exactly the same as it is on
CPAN. If you want to override this just pass a delete=0 option to the
"rsync" hash.
The default is: false
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
https://bugzilla.samba.org/show_bug.cgi?id=3653 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.
* MetaCPAN
A modern, open-source CPAN search engine, useful to view POD in HTML
format.
http://metacpan.org/release/POE-Component-SmokeBox-Uploads-Rsync
* Search CPAN
The default CPAN search engine, useful to view POD in HTML format.
http://search.cpan.org/dist/POE-Component-SmokeBox-Uploads-Rsync
* RT: CPAN's Bug Tracker
The RT ( Request Tracker ) website is the default bug/issue tracking
system for CPAN.
http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-SmokeBox-Uploa
ds-Rsync
* AnnoCPAN
The AnnoCPAN is a website that allows community annotations of Perl
module documentation.
http://annocpan.org/dist/POE-Component-SmokeBox-Uploads-Rsync
* CPAN Ratings
The CPAN Ratings is a website that allows community ratings and
reviews of Perl modules.
http://cpanratings.perl.org/d/POE-Component-SmokeBox-Uploads-Rsync
* CPAN Forum
The CPAN Forum is a web forum for discussing Perl modules.
http://cpanforum.com/dist/POE-Component-SmokeBox-Uploads-Rsync
* CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics )
of a distribution.
http://cpants.cpanauthors.org/dist/overview/POE-Component-SmokeBox-Up
loads-Rsync
* CPAN Testers
The CPAN Testers is a network of smokers who run automated tests on
uploaded CPAN distributions.
http://www.cpantesters.org/distro/P/POE-Component-SmokeBox-Uploads-Rs
ync
* CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview
of the test results for a distribution on various Perls/platforms.
http://matrix.cpantesters.org/?dist=POE-Component-SmokeBox-Uploads-Rs
ync
* CPAN Testers Dependencies
The CPAN Testers Dependencies is a website that shows a chart of the
test results of all dependencies for a distribution.
http://deps.cpantesters.org/?module=POE::Component::SmokeBox::Uploads
::Rsync
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:
http://en.wikipedia.org/wiki/Internet_Relay_Chat. 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
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Component-SmokeBox-U
ploads-Rsync. 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 :)
https://github.com/apocalypse/perl-poe-smokebox-uploads-rsync
git clone https://github.com/apocalypse/perl-poe-smokebox-uploads-rsync.git
AUTHOR
Apocalypse <APOCAL@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 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
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "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 PROGRAM IS WITH YOU. SHOULD THE PROGRAM 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 MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (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 PROGRAM TO
OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.