Skip Menu |

This queue is for tickets about the MIME-Lite CPAN distribution.

Report information
The Basics
Id: 31245
Status: resolved
Priority: 0/
Queue: MIME-Lite

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

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



Subject: Runtime dependency on sendmail binary is bad
As the subject says, requiring a mandatory dependency on an external binary that isn't even required to fully use the module is just silly. I had to create a patch http://www.cpan.org/authors/id/J/JP/JPEACOCK/patches/JPEACOCK-mime-lite.diff to apply in-house, because we don't install any sendmail binary on our servers. I'm just amazed that this particular misfeature has been around for so long in an otherwise useful module. Please find some other way to deal with this gracefully, instead of die'ing...
From: dom [...] cpan.org
Attached is the patch we've used for the Debian package of MIME::Lite. We would be glad to see it included in the upstream distribution. Thanks, Dominic.
Index: lib/MIME/Lite.pm =================================================================== --- lib/MIME/Lite.pm (revision 14011) +++ lib/MIME/Lite.pm (working copy) @@ -401,13 +401,13 @@ } } unless (-x $SENDMAIL) { - Carp::croak "can't find an executable sendmail" + undef $SENDMAIL; } } ### Our sending facilities: my %SenderArgs = ( - sendmail => ["$SENDMAIL -t -oi -oem"], + sendmail => [$SENDMAIL ? "$SENDMAIL -t -oi -oem" : undef], smtp => [], sub => [], ); @@ -2666,6 +2666,7 @@ if ( @_ == 1 and !ref $_[0] ) { ### Use the given command... my $sendmailcmd = shift @_; + Carp::croak "No sendmail command available" unless $sendmailcmd; ### Do it: local *SENDMAIL;
CC: "John Peacock" <jpeacock [...] rowman.com>
Subject: Re: [rt.cpan.org #31245] Runtime dependency on sendmail binary is bad
Date: Mon, 18 Feb 2008 10:55:19 +0100
To: bug-MIME-Lite [...] rt.cpan.org
From: demerphq <demerphq [...] gmail.com>
On 18/02/2008, Dominic Hargreaves via RT <bug-MIME-Lite@rt.cpan.org> wrote: Show quoted text
> > Queue: MIME-Lite > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=31245 > > > Attached is the patch we've used for the Debian package of MIME::Lite. > We would be glad to see it included in the upstream distribution.
FWIW. This patchmakes more sense to me than Johns did. Im also thinking that maybe the $SENDMAIL var should be changed to a global and then checked for definedness and if it is defined left alone. Then you can just do BEGIN {$MIME::Lite::SENDMAIL=''; } use MIME::Lite; But i agree with the bottom line, dieing because sendmail cant be found is not correct behaviour. Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"
Subject: Re: [rt.cpan.org #31245] Runtime dependency on sendmail binary is bad
Date: Mon, 18 Feb 2008 05:11:13 -0500
To: bug-MIME-Lite [...] rt.cpan.org
From: John Peacock <jpeacock [...] cpan.org>
demerphq via RT wrote: Show quoted text
> FWIW. This patchmakes more sense to me than Johns did.
Agreed. My patch was more intended to be a short-term fix for my own needs, rather than something to apply to the base package. Show quoted text
> Im also thinking that maybe the $SENDMAIL var should be changed to a > global and then checked for definedness and if it is defined left > alone. Then you can just do > > BEGIN {$MIME::Lite::SENDMAIL=''; } > use MIME::Lite;
This, on the other hand, is bad. I shouldn't have to poke stuff into some other package's namespace just to get it to work. I should only have to call: use MIME::Lite; and go on my merry way. If I try and use a method which requires sendmail, but I don't have any sendmail binary in my path, then and only then should the module die with an appropriate error. John
CC: "John Peacock" <jpeacock [...] rowman.com>
Subject: Re: [rt.cpan.org #31245] Runtime dependency on sendmail binary is bad
Date: Mon, 18 Feb 2008 11:34:43 +0100
To: bug-MIME-Lite [...] rt.cpan.org
From: demerphq <demerphq [...] gmail.com>
On 18/02/2008, John Peacock via RT <bug-MIME-Lite@rt.cpan.org> wrote: Show quoted text
> > Queue: MIME-Lite > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=31245 > > > demerphq via RT wrote:
> > FWIW. This patchmakes more sense to me than Johns did.
> > Agreed. My patch was more intended to be a short-term fix for my own needs, > rather than something to apply to the base package. >
> > Im also thinking that maybe the $SENDMAIL var should be changed to a > > global and then checked for definedness and if it is defined left > > alone. Then you can just do > > > > BEGIN {$MIME::Lite::SENDMAIL=''; } > > use MIME::Lite;
> > This, on the other hand, is bad. I shouldn't have to poke stuff into some other > package's namespace just to get it to work. I should only have to call: > > use MIME::Lite; > > and go on my merry way. If I try and use a method which requires sendmail, but > I don't have any sendmail binary in my path, then and only then should the > module die with an appropriate error.
I agree. Although, well, only sortof. The idea of MIME::Lite is that it is drop and go and works more or less properly out of the box on the standard env. Meaning it should autodetect the right way to function. So the question I have, is sendmail just dated and not longer something we should expect *nixy users to have? Or is the issue more that when we run in a non-standard env that we should be more polite? Bear in mind im a windows user mostly (well not anymore, but i have no *nixy mail experience) so dont know about the changing *nixy setups. To go further, i was thinking that warning on a nix box if it cant find sendmail unless some kind of guard is set up.... But TBH rjbs is the main maintainer now so the final call is his. Im just an interested commentator. Yves -- perl -Mre=debug -e "/just|another|perl|hacker/"
On Wed Dec 05 20:30:13 2007, JPEACOCK wrote: Show quoted text
> As the subject says, requiring a mandatory dependency on an external > binary that isn't even required to fully use the module is just silly. > I had to create a patch > >
http://www.cpan.org/authors/id/J/JP/JPEACOCK/patches/JPEACOCK-mime-lite.diff Show quoted text
> > to apply in-house, because we don't install any sendmail binary on our > servers. I'm just amazed that this particular misfeature has been > around for so long in an otherwise useful module. > > Please find some other way to deal with this gracefully, instead of > die'ing...
This ticket could probably be merged with this one: http://rt.cpan.org/Ticket/Display.html?id=35339 Regards, Slaven
3.022 -- rjbs