NAME

Perlbug::Email - Email interface to perlbug database.

DESCRIPTION

Email interface to perlbug database.

SYNOPSIS

use Perlbug::Email;

use Mail::Internet;

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

my $o_perlbug = Perlbug::Email->new($o_mail);    

my $call = $o_perlbug->switch;

my $result = $o_perlbug->$call($o_mail); 

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

METHODS

new

Create new Perlbug::Email object:

my $pb = Perlbug::Email->new($o_mail); # Mail::Internet
_original_mail

Maintain original

original

Returns original field/s from header

mailing

Switch mailing on/off, also sets email->mailer to 'test' if off

splice

Returns the original mail spliced up into useful bits, set from parse_mail or switch, or given as arg.

my ($o_hdr, $header, $body) = $self->splice; # or splice($o_mail);
parse_mail

Given a mail (Mail::Internet) object, parses it into command hash, also checks the header for X-Perlbug loop and the address of the sender via check_user.

my ($h_commands, $body) = $pb->parse_mail($o_mail);
from

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

my $from = $self->from($replyto, $from, @alternatives);
check_header

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

my $i_ok = $o_perlbug->check_header($o_hdr); # or undef
check_user

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

Returns admin name

my $admin = $pb->check_user($mail->('From')); # -> user_id || blank
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 = $pb->return_info($o_mail, $a_stuff);
_mail

Get and set the incoming mail object (Mail::Internet)

Returned (used) via splice()

doh

Wraps help message

doH

Returns more detailed help.

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);           # plain (coerced as from us)

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 = $self->default($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 = $self->remap($tag, @lines);
send_mail

Send a mail with protection.

my $ok = $email->send_mail($o_hdr, $body);
tester

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

defense

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

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

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

my $o_hdr = $o_mail->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_obj->trim_to($o_hdr);
get_forward

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

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

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

Returns appropriate method name to call to handle this mail.

This enables you to bypass the suggested method with your own call (be it on your own head :-):

my $call = $pb->switch(Mail::Internet->new(\$STDIN);     
do_new

Deal with a new bug

scan

Scan for perl relevant data putting found or default switches in $h_data. Looking for both category=docs and '\brunning\s*under\ssome\s*perl' style markers.

my $h_data = $o_mail->scan($body);

my $res = $o_mail->bug_set($bid, $h_data);
do_reply

Deal with a reply to an existing bug - no acknowledgement, no forward (quiet)

header2admin

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

my $data = $o_email->header2admin($o_hdr);
doe

Email address to 'Cc:' to

-e me.too@some.where.org
doy

New password

dov

Volunteer proposed bug modifications

propose_close_<bugid>@bugs.perl.org

my $i_ok = $o_obj->dov('bid close patch');
doV

Volunteer a new administrator

register_MYUSERID@bugs.perl.org
doa

admin a bug

close_<bugid>_patch_macos@bugs.perl.org
doP

Recieve a patch

patch_<version>*_<changeid>*_<bugid>*@bugs.perl.org
doT

Recieve a test

test_<bugid>@bugs.perl.org
doN

Recieve a note

note_<bugid>*@bugs.perl.org
dow

Forward (weiterleiten) mail onto all active administrators

admin(s)@bugs.perl.org

my $i_ok = $o_obj->dow($body);
do_quiet

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

do_bounce

Deal with a bounced mail

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!

$ok = $pb->assign_bugs($admin, 5, \@unclaimed);
doD

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

scan_header

Scan a typical *@bugs.perl.org header

my ($cmd, $body) = $o_mail->scan_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 
admin_of_bug

Checks given bugid and administrator against tm_user_bug, tm_bugs::sourceaddr, tm_bug_address.

Now you can admin a bug if you're on the source address, or the Cc: list.

administration_failure

Deal with a failed administration attempt

my $i_ok = $self->administration_failure($bid, $user, $commands);
in_master_list

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

my $i_ok = $o_obj->in_master_list($address);

AUTHOR

Richard Foley perlbug@rfi.net 1999 2000