[30274] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1517 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 7 21:10:14 2008

Date: Wed, 7 May 2008 18:09:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 7 May 2008     Volume: 11 Number: 1517

Today's topics:
    Re: Net::SMTP fails <smallpond@juno.com>
    Re: Net::SMTP fails hendedav@gmail.com
    Re: Net::SMTP fails hendedav@gmail.com
    Re: Net::SMTP fails <ben@morrow.me.uk>
    Re: perl PNG image searching <mazzawi@gmail.com>
    Re: perl PNG image searching <mazzawi@gmail.com>
    Re: perl PNG image searching <1usa@llenroc.ude.invalid>
    Re: perl PNG image searching <mazzawi@gmail.com>
    Re: perl PNG image searching <mazzawi@gmail.com>
    Re: Problem with email attachment, 1 becomes 10 <mikaelb@df.lth.se>
        The Importance of Terminology's Quality <xahlee@gmail.com>
    Re: The Importance of Terminology's Quality <bcb@undisclosedlocation.net>
    Re: Trying to catch invalid emails <get@bentsys.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 07 May 2008 16:10:05 -0400
From: smallpond <smallpond@juno.com>
Subject: Re: Net::SMTP fails
Message-Id: <826e0$48220cad$10893@news.teranews.com>

hendedav@gmail.com wrote:
> On May 7, 3:31 pm, hende...@gmail.com wrote:
> 
>>On May 7, 3:00 pm, smallpond <smallp...@juno.com> wrote:
>>
>>
>>
>>
>>>hende...@gmail.com wrote:
>>>
>>>>Gang,
>>
>>>>     I am trying to use Net::SMTP to send email from a computer and it
>>>>fails to send (debug info below).  I can take this same script and put
>>>>it on another computer and it works just fine.  That would tell me
>>>>some piece of software isn't installed on the non-working computer,
>>>>but I have no idea as to what it may be.  I have made sure the files
>>>>are the same on both computers that are listed in the "use" statements
>>>>at the top of the Net::SMTP module.  I am using Debian 3.1 on the one
>>>>that works and 4.0 on the one that doesn't work.  Any help would
>>>>greatly be appreciated.
>>
>>>>Thanks,
>>
>>>>Dave
>>
>>>>Net::SMTP>>> Net::SMTP(2.29)
>>>>Net::SMTP>>>   Net::Cmd(2.26)
>>>>Net::SMTP>>>     Exporter(5.58)
>>>>Net::SMTP>>>   IO::Socket::INET(1.29)
>>>>Net::SMTP>>>     IO::Socket(1.29)
>>>>Net::SMTP>>>       IO::Handle(1.25)
>>>>Net::SMTP=GLOB(0x82cd2dc)<<< 220 smtp106.biz.mail.re2.yahoo.com ESMTP
>>>>Net::SMTP=GLOB(0x82cd2dc)>>> EHLO digital-pipe.com
>>>>Net::SMTP=GLOB(0x82cd2dc)<<< 250-smtp106.biz.mail.re2.yahoo.com
>>>>Net::SMTP=GLOB(0x82cd2dc)<<< 250-AUTH LOGIN PLAIN XYMCOOKIE
>>>>Net::SMTP=GLOB(0x82cd2dc)<<< 250-PIPELINING
>>>>Net::SMTP=GLOB(0x82cd2dc)<<< 250 8BITMIME
>>
>>>220 says that yahoo will accept mail using ESMTP, so you sent EHLO.
>>>250 says OK, here's what I accept.
>>>There's no error shown here, the next thing that you should do is
>>>send MAIL FROM:, which you didn't.
>>>--S
>>
>>Thanks for the reply.  Why would this script work just fine on one
>>computer and then stop at the above point on the other?
>>
>>Dave

Although my telepathic abilities are limited, I am going to guess
that it is one of:
  1 - you are not connecting to the same SMTP server
  2 - you have a different version of NET::SMTP
  3 - the other computer is configured differently
  4 - you are behind a firewall
  5 - you are on a different ISP
  6 - Comcast is randomly modifying your packets
  or
  7 - there is a cat inside the computer upgrading your RAM



> I removed the authentication checking and just had the rest of the
> script processed and here is the response I received:
> 
> Net::SMTP>>> Net::SMTP(2.29)
> Net::SMTP>>>   Net::Cmd(2.26)
> Net::SMTP>>>     Exporter(5.58)
> Net::SMTP>>>   IO::Socket::INET(1.29)
> Net::SMTP>>>     IO::Socket(1.29)
> Net::SMTP>>>       IO::Handle(1.25)
> Net::SMTP=GLOB(0x82ccfac)<<< 220 smtp107.biz.mail.re2.yahoo.com ESMTP
> Net::SMTP=GLOB(0x82ccfac)>>> EHLO digital-pipe.com
> Net::SMTP=GLOB(0x82ccfac)<<< 250-smtp107.biz.mail.re2.yahoo.com
> Net::SMTP=GLOB(0x82ccfac)<<< 250-AUTH LOGIN PLAIN XYMCOOKIE
> Net::SMTP=GLOB(0x82ccfac)<<< 250-PIPELINING
> Net::SMTP=GLOB(0x82ccfac)<<< 250 8BITMIME
> Net::SMTP=GLOB(0x82ccfac)>>> MAIL FROM:<noreply@netbud.local>
> Net::SMTP=GLOB(0x82ccfac)<<< 530 authentication required - for help go
> to http://help.yahoo.com/help/us/bizmail/pop/pop-11.html
> Net::SMTP=GLOB(0x82ccfac)>>> RCPT TO:<d...@digital-pipe.com>
> Net::SMTP: Unexpected EOF on command channel at /usr/lib/perl/5.8/
> libemail.pm line 66
> 
> 
> The only reason there is an error in the script at line 66 is because
> all the lines were processed even though the auth failed (which the
> script normally wouldn't come to if the auth section that I commented
> out, failed).
> 
> Dave

This line:
250-AUTH LOGIN PLAIN XYMCOOKIE
says that you must authenticate with one of the types: LOGIN, PLAIN or XYMCOOKIE.

--S
** Posted from http://www.teranews.com **


------------------------------

Date: Wed, 7 May 2008 13:16:22 -0700 (PDT)
From: hendedav@gmail.com
Subject: Re: Net::SMTP fails
Message-Id: <15d32a4e-7c4b-480c-ab49-ece67f4f04ff@y18g2000pre.googlegroups.com>

On May 7, 3:56 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> hende...@gmail.com wrote innews:349ecbfd-844d-440b-a4f1-2f30fc66ae49@l28g2000prd.googlegroups.com:
>
> [ Posted no code, just error logs ... ]
>
> > The only reason there is an error in the script at line 66 is because
> > all the lines were processed even though the auth failed (which the
> > script normally wouldn't come to if the auth section that I commented
> > out, failed).
>
> So what?
>
> Maybe it was line 666 and that's why it failed.
>
> Sinan
>
> --
> A. Sinan Unur <1...@llenroc.ude.invalid>
> (remove .invalid and reverse each component for email address)
>
> comp.lang.perl.misc guidelines on the WWW:http://www.rehabitation.com/clpmisc/

I would probably say that the script, at this point, is not in
neccessarily in question because it works flawlessly on another
computer.  I will post it below however for review:



#!/usr/bin/perl -w
use Net::SMTP;

my $smtp_relay="smtp.bizmail.yahoo.com";
my $port=25;
my $url="digital-pipe.com";
my $username="d...\@digital-pipe.com";
my $password="***";

our ($gbl_logsDir, $gbl_emailLog);     #used from called script
my $date = scalar(localtime);

sub send_mail {
   my($to_email, $to_name, $from_email, $from_name, $subject, @body) =
@_;

   my $smtp = Net::SMTP->new($smtp_relay,
                                Hello => $url,
                                Port => $port,
                                Timeout => 30,
                                Debug=>1);

   open(LOG, ">>$gbl_logsDir/$gbl_emailLog") || die "Can't open
$gbl_logsDir/$gbl_emailLog.";
   if ($smtp->auth($username,$password))
        { print LOG "Yahoo! email authentication successful.\n"; }
   else
        { print LOG "Authentication failed!  No email will be sent.
\n"; return(0); }

 ...snip...

the rest of the script doesn't get reached because the authentication
fails.  The calling script just has a call to the send_mail routine
and that is it.  I know it doesn't contain errors, because it works
just fine on another computer.  Let me know if there is anything else
you need.

Dave


------------------------------

Date: Wed, 7 May 2008 13:20:21 -0700 (PDT)
From: hendedav@gmail.com
Subject: Re: Net::SMTP fails
Message-Id: <78c6e21e-8ddc-4357-9494-5bd334ffda1e@a9g2000prl.googlegroups.com>

On May 7, 4:10 pm, smallpond <smallp...@juno.com> wrote:
> hende...@gmail.com wrote:
> > On May 7, 3:31 pm, hende...@gmail.com wrote:
>
> >>On May 7, 3:00 pm, smallpond <smallp...@juno.com> wrote:
>
> >>>hende...@gmail.com wrote:
>
> >>>>Gang,
>
> >>>>     I am trying to use Net::SMTP to send email from a computer and it
> >>>>fails to send (debug info below).  I can take this same script and put
> >>>>it on another computer and it works just fine.  That would tell me
> >>>>some piece of software isn't installed on the non-working computer,
> >>>>but I have no idea as to what it may be.  I have made sure the files
> >>>>are the same on both computers that are listed in the "use" statements
> >>>>at the top of the Net::SMTP module.  I am using Debian 3.1 on the one
> >>>>that works and 4.0 on the one that doesn't work.  Any help would
> >>>>greatly be appreciated.
>
> >>>>Thanks,
>
> >>>>Dave
>
> >>>>Net::SMTP>>> Net::SMTP(2.29)
> >>>>Net::SMTP>>>   Net::Cmd(2.26)
> >>>>Net::SMTP>>>     Exporter(5.58)
> >>>>Net::SMTP>>>   IO::Socket::INET(1.29)
> >>>>Net::SMTP>>>     IO::Socket(1.29)
> >>>>Net::SMTP>>>       IO::Handle(1.25)
> >>>>Net::SMTP=GLOB(0x82cd2dc)<<< 220 smtp106.biz.mail.re2.yahoo.com ESMTP
> >>>>Net::SMTP=GLOB(0x82cd2dc)>>> EHLO digital-pipe.com
> >>>>Net::SMTP=GLOB(0x82cd2dc)<<< 250-smtp106.biz.mail.re2.yahoo.com
> >>>>Net::SMTP=GLOB(0x82cd2dc)<<< 250-AUTH LOGIN PLAIN XYMCOOKIE
> >>>>Net::SMTP=GLOB(0x82cd2dc)<<< 250-PIPELINING
> >>>>Net::SMTP=GLOB(0x82cd2dc)<<< 250 8BITMIME
>
> >>>220 says that yahoo will accept mail using ESMTP, so you sent EHLO.
> >>>250 says OK, here's what I accept.
> >>>There's no error shown here, the next thing that you should do is
> >>>send MAIL FROM:, which you didn't.
> >>>--S
>
> >>Thanks for the reply.  Why would this script work just fine on one
> >>computer and then stop at the above point on the other?
>
> >>Dave
>
> Although my telepathic abilities are limited, I am going to guess
> that it is one of:
>   1 - you are not connecting to the same SMTP server
>   2 - you have a different version of NET::SMTP
>   3 - the other computer is configured differently
>   4 - you are behind a firewall
>   5 - you are on a different ISP
>   6 - Comcast is randomly modifying your packets
>   or
>   7 - there is a cat inside the computer upgrading your RAM
>
>
>
> > I removed the authentication checking and just had the rest of the
> > script processed and here is the response I received:
>
> > Net::SMTP>>> Net::SMTP(2.29)
> > Net::SMTP>>>   Net::Cmd(2.26)
> > Net::SMTP>>>     Exporter(5.58)
> > Net::SMTP>>>   IO::Socket::INET(1.29)
> > Net::SMTP>>>     IO::Socket(1.29)
> > Net::SMTP>>>       IO::Handle(1.25)
> > Net::SMTP=GLOB(0x82ccfac)<<< 220 smtp107.biz.mail.re2.yahoo.com ESMTP
> > Net::SMTP=GLOB(0x82ccfac)>>> EHLO digital-pipe.com
> > Net::SMTP=GLOB(0x82ccfac)<<< 250-smtp107.biz.mail.re2.yahoo.com
> > Net::SMTP=GLOB(0x82ccfac)<<< 250-AUTH LOGIN PLAIN XYMCOOKIE
> > Net::SMTP=GLOB(0x82ccfac)<<< 250-PIPELINING
> > Net::SMTP=GLOB(0x82ccfac)<<< 250 8BITMIME
> > Net::SMTP=GLOB(0x82ccfac)>>> MAIL FROM:<nore...@netbud.local>
> > Net::SMTP=GLOB(0x82ccfac)<<< 530 authentication required - for help go
> > tohttp://help.yahoo.com/help/us/bizmail/pop/pop-11.html
> > Net::SMTP=GLOB(0x82ccfac)>>> RCPT TO:<d...@digital-pipe.com>
> > Net::SMTP: Unexpected EOF on command channel at /usr/lib/perl/5.8/
> > libemail.pm line 66
>
> > The only reason there is an error in the script at line 66 is because
> > all the lines were processed even though the auth failed (which the
> > script normally wouldn't come to if the auth section that I commented
> > out, failed).
>
> > Dave
>
> This line:
> 250-AUTH LOGIN PLAIN XYMCOOKIE
> says that you must authenticate with one of the types: LOGIN, PLAIN or XYMCOOKIE.
>
> --S
> ** Posted fromhttp://www.teranews.com**

I just worked around it by using another SMTP server.  Oh well.
Thanks for the help guys.

Dave


------------------------------

Date: Wed, 7 May 2008 21:41:06 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Net::SMTP fails
Message-Id: <2og9f5-p9n1.ln1@osiris.mauzo.dyndns.org>

[please don't quote .sigs]

Quoth hendedav@gmail.com:
> On May 7, 3:56 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> > hende...@gmail.com wrote
> innews:349ecbfd-844d-440b-a4f1-2f30fc66ae49@l28g2000prd.googlegroups.com:
> >
> > [ Posted no code, just error logs ... ]
> >
> > > The only reason there is an error in the script at line 66 is because
> > > all the lines were processed even though the auth failed (which the
> > > script normally wouldn't come to if the auth section that I commented
> > > out, failed).
> >
> > So what?
> >
> > Maybe it was line 666 and that's why it failed.
> 
> I would probably say that the script, at this point, is not in
> neccessarily in question because it works flawlessly on another
> computer.  I will post it below however for review:
> 
> #!/usr/bin/perl -w

'use warnings' is preferable to '-w'. You also need 'use strict'.

> use Net::SMTP;
> 
> my $smtp_relay="smtp.bizmail.yahoo.com";
> my $port=25;
> my $url="digital-pipe.com";
> my $username="d...\@digital-pipe.com";
> my $password="***";
> 
> our ($gbl_logsDir, $gbl_emailLog);     #used from called script
> my $date = scalar(localtime);
> 
> sub send_mail {
>    my($to_email, $to_name, $from_email, $from_name, $subject, @body) =
> @_;
> 
>    my $smtp = Net::SMTP->new($smtp_relay,
>                                 Hello => $url,
>                                 Port => $port,
>                                 Timeout => 30,
>                                 Debug=>1);
> 
>    open(LOG, ">>$gbl_logsDir/$gbl_emailLog") || die "Can't open
> $gbl_logsDir/$gbl_emailLog.";

Use lexical filehandles and 3-arg open, and say *why* the open failed:

    open my $LOG, '>>', "$gbl_logsDir/$gbl_emailLog"
        or die "Can't append to $gbl_logsDir/$gbl_emailLog: $!.";

I much prefer using 'or' and no parens over using '||' and parens on the
'open', but that is a matter of taste.

If you need $LOG to be global (if it's used from other subs), you will
need to declare it at the top with your other globals. It would be
better to have a separate open_log sub which returns a filehandle, and
then pass that filehandle into all the subs which need it.

>    if ($smtp->auth($username,$password))
>         { print LOG "Yahoo! email authentication successful.\n"; }
>    else
>         { print LOG "Authentication failed!  No email will be sent.
> \n"; return(0); }

You need to log *why* it failed:

    else {
        printf LOG 
            "Authentication failed! No email will be sent: %d %s\n",
            $smtp->code, $smtp->message;
        return(0);
    }

I suspect you'll find the result is "500 Need MIME::Base64 and
Authen::SASL todo auth", meaning you haven't got one of those modules
installed.

Ben

-- 
        I must not fear. Fear is the mind-killer. I will face my fear and
        I will let it pass through me. When the fear is gone there will be 
        nothing. Only I will remain.
ben@morrow.me.uk                                          Frank Herbert, 'Dune'


------------------------------

Date: Wed, 7 May 2008 13:50:15 -0700 (PDT)
From: elie <mazzawi@gmail.com>
Subject: Re: perl PNG image searching
Message-Id: <882abb54-3bdb-4c87-8550-edc897736a46@a70g2000hsh.googlegroups.com>


ben with your method,
pngtopnm | pnmtoplainpnm
I was able to find out if the pattern is there or not.

now i only need to find out the location, any idea how that ASCII maps
to pixels. i need to find out if my pattern is below y pixels or right
of x pixels.

I'll go look for a pnm specification.


------------------------------

Date: Wed, 7 May 2008 13:51:08 -0700 (PDT)
From: elie <mazzawi@gmail.com>
Subject: Re: perl PNG image searching
Message-Id: <c440e478-1cf7-4d7a-b1aa-e2afabe4ff69@d1g2000hsg.googlegroups.com>

thank you for your reply Sinan, I will try your suggestion if the
pngtopnm | pnmtoplainpnm doesn't work.


------------------------------

Date: Wed, 07 May 2008 20:58:52 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: perl PNG image searching
Message-Id: <Xns9A97ACBC241F2asu1cornelledu@127.0.0.1>

"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in
news:Xns9A979ECD32E13asu1cornelledu@127.0.0.1: 

> Of course, it might be easier just to convert both images to 
> binary or ASCII encoded PPM and do the matching from there 
> (in that case, the regex approach is almost trivial)

Actually, I should have said index rather than a regex match.

Sinan

-- 
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/


------------------------------

Date: Wed, 7 May 2008 15:28:43 -0700 (PDT)
From: elie <mazzawi@gmail.com>
Subject: Re: perl PNG image searching
Message-Id: <4c481a4d-6cb5-4c80-8d49-375357178b2c@w7g2000hsa.googlegroups.com>

okay I figured out the pnm format, Its explained in wikipedia :p

http://en.wikipedia.org/wiki/Portable_pixmap


------------------------------

Date: Wed, 7 May 2008 15:29:01 -0700 (PDT)
From: elie <mazzawi@gmail.com>
Subject: Re: perl PNG image searching
Message-Id: <14b403e0-333c-4ab9-b00d-d2a13ba1c126@j22g2000hsf.googlegroups.com>

thanks all for your help


------------------------------

Date: Thu, 08 May 2008 01:41:29 +0200
From: "M.O.B. i L." <mikaelb@df.lth.se>
Subject: Re: Problem with email attachment, 1 becomes 10
Message-Id: <fvten8$o9l$1@news.lth.se>

Ben Bullock wrote:
> On Mon, 05 May 2008 03:07:53 +0200, M.O.B. i L. wrote:
> 
>> I'm trying to write a program that can send out mails to companies where
>> I'm interested in working. These mails are the same except that the
>> company name is switched. My CV should be attached as a pdf-file. The
>> problem is that I don't get one attachment, but ten! Also the message is
>> repeated 10 times. If I change the program by uncommenting the commented
>> line in the function load() it works but then it doesn't send the
>> correct pdf-file. The CV is 129490 bytes. How could I change this
>> program so that there is only one attachment and no repeated messages?
> 
> I don't know the answer to your question, but after reading it I wonder 
> if anyone else can solve it for you, so I'll post my advice instead. One 
> piece of advice which has been useful to me which I learnt from the 
> posting guidelines for this group is, before posting, to always try to 
> reduce the problem to the minimum possible, let's say ten or twenty lines 
> of code:
> 
>   "First make a short (less than 20-30 lines) and *complete* program
>   that illustrates the problem you are having. People should be able
>   to run your program by copy/pasting the code from your article. (You
>   will find that doing this step very often reveals your problem
>   directly. Leading to an answer much more quickly and reliably than
>   posting to Usenet.)"
> 
> In the case of your program there are two big chunks: first, lots of 
> stuff involving reading lines from the database, which is where I suspect 
> the problem has occurred, probably some kind of slip-up, but I can't 
> prove this because I don't have the database available, and then there is 
> an almost separate piece of code which involves sending a mail with an 
> attachment, which might be where the bug happened, although I think it's 
> unlikely.
> 
> If I was going to seriously try to solve your problem, I would first of 
> all split the program into two pieces, one which gets those database 
> lines and just prints them to STDOUT, and another piece which sends just 
> one mail with some fixed parameters, written into the file itself rather 
> than pulled from a database, and see which one of these two pieces is 
> going wrong.
> 
> Then, if I still couldn't debug it myself, I might try posting whichever 
> of the two pieces the problem had occurred in to the newsgroup. But it's 
> very hard (for me at least) to work out what might have happened in your 
> program because of all the dependencies. As it says in the quote above, 
> if you can reduce the dependencies to a minimum piece of code which 
> anybody can run, you'll probably end up solving your own problem into the 
> bargain. I have repeatedly had problems in Perl which I thought were 
> incredibly difficult, ended up frustrated enough to want to post them 
> here, and in the business of reducing them into a short newsgroup post as 
> described, I ended up surprising myself by working out what the bug was 
> without having to post it.
> 
> Having said all that, perhaps someone will spot the bug in your code the 
> next minute after I post this, so who knows?

You're right but if I had been lucky and someone had had this problem 
before I could have saved a day. I did follow your advice on isolating 
the problem.

I found a fix, see 
<http://rt.cpan.org/Public/Bug/Display.html?id=33031>. There is a bug in 
sub datasend in /usr/local/share/perl/5.8.8/Net/SMTP/TLS.pm.

Now I learned one should always read the bug reports carefully.

With the fix this shortened script works (long lines may have wrapped):
#!/usr/bin/perl

# appliertest.pl v0.0.0
# Author: Mikael O. Bonnier, mikaelb@df.lth.se, 
http://www.df.lth.se/~mikaelb/
# Copyright (C) 2008 by Mikael O. Bonnier, Lund, Sweden.
# License: GNU GPL v3 or later, http://www.gnu.org/licenses/gpl-3.0.txt

use strict;
use Email::Send;
use Email::MIME::Creator;
use MIME::Words qw/encode_mimewords/;
use IO::All;

my %settings = (
     SMTP        => 'smtp.gmail.com',
     PORT        => 587,
     FROM_DOMAIN => '',
     FROM        => 'dummy@dummy.se',
     SUBJECT     => 'IntresseanmÀlan som fysiker eller programutvecklare',
     BODY =>
         'Det skulle vara intressant att jobba hos er pÄ $cCompany.',
     UPLDDIR => '../Documents/LyX',
     FILE    => 'MOB_CV.pdf',
);
@ARGV == 4
     or die
'Provide username and password for the SMTP server, and company name and 
email'
     . " on the command line.\n";
@settings{qw( USER PASS CCOMPANY CEMAIL)} = @ARGV;

my $mailer = Email::Send->new(
     {
         mailer      => 'SMTP::TLS',
         mailer_args => [
             Host     => $settings{SMTP},
             Port     => $settings{PORT},
             User     => $settings{USER},
             Password => $settings{PASS},
             Hello    => $settings{FROM_DOMAIN},
         ]
     }
);

my $row =
{
             cCompany => $settings{CCOMPANY},
             cEmail   => $settings{CEMAIL},
};

{
     my $body_text = $settings{BODY};
     $body_text =~ s/\$cCompany/$row->{cCompany}/g;

     # multipart message
     my @parts = (
         Email::MIME->create(
             attributes => {
                 content_type => 'text/plain',
                 encoding     => '8bit',
                 charset      => 'utf-8',
             },
             body => $body_text,
         ),
         Email::MIME->create(
             attributes => {
                 filename     => $settings{FILE},
                 content_type => 'application/pdf',
                 encoding     => 'base64',
                 disposition  => 'inline',
                 name         => $settings{FILE},
             },
             body => io( $settings{UPLDDIR}.'/'.$settings{FILE} )->all,
         ),
     );

     my $email = Email::MIME->create(
         header => [
             From           => $settings{FROM},
             'Reply-To'     => $settings{FROM},
             To             => $row->{cEmail},
             'User-Agent'   => 'Thunderbird 2.0.0.14 (X11/20080505)',
#             'MIME-Version' => '1.0',
             Subject        => encode_mimewords( $settings{SUBJECT} ),
         ],
         attributes => {
             charset        => '',
         },
         parts  => [ @parts ],
     );

     eval { $mailer->send($email) };
     die "Error sending email: $@" if $@;
}

__END__


------------------------------

Date: Wed, 7 May 2008 16:13:36 -0700 (PDT)
From: "xahlee@gmail.com" <xahlee@gmail.com>
Subject: The Importance of Terminology's Quality
Message-Id: <f4abdb41-be28-4628-a2ad-7fb6cea6ed65@u12g2000prd.googlegroups.com>

I'd like to introduce a blog post by Stephen Wolfram, on the design
process of Mathematica. In particular, he touches on the importance of
naming of functions.

=E2=80=A2 Ten Thousand Hours of Design Reviews (2008 Jan 10) by Stephen
Wolfram
 http://blog.wolfram.com/2008/01/10/ten-thousand-hours-of-design-reviews/

The issue is fitting here today, in our discussion of =E2=80=9Cclosure=E2=80=
=9D
terminology recently, as well the jargons =E2=80=9Clisp 1 vs lisp2=E2=80=9D =
(multi-
meaning space vs single-meaning space), =E2=80=9Ctail recursion=E2=80=9D, =
=E2=80=9Ccurrying=E2=80=9D,
=E2=80=9Clambda=E2=80=9D, that perennially crop up here and elsewhere in com=
puter
language forums in wild misunderstanding and brouhaha.

The functions in Mathematica, are usually very well-name, in contrast
to most other computing languages. In particular, the naming in
Mathematica, as Stephen Wolfram implied in his blog above, takes the
perspective of naming by capturing the essense, or mathematical
essence, of the keyword in question. (as opposed to, naming it
according to convention, which often came from historical happenings)
When a thing is well-named from the perspective of what it actually
=E2=80=9Cmathematically=E2=80=9D is, as opposed to historical developments, =
it avoids
vast amount of potential confusion.

Let me give a few example.

=E2=80=A2 =E2=80=9Clambda=E2=80=9D, widely used as a keyword in functional l=
anguages, is named
just =E2=80=9CFunction=E2=80=9D in Mathematica. The =E2=80=9Clambda=E2=80=9D=
 happend to be called so
in the field of symbolic logic, is due to use of the greek letter
lambda =E2=80=9C=CE=BB=E2=80=9D by happenstance. The word does not convey wh=
at it means.
While, the name =E2=80=9CFunction=E2=80=9D, stands for the mathematical conc=
ept of
=E2=80=9Cfunction=E2=80=9D as is.

=E2=80=A2 Module, Block, in Mathematica is in lisp's various =E2=80=9Clet*=
=E2=80=9D. The
lisp's keywords =E2=80=9Clet=E2=80=9D, is based on the English word =E2=80=
=9Clet=E2=80=9D. That word
is one of the English word with multitudes of meanings. If you look up
its definition in a dictionary, you'll see that it means many
disparate things. One of them, as in =E2=80=9Clet's go=E2=80=9D, has the mea=
ning of
=E2=80=9Cpermit; to cause to; allow=E2=80=9D. This meaning is rather vague f=
rom a
mathematical sense. Mathematica's choice of Module, Block, is based on
the idea that it builds a self-contained segment of code. (however,
the choice of Block as keyword here isn't perfect, since the word also
has meanings like =E2=80=9Cobstruct; jam=E2=80=9D)

=E2=80=A2 Functions that takes elements out of list are variously named Firs=
t,
Rest, Last, Extract, Part, Take, Select, Cases, DeleteCases... as
opposed to =E2=80=9Ccar=E2=80=9D, =E2=80=9Ccdr=E2=80=9D, =E2=80=9Cfilter=E2=
=80=9D, =E2=80=9Cfilter=E2=80=9D, =E2=80=9Cpop=E2=80=9D, =E2=80=9Cshift=E2=
=80=9D,
=E2=80=9Cunshift=E2=80=9D, in lisps and perl and other langs.

The above are some examples. The thing to note is that, Mathematica's
choices are often such that the word stands for the meaning themselves
in some logical and independent way as much as possible, without
having dependent on a particular computer science field's context or
history. One easy way to confirm this, is taking a keyword and ask a
wide audience, who doesn't know about the language or even unfamiliar
of computer programing, to guess what it means. The wide audience can
be made up of mathematicians, scientists, engineers, programers,
laymen. This general audience, are more likely to guess correctly what
Mathematica's keyword is meant in the language, than the the name used
in other computer languages who's naming choices goes by convention or
context.

(for example, Perl's naming heavily relies on unix culture (grep,
pipe, hash...), while functional lang's namings are typically heavily
based on the field of mathematical logic (e.g. lambda, currying,
closure, monad, ...). Lisp's cons, car, cdr, are based on computer
hardware (this particular naming, caused a major damage to the lisp
language to this day). (Other examples: pop, shift are based on
computer science jargon of =E2=80=9Cstack=E2=80=9D. Grep is from Global Regu=
lar
Expression Print, while Regular Expression is from theoretical
computer science of Automata... The name regex has done major hidden
damage to the computing industry, in the sense that if it have just
called it =E2=80=9Cstring patterns=E2=80=9D, then a lot explanations, litera=
tures,
confusions, would have been avoided.))

(Note: Keywords or functions in Mathematica are not necessarily always
best named. Nor are there always one absolute choice as best, as there
are many other considerations, such as the force of wide existing
convention, the context where the function are used, brevity,
limitations of English language, different scientific context (e.g.
math, physics, engineering), or even human preferences.)

----------------------------

Many of the issues regarding the importance and effects of
terminology's quality, i've wrote about since about 2000. Here are the
relevant essays:

=E2=80=A2 Jargons of Info Tech Industry
 http://xahlee.org/UnixResource_dir/writ/jargons.html

=E2=80=A2 The Jargon =E2=80=9CLisp1=E2=80=9D vs =E2=80=9CLisp2=E2=80=9D
 http://xahlee.org/emacs/lisp1_vs_lisp2.html

=E2=80=A2 The Term Curring In Computer Science
 http://xahlee.org/UnixResource_dir/writ/currying.html

=E2=80=A2 What Is Closure In A Programing Language
 http://xahlee.org/UnixResource_dir/writ/closure.html

=E2=80=A2 What are OOP's Jargons and Complexities
 http://xahlee.org/Periodic_dosage_dir/t2/oop.html

=E2=80=A2 Sun Microsystem's abuse of term =E2=80=9CAPI=E2=80=9D and =E2=80=
=9CInterface=E2=80=9D
 http://xahlee.org/java-a-day/interface.html

=E2=80=A2 Math Terminology and Naming of Things
 http://xahlee.org/cmaci/notation/math_namings.html

  Xah
  xah@xahlee.org
=E2=88=91 http://xahlee.org/

=E2=98=84


------------------------------

Date: Wed, 7 May 2008 18:53:42 -0500
From: "Bruce C. Baker" <bcb@undisclosedlocation.net>
Subject: Re: The Importance of Terminology's Quality
Message-Id: <5irUj.71335$y05.1766@newsfe22.lga>


<xahlee@gmail.com> wrote in message 
news:f4abdb41-be28-4628-a2ad-7fb6cea6ed65@u12g2000prd.googlegroups.com...

[...]

(for example, Perl's naming heavily relies on unix culture (grep,
pipe, hash...), ...

"hash" + "pipe"? Ahhhhh, /no wonder/ Perl is the syntactic mishmash it is! 
;-)





------------------------------

Date: Wed, 7 May 2008 17:57:47 -0700
From: "Gordon Etly" <get@bentsys.com>
Subject: Re: Trying to catch invalid emails
Message-Id: <68f1gdF2r3o3nU1@mid.individual.net>

Abigail wrote:
>                                          _
> Frank Seitz (devnull4711@web.de) wrote on VCCCLXIII September
> MCMXCIII in <URL:news:68d9vaF2slnr9U1@mid.individual.net>:
> ;;  Abigail wrote:
> ;; >                                         _
> ;; > Samik R. (samik@frKKshKll.org) wrote on VCCCLXIII September
> :: > :)  MCMXCIII in ;; > <URL:news:fvr60f$pqd$1@aioe.org>:
> ;; > :)  Hello,
> ;; > :)  I use the following regular expression to catch typical
> :: > :)  invalid email ;; > :)  addresses:
> ;; > :)  ------------
> ;; > :)  my @Email=("sam._\@abc.org", "sam_.\@abc.org",
> ;; > :)  "sam_.\@abc.org"); ;; > :)  foreach (@Email)
> ;; > :)  {
> ;; > :)
> ;; > :)
> ;; > :) 
> if(/^[A-z0-9]+([_\.][A-z0-9\-]+)*[@][A-z0-9_\-]+([.][A-z0-9_\-]+)?\.[A-z]{2,3}$/)
> ;; > :)    {    print "$_ is a valid email id\n";    } ;; > :)    else
> ;; > :)    {    print "$_ is an invalid email id\n"; }
> ;; > :)  }
> ;; > :)  -------------
> ;; > :)
> ;; > :)  This expression does not catch the above 3 emails in the
> ;; > :)  array (the ;; > :)  program says that they are valid emails).
> ;; > :)
> ;; > :)  Can someone help me to discard these three?
> ;; >
> ;; > Sure.
> ;; >
> ;; >     if (/_/) {
> ;; >         print "$_ is invalid";
> ;; >     }
> ;; >     else {
> ;; >         print "$_ is valid";
> ;; >     }
> ;;
> ;;  An e-mail address with _ (or ._ or _.) isn't invalid, AFAIK.
>
>
> But that wasn't what he asked.
>
> He wanted to filter out three particular email addresses.

Oh please, you know as well as most everyone else those were just 
samples. In any case, flagging an email as invalid for having an 
underscore  ( /_/ )  is plain wrong, and portraying it as a solution is 
disingenuous to the OP as well as anyone who comes by this in the 
archives.

-- 
G.Etly 




------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 1517
***************************************


home help back first fref pref prev next nref lref last post