# t9001 fails because Net::SMTP is missing

6 messages from 2006-05-30 to 2006-05-31. Participants: Johannes Schindelin, Junio C Hamano, Morten Welinder, Eric Wong.
Thread: https://gitlist.dev/t/4358

## Johannes Schindelin, 2006-05-30 19:26

Subject: t9001 fails because Net::SMTP is missing
Message-ID: <Pine.LNX.4.63.0605302125310.11586@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0605302125310.11586%40wbgn013.biozentrum.uni-wuerzburg.de

```
Hi,

is it unexpected that there are setups which come without Net::SMTP?

-- snip --
* expecting success: git format-patch -n HEAD^1
     git send-email -from="Example <nobody@example.com>" 
--to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt
0001-Second.txt
Can't locate Net/SMTP.pm in @INC (@INC contains: 
/System/Library/Perl/darwin /System/Library/Perl /Library/Perl/darwin 
/Library/Perl /Library/Perl /Network/Library/Perl/darwin 
/Network/Library/Perl /Network/Library/Perl .) at 
/Users/gene099/my/git-current/t/../git-send-email line 24.
BEGIN failed--compilation aborted at 
/Users/gene099/my/git-current/t/../git-send-email line 24.
* FAIL 3: Extract patches and send
-- snap --

Ciao,
Dscho

```

## Junio C Hamano, 2006-05-31 00:34

Subject: Re: t9001 fails because Net::SMTP is missing
Message-ID: <7v8xojyqu3.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v8xojyqu3.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <Pine.LNX.4.63.0605302125310.11586@wbgn013.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> is it unexpected that there are setups which come without Net::SMTP?
>
> -- snip --
> * expecting success: git format-patch -n HEAD^1
>      git send-email -from="Example <nobody@example.com>" 
> --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt
> 0001-Second.txt
> Can't locate Net/SMTP.pm in @INC (@INC contains: 

Hmm.  Something like this?

-- >8 --

diff --git a/git-send-email.perl b/git-send-email.perl
index 0e368ff..f7af8eb 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -21,7 +21,6 @@ use warnings;
 use Term::ReadLine;
 use Getopt::Long;
 use Data::Dumper;
-use Net::SMTP;
 
 # most mail servers generate the Date: header, but not all...
 $ENV{LC_ALL} = 'C';
@@ -394,6 +393,7 @@ X-Mailer: git-send-email $gitversion
 		print $sm "$header\n$message";
 		close $sm or die $?;
 	} else {
+		use Net::SMTP;
 		$smtp ||= Net::SMTP->new( $smtp_server );
 		$smtp->mail( $from ) or die $smtp->message;
 		$smtp->to( @recipients ) or die $smtp->message;

```

## Junio C Hamano, 2006-05-31 00:37

Subject: Re: t9001 fails because Net::SMTP is missing
Message-ID: <7v4pz7yqpd.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v4pz7yqpd.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <7v8xojyqu3.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano <junkio@cox.net> writes:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
>> is it unexpected that there are setups which come without Net::SMTP?
>>
>> -- snip --
>> * expecting success: git format-patch -n HEAD^1
>>      git send-email -from="Example <nobody@example.com>" 
>> --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt
>> 0001-Second.txt
>> Can't locate Net/SMTP.pm in @INC (@INC contains: 
>
> Hmm.  Something like this?

Nah, nevermind.  I forgot my Perl that use has the magic BEGIN{}
block around it X-<.

```

## Morten Welinder, 2006-05-31 02:07

Subject: Re: t9001 fails because Net::SMTP is missing
Message-ID: <118833cc0605301907i152fc0b0s6788a11ad05e7f10@mail.gmail.com>
URL: https://gitlist.dev/e/118833cc0605301907i152fc0b0s6788a11ad05e7f10%40mail.gmail.com
In-Reply-To: <7v4pz7yqpd.fsf@assigned-by-dhcp.cox.net>

```
You just need more perl magic...  Try this.

#!/usr/local/perl -w

eval 'use strict';
print "Hmm [$@]\n";

eval 'use Oink';
print "Hmm [$@]\n";

```

## Eric Wong, 2006-05-31 06:05

Subject: Re: t9001 fails because Net::SMTP is missing
Message-ID: <20060531060530.GA9333@hand.yhbt.net>
URL: https://gitlist.dev/e/20060531060530.GA9333%40hand.yhbt.net
In-Reply-To: <7v4pz7yqpd.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano <junkio@cox.net> wrote:
> Junio C Hamano <junkio@cox.net> writes:
> 
> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> >
> >> is it unexpected that there are setups which come without Net::SMTP?
> >>
> >> -- snip --
> >> * expecting success: git format-patch -n HEAD^1
> >>      git send-email -from="Example <nobody@example.com>" 
> >> --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt
> >> 0001-Second.txt
> >> Can't locate Net/SMTP.pm in @INC (@INC contains: 
> >
> > Hmm.  Something like this?
> 
> Nah, nevermind.  I forgot my Perl that use has the magic BEGIN{}
> block around it X-<.

s/use/require/ and you should be fine.  We don't need any thing imported
from Net::SMTP, either.

Odd that Net::SMTP isn't installed on Johannes' machine, though, as it's
part of the standard Perl 5.8 (maybe even before) installation.

-- 
Eric Wong

```

## Johannes Schindelin, 2006-05-31 08:32

Subject: Re: t9001 fails because Net::SMTP is missing
Message-ID: <Pine.LNX.4.63.0605311031090.14859@wbgn013.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/Pine.LNX.4.63.0605311031090.14859%40wbgn013.biozentrum.uni-wuerzburg.de
In-Reply-To: <20060531060530.GA9333@hand.yhbt.net>

```
Hi,

On Tue, 30 May 2006, Eric Wong wrote:

> Odd that Net::SMTP isn't installed on Johannes' machine, though, as it's
> part of the standard Perl 5.8 (maybe even before) installation.

In terms of corporate setups, 5.8 really is pretty new, you know?

As for "s/use/require/", I can not access on that machine today, but I 
will test it.

Ciao,
Dscho

```
