Torsten Raudssus > App-Shotgun-0.001 > App::Shotgun

Download:
App-Shotgun-0.001.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.001   Source  

NAME ^

App::Shotgun - mass upload of files via SCP/FTP/...

VERSION ^

version 0.001

SYNOPSIS ^

        use App::Shotgun;

        my $shotgun = App::Shotgun->new(
                source => '../relative/path',
                files => [
                        # NEVER NEVER EVER EVER use relative paths here!
                        # They should be in the source path
                        'robots.txt',
                        'dir/dir/dir/file.txt',
                        'category/index.html',
                        'index.html',
                ],
                targets => [
                        {
                                type => 'FTP',
                                name => 'Target 1', # optional
                                path => 'htdocs/', # optional
                                hostname => 'my.local',
                                username => 'notfor',
                                password => 'you321',
                        },
                        {
                                type => 'SFTP',
                                name => 'Target 2', # optional
                                path => '/tmp/testenv', # optional
                                hostname => 'myother.local',
                                username => 'notfor',

                                # prepared key authentifications are just working
                                # probably more options for configuring ssh, like alternative private key
                        },
                ],
        );

        # Order of upload:
        # Target 1: robots.txt
        # Target 2: robots.txt
        # Target 1: dir/dir/dir/file.txt
        # Target 2: dir/dir/dir/file.txt
        # ...

        $shotgun->shot;

        print "Success: ".($shotgun->success ? 'YES' : 'NO')."\n";
        print "Error: ".$shotgun->error if (!$shotgun->success);

        my $other_shotgun = App::Shotgun->new(
                source => '/absolute/path',
                filelist => 'filelist.txt',
        );

DESCRIPTION ^

This module uploads the filelist textfile given via filelist or the filelist given as array via files to all given targets. It uploads file after file, to target after target, that means, first file will get uploaded to all target, and if they all are successful done, the next file will be uploaded. This module doesn't do any "smart" things like compare filesize/modification time/etc and just uploads the files. Hence the name "shotgun" which is appropriate :)

For first the module is made to try again very often but will not continue on fail and close with an exit code above 0.

Please look at the appropriate App::Shotgun::Target::* classes for their attributes and how to use them.

METHODS ^

shot

The main entry point of this module.

Returns nothing.

shot_poe

Use this method if you are embedding this module in a bigger POE-based program. The only difference with "shot" is that this method will not run the POE kernel, leaving it to the caller to do so.

AUTHORS ^

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2011 by Raudssus Social Software http://www.raudssus.de/.

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

syntax highlighting: