Hi,

I have written a perl program to send emails automatically using Email::Send::Gmail module under cygwin environment.

#!/bin/perl use strict; use warnings; use Email::Send; use Email::Send::Gmail; use Email::Simple::Creator; my $from = undef; my $to = undef; my $subject = undef; my $body = undef; my $username = undef; my $password = undef; my $numArgs = $#ARGV + 1; if($numArgs < 6) { print "Less number of arguments than expected...\n"; print "Execute as - EmailSend.exe from to subject body_file userna +me password\n"; print "Eg: EmailSend.exe venkatesan.gangadharan@gmail.com g.venkat +esan@level3.com Test body.txt venkatesan.gangadharan@gmail.com xxxx"; exit(0); } elsif($numArgs > 6) { print "More number of arguments than expected...\n"; print "Execute as - EmailSend.exe from to subject body_file userna +me password\n"; print "Eg: EmailSend.exe venkatesan.gangadharan@gmail.com g.venkat +esan@level3.com Test body.txt venkatesan.gangadharan@gmail.com xxxx"; exit(0); } $from = $ARGV[0]; $to = $ARGV[1]; $subject = $ARGV[2]; $body = $ARGV[3]; $username = $ARGV[4]; $password = $ARGV[5]; my $email = Email::Simple->create( header => [ From => $from, To => $to, Subject => $subject, ], body => $body, ); my $sender = Email::Send->new( { mailer => 'Gmail', mailer_args => [ username => $username, password => $password, ] } ); eval { $sender->send($email) }; die "Error sending email: $@" if $@;

The above program worked fine until recently. I made some modifications in the program and tested it previously. The program throwed some errors testing, so i reverted back to my previous working code. The problem now is eventhough i reverted my code to the previous working code, when i run the program (as ./EmailSend.pl), cygwin still throws the same old errors.

My Results:
$ ./Emailtest_backup_2.pl
Possible unintended interpolation of @gmail in string at ./Emailtest_backup_2.pl line 24.
Possible unintended interpolation of @level3 in string at ./Emailtest_backup_2.pl line 24.
Possible unintended interpolation of @gmail in string at ./Emailtest_backup_2.pl line 24.
Possible unintended interpolation of @gmail in string at ./Emailtest_backup_2.pl line 31.
Possible unintended interpolation of @level3 in string at ./Emailtest_backup_2.pl line 31.
Possible unintended interpolation of @gmail in string at ./Emailtest_backup_2.pl line 31.
Global symbol "@gmail" requires explicit package name at ./Emailtest_backup_2.pl line 24.
Global symbol "@level3" requires explicit package name at ./Emailtest_backup_2.pl line 24.
Global symbol "@gmail" requires explicit package name at ./Emailtest_backup_2.pl line 24.
Global symbol "@gmail" requires explicit package name at ./Emailtest_backup_2.pl line 31.
Global symbol "@level3" requires explicit package name at ./Emailtest_backup_2.pl line 31.
Global symbol "@gmail" requires explicit package name at ./Emailtest_backup_2.pl line 31.
Execution of ./Emailtest_backup_2.pl aborted due to compilation errors.

If you could see the code, the program should produce the following output:

Less number of arguments than expected... Execute as - EmailSend.exe from to subject body_file username password Eg: EmailSend.exe venkatesan.gangadharan@gmail.com g.venkatesan@level3 +.com Test body.txt venkatesan.gangadharan@gmail.com xxxx

But it is giving the output of my previous tests.

Could anyone help me to sort out this problem?

Thanks in advance!!!

In reply to (solved - Thanks to corion) HELP: Perl Program working unexpectedly under cygwin environment by venkatesan_G02

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.