Skip Menu |

This queue is for tickets about the Mail-Box CPAN distribution.

Report information
The Basics
Id: 52115
Status: resolved
Priority: 0/
Queue: Mail-Box

People
Owner: Nobody in particular
Requestors: icestar [...] inbox.ru
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.092
Fixed in: (no value)



Subject: Mail::Message::Field::Address->coerce doesn't use any passed OPTIONS
The example below doesn't sense input options charset and encoding. my $to = 'Веселая Работка <dima@mailbox.ru>'; my ($ma) = Mail::Address->parse($to); my $to_address = Mail::Message::Field::Address->coerce($ma, charset => 'utf-8', encoding => 'B'); As opposed to this example: my $to_address = Mail::Message::Field::Address->new(address => 'dima@mailbox.ru', phrase => "Веселая Работка", charset => 'utf-8', encoding => 'B');
Subject: Re: [rt.cpan.org #52115] Mail::Message::Field::Address->coerce doesn't use any passed OPTIONS
Date: Fri, 27 Nov 2009 10:34:07 +0100
To: Dmitry Bigunyak via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Dmitry Bigunyak via RT (bug-Mail-Box@rt.cpan.org) [091127 09:16]: Show quoted text
> Fri Nov 27 04:16:18 2009: Request 52115 was acted upon. > Transaction: Ticket created by Alien > Queue: Mail-Box > Subject: Mail::Message::Field::Address->coerce doesn't use any passed OPTIONS > > The example below doesn't sense input options charset and encoding. > > my $to = 'Веселая Работка <dima@mailbox.ru>'; > my ($ma) = Mail::Address->parse($to); > my $to_address = Mail::Message::Field::Address->coerce($ma, charset => > 'utf-8', encoding => 'B'); > > As opposed to this example: > my $to_address = Mail::Message::Field::Address->new(address => > 'dima@mailbox.ru', phrase => "Веселая Работка", charset => 'utf-8', > encoding => 'B');
That's a genuine bug. Can you try this change in Mail::Message::Field::Address: sub coerce($@) { my ($class, $addr, %args) = @_; return () unless defined $addr; return $class->parse($addr) unless ref $addr; return $addr if $addr->isa($class); - my $from = $class->from($addr); + my $from = $class->from($addr, %args); Mail::Reporter->log(ERROR => "Cannot coerce a ".ref($addr)." into a $class"), return () unless defined $from; bless $from, $class; } Probably, the last "bless" is not needed either. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #52115] Mail::Message::Field::Address->coerce doesn't use any passed OPTIONS
Date: Fri, 27 Nov 2009 10:37:12 +0100
To: Mark Overmeer via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Mark Overmeer via RT (bug-Mail-Box@rt.cpan.org) [091127 09:34]: Show quoted text
> Queue: Mail-Box > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=52115 > > > bless $from, $class; > } > > Probably, the last "bless" is not needed either.
Oh, that one is needed. Please ignore that remark. -- MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
OK, thanks. But another thing that I get warning: "WARNING: Unknown option "Mail::Message::Field::Address" for a Mail::Message::Field::Address" Maybe I can't call this method as a class method? Also empty comment brackets appears after stringify: "=?utf-8?B?w5DCksOQwrXDkcKBw5DCtcOQwrvDkMKww5HCjyDDkMKgw5DCsMOQwrHDkMK+? = =?utf-8?B?w5HCgsOQwrrDkMKw?=" <dima@adriver.ru> ()
coerce will be fixed in 2.093 (Actually in User::Identity 0.93 where it will depend on)