# Time-stamp: <2009-04-05 17:03:34 phm>

=head1 NAME

    A2E::Mondeb

=cut

package A2E::Mondeb;
use strict;

=head1 VERSION

    B<0.0.3>

=cut

our $VERSION = '0.0.3';

=head1 PURPOSE

Make it easy to send mails to large lists of people, especially members of
FFII to whom we announce upcoming withdrawals of money from their accounts.

=head1 SYNOPSIS

Use as base class for A2E::Mondeb::Mail, A2E::Mondeb::Dtaus et al

=head1 OPTIONS

The following commandline options are parsed when the setup function is invoked.

=over

=item --help | -h

    Display short help and exit.

=item --manpage | -m

    Display full documentation and exit.

=item --test | -t

    Do testing only.  This is the default.  To actually send mail out, you have to say --notest explicitely.

=item --quiet | -q

    Let me keep silent while I run.

=item --verbose | -v

    Let me explain what I am doing while I run.

=item --daba | -D <daba>

    Use this database instead of the 'a2e' database.

=item --lang | -l <lang>

    Language in which the letter is written.  This influences the configuration.

=item --varsfile | -F <varsfile>

    Read a table of values from this file.  It should contain one row per mail to be sent.

=item --rowvars | -R <varlist>

    list of names of variable to which the cells in each row of the value table in varsfile will be assigned.

=item --tmplfile | -t <file>

    File where the mail template can be found.

=item --start_after | -a <n>

    start processing only after the n-th row.

=item --stop_after | -z <n>

    stop processing after the n-th row.

=back

=head1 FILES

The setup function uses the AppConfig(3) module (via A2E::Daba) to read configuration info /usr/local/etc/mondeb/mondeb.konf, /usr/local/etc/mondeb/mail.konf, ~/mondeb_mail.konf, mondeb.konf, mondeb_mail.konf, /usr/local/etc/mondeb/mail_{$lang}.conf, ~/mondeb_mail_{$lang}.konf, in this sequence, as far as available.

=head1 PREREQUISITES

    A2E::Prog(3)

=cut

use base 'A2E::Prog';

=head1 SEE ALSO

  http://money.ffii.org/proc/mondeb
    mondeb_mail(1)
    mondeb_mktab(1)
    perl(1)
    perldoc(1)

=head1 BUGS, CAVEATS


=head1 AUTHOR

    Hartmut Pilch

=head1 COPYRIGHT

    Copyright (c) 2007-8 Hartmut Pilch (phm)

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

=head1 IMPLEMENTATION

=head2 Overload Functions

=head3 Function A2E::Mondeb::defvars

Define configuration variables that are used by all A2E::Mondeb::* applications.

=cut

sub mondeb_defvars {
    my $m = shift;
    $m->{konfig}->define('lang|l=s', { DEFAULT => 'de', VALIDATE => m(\w{2}) } );
    $m->{konfig}->define('varsfile|V=s', { DEFAULT => 'mondeb_vars.txt' });
    $m->{konfig}->define('rowvars|rv|R=s@');
    $m->{konfig}->define('rowpats|rp=s%');
    $m->konfayl('mondeb.konf');
    return 1;
};

sub defvars {
    my $m = shift;
    $m->dpuc('A2E::Mondeb::defvars', @_);
    $m->SUPER::defvars;
    $m->mondeb_defvars;
    $m->dpop('A2E::Mondeb::defvars', 1);
    return 1;
};

=head2 The End

=cut

return 1;

# Local Variables:
# coding: utf-8
# srcfile: /adv/perl/A2E/Mondeb.pm.tmpl
# url: http://a2e.de/adv/perl/A2E/Mondeb.pm.tmpl
# mode: perl
# End:
