Skip Menu |

This queue is for tickets about the MailTools CPAN distribution.

Report information
The Basics
Id: 23471
Status: rejected
Priority: 0/
Queue: MailTools

People
Owner: Nobody in particular
Requestors: rjbs [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: allow scalar "string" arg to new
If you have a string, it's a little annoying to have to split it when passing it as an arg to Mail::Internet->new. This patch makes it possible to pass in a scalar reference, which will be treated as a string to split on newlines. -- rjbs
Subject: scalarref.patch
diff -Nur MailTools-1.74/Mail/Internet.pm MailTools-rjbs/Mail/Internet.pm --- MailTools-1.74/Mail/Internet.pm 2006-01-21 04:16:10.000000000 -0500 +++ MailTools-rjbs/Mail/Internet.pm 2006-11-17 20:38:48.000000000 -0500 @@ -61,6 +61,10 @@ if(defined $arg) { + if(ref($arg) eq 'SCALAR') + { + $arg = [ split /\n/, $arg ]; + } if(ref($arg) eq 'ARRAY') { $me->header($arg) unless exists $arg{Header};
On Fri Nov 17 20:59:09 2006, RJBS wrote: Show quoted text
> If you have a string, it's a little annoying to have to split it when > passing it as an arg to Mail::Internet->new. This patch makes it > possible to pass in a scalar reference, which will be treated as a > string to split on newlines.
The idea that this is suffient is flawed. For instance, you now ignore line folding. At least, this needs a call to Mail::Header::header() to get that fixed-up. I am far from sure that a simple check for SCALAR does not collide with all things which can produce a fileno().