Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > How to tell Perl not to convert @mydomain.com part inside a body of message?

Reply
Thread Tools

How to tell Perl not to convert @mydomain.com part inside a body of message?

 
 
sams
Guest
Posts: n/a
 
      04-30-2004
Hi

Anyone help me how to tell perl not to convert the @MyDomain part of
the inside a body of a mailmessage? In the
received mails I do see only myname.com the @myDomain part is missing.
Appreciate any help.

Tks

Sam.
 
Reply With Quote
 
 
 
 
Walter Roberson
Guest
Posts: n/a
 
      04-30-2004
In article < >,
sams <> wrote:
:Anyone help me how to tell perl not to convert the @MyDomain part of
:the inside a body of a mailmessage? In the
:received mails I do see only myname.com the @myDomain part is missing.

It isn't clear what connection perl has to your email ??

For what you describe to be happening, you would have to be
effectively -executing- the body of the email rather than just
doing some kind of textual processing on it. If your script is
doing that, it shouldn't be!!! What happens if someone sends you email
that happens to include $ or % or ${} constructs?

What I would suggest is that you edit your script, and on the #! line
at the beginning, you add -T to turn on taint checking; and I
suggest you use strict; use warnings; if you are not already doing
so. If whatever problem you are seeing does have to do with your
perl script, then between -T and using strict and warnings, you
will probably find a number of places in your script that aren't
properly written.
--
Rome was built one paycheck at a time. -- Walter Roberson
 
Reply With Quote
 
 
 
 
Sherm Pendley
Guest
Posts: n/a
 
      04-30-2004
sams wrote:

> Anyone help me how to tell perl not to convert the @MyDomain part of
> the inside a body of a mailmessage? In the
> received mails I do see only myname.com the @myDomain part is missing.
> Appreciate any help.


Without seeing your code, it's impossible to offer more than a guess...

As a shot in the dark though, I'd guess that the email message is in a
double-quoted string, so Perl is trying to interpolate the array @myDomain
into that string.

If you 'use strict' and 'use warnings', Perl would warn you about this and
other problems. If you 'use diagnostics', it might even suggest a solution.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
Walter Roberson
Guest
Posts: n/a
 
      04-30-2004
In article <>,
Sherm Pendley <> wrote:
:Without seeing your code, it's impossible to offer more than a guess...

:As a shot in the dark though, I'd guess that the email message is in a
:double-quoted string, so Perl is trying to interpolate the array @myDomain
:into that string.

But it wouldn't try to do that unless you somehow try to execute
the string. The email message is being read as input (somehow),
and at that point perl is just going to be treating each character
literally. If string $in happens to contain an @ then
neither my $b = $in; nor my $b = "$in"; are going to try to do
interpolation on the string contents.

Possibly the script tries to use the input string as a pattern, such as

s/$in/output/

"Patterns are subject to an additional level of interpretation as a
regular expression. This is done as a second pass, after variables are
interpolated, so that regular expressions may be incorporated into the
pattern from the variables."

or perhaps the script uses the 'e' modifier on a substitute that
has the input as the replacement portion. Or perhaps any of a number
of other possibilities...
--
History is a pile of debris -- Laurie Anderson
 
Reply With Quote
 
Robin
Guest
Posts: n/a
 
      04-30-2004

"sams" <> wrote in message
news: om...
> Hi
>
> Anyone help me how to tell perl not to convert the @MyDomain part of
> the inside a body of a mailmessage? In the
> received mails I do see only myname.com the @myDomain part is missing.
> Appreciate any help.
>
> Tks
>
> Sam.


Sam, it's be nice to see your code, however I had that exact same issue with
one of my scripts... instead of using something like print MAIL
""; use print MAIL "myuser\@mydomain.com"; that way it
won't try to interperate the array @mydomain -
Hope this helps.
-Robin



 
Reply With Quote
 
Robin
Guest
Posts: n/a
 
      04-30-2004

"Walter Roberson" <> wrote in message
news:c6ucua$edh$...
> In article <>,
> Sherm Pendley <> wrote:
> :Without seeing your code, it's impossible to offer more than a guess...
>
> :As a shot in the dark though, I'd guess that the email message is in a
> :double-quoted string, so Perl is trying to interpolate the array

@myDomain
> :into that string.
>
> But it wouldn't try to do that unless you somehow try to execute
> the string. The email message is being read as input (somehow),
> and at that point perl is just going to be treating each character
> literally. If string $in happens to contain an @ then
> neither my $b = $in; nor my $b = "$in"; are going to try to do
> interpolation on the string contents.
>
> Possibly the script tries to use the input string as a pattern, such as
>
> s/$in/output/
>
> "Patterns are subject to an additional level of interpretation as a
> regular expression. This is done as a second pass, after variables are
> interpolated, so that regular expressions may be incorporated into the
> pattern from the variables."
>
> or perhaps the script uses the 'e' modifier on a substitute that
> has the input as the replacement portion. Or perhaps any of a number
> of other possibilities...


that's true...I didn't see that.
-Robin


 
Reply With Quote
 
Sherm Pendley
Guest
Posts: n/a
 
      04-30-2004
Walter Roberson wrote:

> In article <>,
> Sherm Pendley <> wrote:
>
> :As a shot in the dark though, I'd guess that the email message is in a
> :double-quoted string, so Perl is trying to interpolate the array
> :@myDomain into that string.
>
> But it wouldn't try to do that unless you somehow try to execute
> the string.


Not true. Try this simple example:

#!/usr/bin/perl

use strict;
use warnings;
use diagnostics;

print "@hello, world!\n";

With strict and warnings enabled, the above emits a warning about "possible
unintended interpolation." With diagnostics, the warning includes a
description of how to escape the @.

Trust me - I worked at a hosting provider for six years, helping customers
get their Perl scripts working. This is quite possibly the single most
common bug that newbies encounter when they try to print an email address.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
Walter Roberson
Guest
Posts: n/a
 
      04-30-2004
In article <nbSdnd1CVrYwXA_dRVn->,
Sherm Pendley <> wrote:
|Walter Roberson wrote:

|> In article <>,
|> Sherm Pendley <> wrote:

|> :As a shot in the dark though, I'd guess that the email message is in a
|> :double-quoted string, so Perl is trying to interpolate the array
|> :@myDomain into that string.

|> But it wouldn't try to do that unless you somehow try to execute
|> the string.

|Not true. Try this simple example:

Ah, I just reviewed the original posting, and see that it was ambiguous.
The original poster did not say that the perl script was sending email,
and I read the posting as indicating that the poster has a script that
is filtering email (somehow), due to the phrasing about the
"received email".

Yes, you are right that if the mail being sent is in a double-quoted
string then perl would try to interpolate @myDomain . But if this
is a case of a mail filter, then what I wrote holds. Having re-read the
original message, I now think your interpretation of the situation
is the more likely.
--
Inevitably, someone will flame me about this .signature.
 
Reply With Quote
 
Jürgen Exner
Guest
Posts: n/a
 
      05-01-2004
Robin wrote:
> Sam, it's be nice to see your code, however I had that exact same
> issue with one of my scripts... instead of using something like print
> MAIL ""; use print MAIL "myuser\@mydomain.com";
> that way it won't try to interperate the array @mydomain -
> Hope this helps.


While this avoids the symptom it doesn't cure the desease.
Just use single quotes instead of double quotes if you want variables _not_
to be interpolated.

jue


 
Reply With Quote
 
Ala Qumsieh
Guest
Posts: n/a
 
      05-01-2004
"Jürgen Exner" <> wrote in message
news:g1Ckc.11258$...
> Robin wrote:
> > Sam, it's be nice to see your code, however I had that exact same
> > issue with one of my scripts... instead of using something like print
> > MAIL ""; use print MAIL "myuser\@mydomain.com";
> > that way it won't try to interperate the array @mydomain -
> > Hope this helps.

>
> While this avoids the symptom it doesn't cure the desease.
> Just use single quotes instead of double quotes if you want variables

_not_
> to be interpolated.


Backwacking a literal @ in a double-quoted string *IS* a cure for the
problem. I tend to use single quotes whenever I can, but if I ever needed a
literal @ in a string where I also need to interpolate other variables, I
will not hesitate to backslash it. There is nothing wrong with that.
Afterall, TMTOWTDI.

--Ala


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
To reduce your body weight & slim your body Loss weight MCSA 0 07-23-2007 07:54 PM
To reduce your body weight & slim your body Loss weight MCSA 0 07-21-2007 05:15 AM
sys.web.mail err: The requested body part was not found in this message SMG ASP .Net 1 04-26-2005 02:35 AM
Not detecting body.scrollTop and body.scrollLeft in IE6 London Boy Javascript 2 01-12-2004 08:44 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57