1 # This module is part of debbugs, and
2 # is released under the terms of the GPL version 2, or any later
3 # version (at your option). See the file README and COPYING for more
5 # Copyright 2018 by Don Armstrong <don@donarmstrong.com>.
7 package Debbugs::Correspondent;
11 Debbugs::Correspondent -- OO interface to bugs
15 use Debbugs::Correspondent;
16 Debbugs::Correspondent->new(schema => $s,binaries => [qw(foo)],sources => [qw(bar)]);
27 use v5.10; # for state
31 use Debbugs::Config qw(:config);
35 extends 'Debbugs::OOBase';
37 has name => (is => 'ro', isa => 'Str',
39 writer => '_set_name',
42 has _mail_address => (is => 'bare', isa => 'Mail::Address',
44 handles => [qw(address phrase comment)],
45 builder => '_build_mail_address',
48 sub _build_mail_address {
49 my @addr = Mail::Address->parse($_[0]->name) or
50 confess("unable to parse mail address");
52 warn("Multiple addresses to Debbugs::Correspondent");
58 my $email = $_[0]->address;
59 warn "No email" unless defined $email;
65 return $config{web_domain}.'/correspondent:'.$self->email;
70 return $config{web_domain}.'/maintainer:'.$self->email;
75 return $config{web_domain}.'/owner:'.$self->email;
80 return $config{web_domain}.'/submitter:'.$self->email;
85 return 'Debbugs::Correspondent={name='.$self->name.'}';
89 __PACKAGE__->meta->make_immutable;
97 # indent-tabs-mode: nil
98 # cperl-indent-level: 4