App-SpamcupNG

 view release on metacpan or  search on metacpan

bin/spamcup  view on Meta::CPAN

#!perl

use warnings;
use strict;
use HTTP::Cookies 6.01;
use Getopt::Std;
use File::Spec;
use App::SpamcupNG qw(main_loop read_config %OPTIONS_MAP config_logger);
use App::SpamcupNG::UserAgent;

our $VERSION = '0.020'; # VERSION
# Delay between HTTP requests. Adjust this if Spamcop.net asks!
use constant DELAY => 5;

my %opts;
my $accounts;

# :TODO:23/04/2017 17:15:49:ARFREITAS: migrate to Getopt::Long, too many options here
# to use mnemonics
getopts( 'vnac:shul:p:V:', \%opts );

print_footer() if ( $opts{v} );

if ( $opts{h} ) {

    print qq(Usage: $0 [options] <Spamcop-Username>\n
 $0 <options> <Spamcop-Username>

 Options:
  -n Does nothing, just shows if you have unreported SPAM or not.
  -a Run in a loop untill all SPAM is reported.
  -s Stupid. Runs without asking confirmation. Use with care.
  -c Alternate method for signifying code. (Unpaid users WITHOUT username & password)
  -l Alternate method for providing username. (Paid & unpaid users with password)
  -p Method for providing password. (Required for users with password)
  -v Show version and quit.
  -V <LEVEL> Verbosity level of information during program execution. Valid values are: DEBUG, INFO, WARN, ERROR, FATAL, default is INFO.
  -h You are reading it.

 By default the script confirms every SPAM it's about to report. With option -s it does not ask for confirmation.

 You can combine one or more options. If you're using command line options you MUST put those before the code.

 See the perldoc documentation for more details:

 \$ perldoc spamcup

);
    print_footer();
}

my $cfg = File::Spec->catfile( my_home(), '.spamcupNG.yml' );

if ( -e $cfg ) {
    $accounts = read_config( $cfg, \%opts );
    $opts{delay} = DELAY;
}

$opts{V}     = 'INFO' unless ( exists( $opts{V} ) );
$opts{delay} = DELAY  unless ( exists( $opts{delay} ) );

config_logger( $opts{V}, File::Spec->catfile( my_home(), 'spamcup.log' ) );
my $logger = Log::Log4perl->get_logger('SpamcupNG');

if ( ( $logger->is_warn() ) and ( not -e $cfg ) ) {



( run in 1.797 second using v1.01-cache-2.11-cpan-39bf76dae61 )