[31730] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2993 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 17 18:09:24 2010

Date: Thu, 17 Jun 2010 15:09:06 -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           Thu, 17 Jun 2010     Volume: 11 Number: 2993

Today's topics:
        =?windows-1252?Q?Kareena_Kapoor=3A_I_Don=92t_Endorse_Al <snehachatterje@gmail.com>
    Re: FAQ 8.18 How can I do an atexit() or setjmp()/longj <brian.d.foy@gmail.com>
    Re: FAQ 8.47 How do I keep my own module/library direct <ben@morrow.me.uk>
    Re: FAQ 8.47 How do I keep my own module/library direct <apeiron@isuckatdomains.net.invalid>
    Re: FAQ 8.47 How do I keep my own module/library direct <brian.d.foy@gmail.com>
        How to change file creation timestamp in Perl? <void.no.spam.com@gmail.com>
    Re: MIME::Lite and AUTH only after STARTTLS (smtp.gmail <anfi@onet.eu>
    Re: MIME::Lite and AUTH only after STARTTLS (smtp.gmail <r.ted.byers@gmail.com>
    Re: MIME::Lite and AUTH only after STARTTLS (smtp.gmail <anfi@onet.eu>
        problem sending email using MIME::Lite from gmail's stm <r.ted.byers@gmail.com>
        Problems with function dump_entity from example distrib <r.ted.byers@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 16 Jun 2010 05:43:31 -0700 (PDT)
From: sneha <snehachatterje@gmail.com>
Subject: =?windows-1252?Q?Kareena_Kapoor=3A_I_Don=92t_Endorse_Alcholic_Products?=
Message-Id: <24bbe62d-bbde-4e69-a462-70b64590dd8e@e34g2000pra.googlegroups.com>

http://www.123bollywood.com/kareena-kapoor/kareena-kapoor-i-dont-endorse-al=
cholic-products/



Kareena Kapoor announced =93I dont endorse an alcohol, smoking or non-
vegetarian ads because i dont believe in that.=94 Is this new mantra a
new way of Kareena Kapoor promoting herself somehow different from the
other Bollywood Hotties like Vijay Mallya=92s favorite Katrina Kaif or
Siddharth Mallya=92s favorite Deepika Padukone.


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

Date: Thu, 17 Jun 2010 10:03:13 -0700
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 8.18 How can I do an atexit() or setjmp()/longjmp()? (Exception handling)
Message-Id: <170620101003135130%brian.d.foy@gmail.com>

In article <ln8w6fzw3f.fsf@nuthaus.mib.org>, Keith Thompson
<kst-u@mib.org> wrote:

> PerlFAQ Server <brian@theperlreview.com> writes:
> [...]
> >     If exception handling is all you're interested in, try the
> >     "exceptions.pl" library (part of the standard perl distribution).
> [...]
> 
> You probably don't want to recommend "exceptions.pl".  

Right. I'll fix up the answer.

Thanks,


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

Date: Wed, 16 Jun 2010 23:41:26 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: FAQ 8.47 How do I keep my own module/library directory?
Message-Id: <mh0oe7-qmn.ln1@osiris.mauzo.dyndns.org>


Quoth PerlFAQ Server <brian@theperlreview.com>:
> 
> 8.47: How do I keep my own module/library directory?

Should this answer mention local::lib? I believe it's considered best
practice nowadays for keeping a local module directory.

Ben



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

Date: Thu, 17 Jun 2010 01:14:26 +0000 (UTC)
From: Chris Nehren <apeiron@isuckatdomains.net.invalid>
Subject: Re: FAQ 8.47 How do I keep my own module/library directory?
Message-Id: <hvbsti$v0k$1@news.eternal-september.org>

On 2010-06-16, Ben Morrow scribbled these curious markings:
>
> Quoth PerlFAQ Server <brian@theperlreview.com>:
>> 
>> 8.47: How do I keep my own module/library directory?
>
> Should this answer mention local::lib? I believe it's considered best
> practice nowadays for keeping a local module directory.

Yes.

Not that a current maintainer of the module would be biased at all, of
course...


-- 
Thanks and best regards,
Chris Nehren
Unless noted, all content I post is CC-BY-SA.


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

Date: Thu, 17 Jun 2010 10:04:16 -0700
From: brian d foy <brian.d.foy@gmail.com>
Subject: Re: FAQ 8.47 How do I keep my own module/library directory?
Message-Id: <170620101004168934%brian.d.foy@gmail.com>

In article <mh0oe7-qmn.ln1@osiris.mauzo.dyndns.org>, Ben Morrow
<ben@morrow.me.uk> wrote:

> Quoth PerlFAQ Server <brian@theperlreview.com>:
> > 
> > 8.47: How do I keep my own module/library directory?
> 
> Should this answer mention local::lib? 

Yes it should. I'll look into this.

Thanks,


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

Date: Thu, 17 Jun 2010 14:41:31 -0700 (PDT)
From: "void.no.spam.com@gmail.com" <void.no.spam.com@gmail.com>
Subject: How to change file creation timestamp in Perl?
Message-Id: <f5b1f639-5d63-4bb3-a6c3-9d4c5c59a0b9@q29g2000vba.googlegroups.com>

I know Perl has the utime function, but that only changes the access
and modification timestamps.  Is there a way to change the creation
timestamp of a file?  I'm using ActivePerl on Windows.


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

Date: Thu, 17 Jun 2010 22:05:26 +0200
From: Andrzej Adam Filip <anfi@onet.eu>
Subject: Re: MIME::Lite and AUTH only after STARTTLS (smtp.gmail.com)
Message-Id: <13it2d2dks+A6H@martha.huge.strangled.net>

Ted Byers <r.ted.byers@gmail.com> wrote:
> I am using Activestate perl 5.10.0 on WXP, if that matters.
>
> I can get all the examples to work properly for trivially simple
> emails.  However, the following:
>
>   MIME::Lite->send('smtp','smtp.gmail.com',AuthUser=>$un, AuthPass=>
> $pw, Timeout => 60);
>
> produces the error:
>
> SMTP auth() command not supported on smtp.gmail.com
>
> If I remove the credentials, I get an error about the need to
> establish a secure channel, specifically:
>
> SMTP mail() command failed:
> 5.7.0 Must issue a STARTTLS command first. 11sm9055536vcp.45
> [...]

1) smtp.gmail.com offers support of AUTH command in SMTP session *AFTER*
   receiving STARTTLS (after switching to encrypted connection).

#v+
 ... Connecting to smtp.gmail.com via esmtp...
220 mx.google.com ESMTP x16sm15625549bku.5
>>> EHLO xxxx
250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
250-SIZE 35651584
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 PIPELINING
>>> STARTTLS
220 2.0.0 Ready to start TLS
>>> EHLO xxxx
250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
250-SIZE 35651584
250-8BITMIME
250-AUTH LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250 PIPELINING
#v-

2) MIME::Lite uses Net::SMTP for sending via SMTP.

Net::SMTP due to its design requires non trivial rewrite to support both
encrypted and non encrypted connections.

Possible fix:
a) use MIME::Lite to compose the message $msg->as_string
b) send message using Net::SMTP::TLS module from CPAN
   [ I have not used Net::SMTP::TLS myself ]

-- 
[pl>en Andrew] Andrzej Adam Filip : anfi@onet.eu : Andrzej.Filip@gmail.com
 ... A solemn, unsmiling, sanctimonious old iceberg who looked like he
was waiting for a vacancy in the Trinity.
  -- Mark Twain


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

Date: Thu, 17 Jun 2010 14:18:34 -0700 (PDT)
From: Ted Byers <r.ted.byers@gmail.com>
Subject: Re: MIME::Lite and AUTH only after STARTTLS (smtp.gmail.com)
Message-Id: <9660ae3e-d79e-4f48-b1f3-c106473f6b48@a30g2000yqn.googlegroups.com>

On Jun 17, 4:05=A0pm, Andrzej Adam Filip <a...@onet.eu> wrote:
> Ted Byers <r.ted.by...@gmail.com> wrote:
> > I am using Activestate perl 5.10.0 on WXP, if that matters.
>
> > I can get all the examples to work properly for trivially simple
> > emails. =A0However, the following:
>
> > =A0 MIME::Lite->send('smtp','smtp.gmail.com',AuthUser=3D>$un, AuthPass=
=3D>
> > $pw, Timeout =3D> 60);
>
> > produces the error:
>
> > SMTP auth() command not supported on smtp.gmail.com
>
> > If I remove the credentials, I get an error about the need to
> > establish a secure channel, specifically:
>
> > SMTP mail() command failed:
> > 5.7.0 Must issue a STARTTLS command first. 11sm9055536vcp.45
> > [...]
>
> 1) smtp.gmail.com offers support of AUTH command in SMTP session *AFTER*
> =A0 =A0receiving STARTTLS (after switching to encrypted connection).
>
> #v+
> ... Connecting to smtp.gmail.com via esmtp...
> 220 mx.google.com ESMTP x16sm15625549bku.5>>> EHLO xxxx
>
> 250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
> 250-SIZE 35651584
> 250-8BITMIME
> 250-STARTTLS
> 250-ENHANCEDSTATUSCODES
> 250 PIPELINING>>> STARTTLS
>
> 220 2.0.0 Ready to start TLS>>> EHLO xxxx
>
> 250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
> 250-SIZE 35651584
> 250-8BITMIME
> 250-AUTH LOGIN PLAIN
> 250-ENHANCEDSTATUSCODES
> 250 PIPELINING
> #v-
>
> 2) MIME::Lite uses Net::SMTP for sending via SMTP.
>
> Net::SMTP due to its design requires non trivial rewrite to support both
> encrypted and non encrypted connections.
>
> Possible fix:
> a) use MIME::Lite to compose the message $msg->as_string
> b) send message using Net::SMTP::TLS module from CPAN
> =A0 =A0[ I have not used Net::SMTP::TLS myself ]
>
> --
> [pl>en Andrew] Andrzej Adam Filip : a...@onet.eu : Andrzej.Fi...@gmail.co=
m
> ... A solemn, unsmiling, sanctimonious old iceberg who looked like he
> was waiting for a vacancy in the Trinity.
> =A0 -- Mark Twain

Thanks Andrzej

So far so good.  I have been able to connect to gmail and send plain
text email using Net::SMTP::TLS.  However, I suspect there is a bug in
$msg->as_string because my logo.jpg is damaged, and the <img ...> tag
seems broken (i.e. the image does not appear in the right place in the
html body).  This is in contrast to when I use the defaults in
MIME::Lite but the smtp services of my  M$ Exchange server (the only
reason I am not using that server here is that the domain required for
sending is on the gmail email account).

Since MIME::Lite uses Net::SMTP, and I can use Net::SMTP::TLS to
connect to gmail, is there a way to tell MIME::Lite to use the sender
I make using Net::SMTP::TLS, or that it should use Net::SMTP::TLS
instead of Net::SMTP?

Thanks

Ted


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

Date: Thu, 17 Jun 2010 23:59:31 +0200
From: Andrzej Adam Filip <anfi@onet.eu>
Subject: Re: MIME::Lite and AUTH only after STARTTLS (smtp.gmail.com)
Message-Id: <otc52rvfmu+A6H@martha.huge.strangled.net>

Ted Byers <r.ted.byers@gmail.com> wrote:
> On Jun 17, 4:05 pm, Andrzej Adam Filip <a...@onet.eu> wrote:
>> Ted Byers <r.ted.by...@gmail.com> wrote:
>> > I am using Activestate perl 5.10.0 on WXP, if that matters.
>>
>> > I can get all the examples to work properly for trivially simple
>> > emails.  However, the following:
>>
>> >   MIME::Lite->send('smtp','smtp.gmail.com',AuthUser=>$un, AuthPass=>
>> > $pw, Timeout => 60);
>>
>> > produces the error:
>>
>> > SMTP auth() command not supported on smtp.gmail.com
>>
>> > If I remove the credentials, I get an error about the need to
>> > establish a secure channel, specifically:
>>
>> > SMTP mail() command failed:
>> > 5.7.0 Must issue a STARTTLS command first. 11sm9055536vcp.45
>> > [...]
>>
>> 1) smtp.gmail.com offers support of AUTH command in SMTP session *AFTER*
>>    receiving STARTTLS (after switching to encrypted connection).
>>
>> #v+
>> ... Connecting to smtp.gmail.com via esmtp...
>> 220 mx.google.com ESMTP x16sm15625549bku.5>>> EHLO xxxx
>>
>> 250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
>> 250-SIZE 35651584
>> 250-8BITMIME
>> 250-STARTTLS
>> 250-ENHANCEDSTATUSCODES
>> 250 PIPELINING>>> STARTTLS
>>
>> 220 2.0.0 Ready to start TLS>>> EHLO xxxx
>>
>> 250-mx.google.com at your service, [aaa.bbb.ccc.ddd]
>> 250-SIZE 35651584
>> 250-8BITMIME
>> 250-AUTH LOGIN PLAIN
>> 250-ENHANCEDSTATUSCODES
>> 250 PIPELINING
>> #v-
>>
>> 2) MIME::Lite uses Net::SMTP for sending via SMTP.
>>
>> Net::SMTP due to its design requires non trivial rewrite to support both
>> encrypted and non encrypted connections.
>>
>> Possible fix:
>> a) use MIME::Lite to compose the message $msg->as_string
>> b) send message using Net::SMTP::TLS module from CPAN
>>    [ I have not used Net::SMTP::TLS myself ]
>
> Thanks Andrzej
>
> So far so good.  I have been able to connect to gmail and send plain
> text email using Net::SMTP::TLS.  However, I suspect there is a bug in
> $msg->as_string because my logo.jpg is damaged, and the <img ...> tag
> seems broken (i.e. the image does not appear in the right place in the
> html body).  This is in contrast to when I use the defaults in
> MIME::Lite but the smtp services of my  M$ Exchange server (the only
> reason I am not using that server here is that the domain required for
> sending is on the gmail email account).
>
> Since MIME::Lite uses Net::SMTP, and I can use Net::SMTP::TLS to
> connect to gmail, is there a way to tell MIME::Lite to use the sender
> I make using Net::SMTP::TLS, or that it should use Net::SMTP::TLS
> instead of Net::SMTP?

*Test* the hack below to make MIME::Lite use Net::SMTP::TLS instead of
Net::SMTP:

use MIME::Lite;
use Net::SMTP::TLS; 
BEGIN { @MIME::Lite::SMTP::ISA = qw(Net::SMTP::TLS); }

-- 
[pl>en Andrew] Andrzej Adam Filip : anfi@onet.eu : Andrzej.Filip@gmail.com
"Freedom is still the most radical idea of all."
  -- Nathaniel Branden


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

Date: Thu, 17 Jun 2010 11:44:17 -0700 (PDT)
From: Ted Byers <r.ted.byers@gmail.com>
Subject: problem sending email using MIME::Lite from gmail's stmp server
Message-Id: <509a2c89-345a-466f-af47-566165c14c12@w12g2000yqj.googlegroups.com>

I am using Activestate perl 5.10.0 on WXP, if that matters.

I can get all the examples to work properly for trivially simple
emails.  However, the following:

  MIME::Lite->send('smtp','smtp.gmail.com',AuthUser=>$un, AuthPass=>
$pw, Timeout => 60);

produces the error:

SMTP auth() command not supported on smtp.gmail.com

If I remove the credentials, I get an error about the need to
establish a secure channel, specifically:

SMTP mail() command failed:
5.7.0 Must issue a STARTTLS command first. 11sm9055536vcp.45

Alas, MIME::Lite documentation makes no mention of anything related to
possible issues using stml.gmail.com and thus the question is, "What
needs to be done to set MIME::Lite up to use gmail properly?"  A
related question is "What needs to be changed from the usual
configuration in order to use a gmail account that has a domain
different from gmail.com?"

Yes, I did see Email::Send::Gmail, but it is not clear how to use it
in a manner equivalent to:

  my $msg = MIME::Lite->new(
	      From => $sender,
              To   => $recipient,
	      Subject => $subject_line,
	      Type    =>'multipart/related'
                 );
  $msg->attach(Type => 'text/html',
               Data => $html_template,
               );
  $msg->attach(Type => 'image/jpg',
               Id   => 'logo.jpg',
               Path => 'template.files/image002.jpg',
               );
  MIME::Lite->send('smtp','smtp.gmail.com',AuthUser=>$un, AuthPass=>
$pw, Timeout => 60);
  $msg->send();

Thanks,

Ted


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

Date: Thu, 17 Jun 2010 11:32:08 -0700 (PDT)
From: Ted Byers <r.ted.byers@gmail.com>
Subject: Problems with function dump_entity from example distributed with  MIME::tools
Message-Id: <75eee0b9-c654-4b5e-b4c2-afdeb282c319@z31g2000vbk.googlegroups.com>

I am using Activestate perl 5.10.0 on WXP, if that matters.

I tried function dump_entity from mimedump, distributed with the
latest release of MIME::tools.  It looked simple enough, but when I
pass to it the emails I get from the IMAP server (using
Net::IMAP::Simple::SSL), it prints nothing.

I can print any and all of the headers, using, e.g. other examples
provided in the documentation, and using length($es->body), I get a
length of anywhere from a few kilobytes to over 1 MB.  But still,
function dump_entity prints nothing.  For some reason that is
presently beyond me, MIME::Parser fails to correctly identify any of
the message parts.  If I use the appended functions to print the
messages I get from the IMAP server, I see all the lines containing
all the content of the message, including html and uuencoded image
data from messages where the body is html and includes jpg, gif and
png files referred to by img tags in the html.

The following sequence prints all of the hierarchical  data in
$message in a way in which I can see the hierarchical nature of the
data:

  my $message = $imap->get($j);
  print "Message: $j\n";
  print_obj($message);# my function, given below

but, the following:

my $parser = new MIME::Parser;
$parser->output_to_core(1);
$parser->extract_nested_messages(1);
$parser->extract_uuencode(1);

  my @l2 = @{$message};
  my $entity = $parser->parse_data(@l2);
  $entity->dump_skeleton;
  dump_entity($entity);

Prints the correct skeleton (undoubtedly from the call to
dump_skeleton), but no content.  I don't understand why.  I tried to
use the code in the examples, and the documentation, carefully, but I
don't see why I can't get at the html content (so i can parse it) or
to save to usable files, and describe, any binary content.

Any help would be appreciated.

Thanks

Ted

========my functions  = not pretty, but servicable for what they were
writen for=======
========NB: print_obj is only for scalars and references to arrays and
hashes=======
===========it is NOT intended to be used on arrays or hashes
directly============
===========thus to print a hash, call print_obj(\%myhash), not
print_obj(%myhash)====
sub print_obj {
  my ($obj,$lvl) = @_;
  $lvl = 0 unless defined $lvl;
  if (ref($obj) eq 'HASH') {
    my %h = %{$obj};
    foreach my $key (keys %h) {
      print_n_tabs($lvl);
      print "KEY: $key\nVALUE(s)";
      print_obj($h{$key},$lvl+1);
    }
  } else {
    if (ref($obj) eq 'ARRAY') {
      my @a = @{$obj};
      foreach my $ai (@a) {
	print_n_tabs($lvl);
	print "ARRAY item\n";
	print_obj($ai,$lvl+1);
      }
    } else {
      if (ref($obj) eq 'SCALAR') {
	print_n_tabs($lvl);
	print "$$obj\n";
      } else {
	print_n_tabs($lvl);
	print "$obj\n";
      }
    }
  }
}

sub print_n_tabs {
  my $n = shift;
  my $i = 0;
  while ($i < $n) {
    print "\t";
    $i++;
  }
}


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

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:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 2993
***************************************


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