The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Perlbug::Interface::Email - Email interface to perlbug database.

DESCRIPTION

Email interface to perlbug database.

SYNOPSIS

    use Perlbug::Interface::Email;

    use Mail::Internet;

    my $o_int = Mail::Internet->new(*STDIN); 

    my $o_email = Perlbug::Interface::Email->new;

    my $call = $o_email->switch($o_int);

    my $result = $o_email->$call($o_int); 

    print $result; # =1 (hopefully :-)

METHODS

new

Create new Perlbug::Interface::Email object:

    my $o_email = Perlbug::Interface::Email->new();
parse_input

Given a mail (Mail::Internet) object, parses it into command hash,

Checks the header for X-Perlbug loop and the address of the sender via check_user(), calls input2args(). Replaces switch().

    my $h_cmds = $o_email->parse_input($Mail::Internet->new(\$STDIN)));
return_type

Wrap email message options

        my $wanted = $o_email->return_type($cmd);
input2args

Take given input, command and email object, and translate to appropriate format.

Handles opts(...) in $str

        my $cmd_args = $o_email->input2args($cmd, $str, \%inf);
process_commands

Process email given, return results via email when /bugdb/ in address.

        my @res = $o_email->process_commands($h_cmds, $o_int);
return_info

Takes data ($a_stuff), which may be a ref to the result array, and mails it to the From or Reply-To address, Cc:-ing it to any address given by the -e flag.

    my $i_ok = $o_email->return_info($a_stuff, $o_int);
mailing

Switch mailing on/off, and sets isatest(1)

splice

Returns the given mail spliced up into useful bits.

    my ($o_hdr, $header, $body) = $self->splice($o_int);
from

Sort out the wheat from the chaff, use the first valid ck822 address:

        my $from = $o_email->from($replyto, $from, @alternatives);
messageid_recognised

Returns obj and ids for any given email Message-Id line

        my ($obj, $ids) = $self->messageid_recognised($messageid_line);
check_incoming

Checks (incoming) email header against our X-Perlbug flags, also slurps up the Message-Id for future reference.

    my $i_ok = $o_email->check_incoming($o_hdr); # 
check_user

Checks the address given (From usually) against the db_user table, sets user or admin access priviliges via the switches mechanism accordingly.

Returns admin name

    my $admin = $o_email->check_user($o_int->('From')); # -> user_id || blank
spec

Return email specific specification info

get_switches

Appends a couple of extra email specific switches to Perlbug::Base::get_switches()

        my @switches = $o_email->get_switches();
get_header

Get new perlbug Mail::Header, filled with appropriate values, based on given header.

        my $o_hdr = $o_email->get_header();                                                # completely clean

        my $o_hdr = $o_email->get_header($o_old_header, 'default');# default (coerced as from us)

        my $o_hdr = $o_email->get_header($o_old_header);           # as default 

        my $o_hdr = $o_email->get_header($o_old_header, 'ok');     # maintain headers (nearly transparent)
        
        my $o_hdr = $o_email->get_header($o_old_header, 'remap');  # maintain headers (nearly transparent)
default

Operates on given tag, from bugdb@perl.org: we're sending this out from here.

Affects Message-Id(new), From(bugdb), Reply-To(maintainer) lines

Keeps Subject|To|Cc for later modification?

Filters anything else

    my @lines = $o_email->default($tag, @lines);
ok
    my @lines = $o_email->ok($tag, @lines);
remap

Operating on a given tag, remaps (To|Cc) -> forwarding address, removes duplicates.

Attempt to remain moderately invisible by maintaining all other original headers.

    my @lines = $o_email->remap($tag, @lines); # _only_ if in target list!
send_mail

Send a mail with protection.

    my $i_ok = $o_email->send_mail($o_hdr, $body);
tester

If test mail, turn header to maintainer and return header data, and body for insertion

        ($o_hdr, $body) = $self->tester($o_hdr, $body);
addurls

Add urls to header object for given target and id

        my $o_hdr = $o_email->addurls($o_hdr, 'bug', $bugid);
defense

Set mail defaults for _all_ mail emanating from here, calls clean_header() -> trim_to().

    my $o_hdr = $o_email->defense($o_hdr); 
clean_header

Clean header of non-compliant 822 address lines using Mail::Address::parse()

        my $o_hdr = $o_email->clean_header($o_hdr);
trim_to

Takes the header and returns it without any dodgy to, or cc addresses (or undef):

        my $o_hdr = $o_email->trim_to($o_hdr);
get_forward

Operating on a single (or blank) address, returns a list of forwarding addresses.

    my $to = $o_email->get_forward('perlbug@perl.org'); # perl5-porters@perl.org

        my $to = $o_email->get_forward('perl-win32-porters@perl.org'); # perl-win32-porters@perl.org

    my $to = $o_email->get_forward();                   # perl5-porters@perl.org

    my $to = $o_email->get_forward('unknown@some.addr');# perl5-porters@perl.org

    my @to = $o_email->get_forward();                   # perl5-porters@perl.org perl-win32-porters@perl.org etc...
header2admin

Given a Mail::Header object attempts to return a valid create admin command

        my $h_data = $o_email->header2admin($o_hdr);
switch

Only handles (bugdb|perlbug)@perl.(com|org) and tracking addresses now.

parse_input() now wraps this method and should be called instead.

This returns any of (B|M|bounce|nocommand|quiet) and parsable relations.

    my ($call, $opts) = $o_email->switch(Mail::Internet->new(\$STDIN); 
assign_bugs

Assign to this admin, so many, of these unclaimed bugs.

N.B. the claimed bugs are shifted off the end of the referenced array!

    $i_ok = $o_email->assign_bugs($admin, 5, \@unclaimed);
parse_header

Scan a typical *@bugs.perl.org header - instead of parse_input($subject).

        my $h_cmd = $o_email->parse_header($o_hdr, $body); 
                

To: line can be any of:

        close_<bugid>_@bugs.perl.org  = bug admin request
                
        register@bugs.perl.org        = admin registration request

        admins@bugs.perl.org          = admin mail forward

Subject: line may look like:

        -h -o

        -H -d2 -l -A close 20000721.002 lib -r patch -e some@one.net 

Unrecognised commands will be passed to bugmongers (should possibly return help instead?)

in_master_list

Checks given address against ok-to-be-administrator email address list

        my $i_ok = $o_obj->in_master_list($address, [$list]);
reminder

Send out reminders to relevant parties for given bugid

        my $i_ok = $o_email->reminder($bid, @addresses);
doB

Deal with a new bug

        my $bugid = $o_email->doB($h_args);
doD

Mail me a copy of the latest database dump, with 8-figure time filter

        my $i_ok = $o_email->doD([($date, $addr)]);
doE

Send an email renotification(->p5p) about this data, as if the email was newly recieved.

        my $i_ok = $o_obj->doE(\%input);
doh

Wraps help message

        my $help = $o_email->doh;
doH

Returns more detailed help.

        my $help = $o_email->doH;
doj

Just test for a response

        my @res = $o_email->doj(@args); 
dobounce

Deal with a bounced mail

        my $bouncedbugid = $o_email->dobounce($h_args);
donocommand

Deal with a mail with no commands found

        my $reply = $o_email->donocommand($h_args);
doquiet

Drop out quietly, no entry in database, silent dump into black hole;

        my $i_ok = $o_email->doquiet($h_args);

AUTHOR

Richard Foley perlbug@rfi.net 1999 2000 2001

1 POD Error

The following errors were encountered while parsing the POD:

Around line 849:

Unknown directive: =rjsf