http://qs321.pair.com?node_id=760391

grashoper has asked for the wisdom of the Perl Monks concerning the following question:

I must be perl-tarded but here goes. i am trying to setup and send a simple email and fooey no emails working yet, I have replaced the servername and username password stuff, they did have valid values what I do get is the number of processes and no errors aside from global variable $msg requires explicit package name. I am on a windows system 2003 server, using mime:lite and trying to use smtp but probably doing it wrong here is my code. ok you can give me a hard time if you want I just want to understand what is wrong aside from the complaining about that variable which is because of warnings and strict being on, cause everybody says to use warnings and strict. my shebang line has -w trust me it does.. I also want to loop this check so that it runs for several hours once an hour this should do for about 30 hours right?
use Win32::Process::List; use Mail::Sender; use MIME::Lite; use strict; my $numloops=0; my $timer=6000; while($numloops>30){ $numloops++ sleep $timer; my $P = Win32::Process::List->new(); if($P->IsError == 1) { print "an error occured: " . $P->GetErrorText . "\n"; } my %list = $P->GetProcesses(); my $anz = scalar keys %list; print "Anzal im Array= $anz\n"; my $count = 0; foreach my $key (keys %list) { # $list{$key} is now the process name and $key is the PID #print sprintf("%20s has PID %10s", $list{$key}, $key) . "\n"; $count++; } print "Number of processes: $count\n"; my $process = "mmdrv.exe"; my %hPIDS = $P->GetProcessPid($process); print keys (%hPIDS) . "\n"; if(%hPIDS) { foreach (keys %hPIDS) { print "$_ has PID " . $hPIDS{$_} . "\n"; } } else { print "Process(s) not found\n"; #exit; my $test= MIME::Lite->send('smtp', "servername@mydomain.com", AuthUser=>"$username",AuthPass=>"$Pass" ); my $msg = MIME::Lite->new( From =>'validemail@mydomain.com', To =>'validemail@mydomain.com', Cc =>'some@other.com, some@more.com', Subject =>'Hello testing email from perl heartbeat monitor sc +ript', Data =>"Loadrunner is running!" ); } }