Subject: Re: perl Mail::Mailer
To: Masao Uebayashi <uebayasi@soum.co.jp>
From: None <collver@softhome.net>
List: netbsd-help
Date: 12/14/2000 05:00:38
> I recommend to use 'perl -cw foo.pl' to test scripts.

Good tip, I do and I did.
bash-2.04# perl -cw test.pl
test.pl syntax OK

> > script:
> > #!/usr/pkg/bin/perl -w
> > use Mail::Mailer;
> > 
> > $subject = 'sample subject';
> > $from_address = 'collver@softhome.net';
> > $to_address = 'collver@softhome.net';
> > $mailer = Mail::Mailer->new(
> >         'smtp',
> >         Server => 'email.somecompany.com');
>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
> 
> This is a parameter for subroutine, which at least should be anonymous
> hash like
> 
>   {'Server' => 'email.somecompany.com'}

1) all examples of smtp in the Mail::Mailer documentation show the
server parameter as I used it

2) when I change the argument to {'Server' => 'email.somecompany.com'}
I get an error message:

bash-2.04# perl -w test.pl
Reference found where even-sized list expected at /usr/pkg/lib/perl5/site_perl/5.6.0/Mail/Mailer/smtp.pm line 13.
Died at /usr/pkg/lib/perl5/site_perl/5.6.0/Mail/Mailer.pm line 267.

> I also recommend 'Perl Cookbook' from O'Reilly.

The Perl Cookbook mentions Mail::Mailer on pages 650-654.  On page 652, it
shows an obsolete syntax for smtp in Mail::Mailer.
	$mailer = Mail::Mailer->new("smtp", "mail.myisp.com");
This will not work with a recent Mail::Mailer, like the one in pkgsrc.

Thank you for the reply.  I think I should 1) use sendmail instead of smtp
and 2) take it up on some Perl mailing list.

Ben