venkatesan_G02 has asked for the wisdom of the Perl Monks concerning the following question:
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!!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HELP: Perl Program working unexpectedly under cygwin environment
by Corion (Patriarch) on Oct 14, 2009 at 12:53 UTC | |
|
Re: (solved - Thanks to corion) HELP: Perl Program working unexpectedly under cygwin environment
by Anonymous Monk on Apr 28, 2016 at 14:26 UTC | |
by Corion (Patriarch) on Apr 28, 2016 at 14:29 UTC | |
|
Re: HELP: Perl Program working unexpectedly under cygwin environment
by venkatesan_G02 (Sexton) on Oct 14, 2009 at 13:16 UTC | |
by Corion (Patriarch) on Oct 14, 2009 at 13:23 UTC | |
by venkatesan_G02 (Sexton) on Oct 14, 2009 at 13:27 UTC |