use LWP::UserAgent;
use Mail::Sender;
use DBI;
use Spreadsheet::BasicRead;
($user, $pwd, $email) = @ARGV;
$date = time();
($sec, $min, $hour, $day, $mon, $year) = localtime $date;
$curryear = $year + 1900;
$xmon = sprintf ("%02d", $mon+1);
$day = sprintf ("%02d", $day);
$year =~ /\d\d(\d\d)/;
$truncyear = $1;
$name = "C:/sp500-".$xmon.$day.$truncyear.".xls";
&GetSNPfile($name);
$spread = new Spreadsheet::BasicRead($name) || die "Error: $!";
print "Opened Spread...\n";
while ($data = ""> last if ($$data[0] eq "ACTUALS");
next if !($$data[0] =~ m,/\d+/,);
$$data[0] =~ m,/\d{2}/(\d{4}),;
$year = $1;
push @ests, $$data[2];
push @dates, $$data[0];
}
@fwd_four = (reverse @ests)[0..3];
@fwd_four_dates = (reverse @dates)[0..3];
$printests = join "\t", @fwd_four;
$printdates = join "\t", @fwd_four_dates;
print $printdates."\n".$printests;
for (@fwd_four){$sum+=$_;}
print "\nSNP\t".$sum."\n";
$dbh = DBI->connect('dbi:Oracle:host=oracleserver;sid=serviceid',
$user,
$pwd,
{ RaiseError => 1, PrintError => 1 }
);
$getsnp = $dbh->prepare("Select COLUMN from TABLE where YEAR_COLUMN = ?");
$getsnp->execute($curryear + 1);
@row = $getsnp->fetchrow_array;
($snp_eps)[EMAIL PROTECTED];
$getsnp->finish();
print "DB\t".$snp_eps."\n";
if($snp_eps != $sum){
$result = "dvalues\nDB:\t$snp_eps \nWEB:\t$sum\t$printdates\n$printests\t";
}
else{
$result = "svalues \nDB:\t$snp_eps \nWEB:\t$sum\t$printdates\n$printests";
}
print $result;
$sender = new Mail::Sender
{smtp => 'mail.mailserver.com', from => '[EMAIL PROTECTED]'};
$sender->MailMsg({to => $email,
subject => "S&P Estimates",
msg => $result});
exit;
die "silly program doesn't know it's over";
($get) = @_;
print "Getting SNP file from web. . . \n";
$snp = getstore("http://www2.standardandpoors.com/spf/xls/index/SP500EPSEST.XLS", $get);
print "Done getting file. . . \n";
$snp;
}
Getting SNP file from web. . .
Done getting file. . .
Opened Spread...
09/30/2004 (91% actual) 12/31/2004 03/31/2005 06/30/2005
16.68 17.23 17.24 18.35
SNP 69.5
DB 69.5
svalues
DB: 69.5
WEB: 69.5 09/30/2004 (91% actual) 12/31/2004 03/31/2005 06/30/20
05
16.68 17.23 17.24 18.35_
Sam Gardner
GTO Application Development
Keefe,
Bruyette & Woods, Inc.
787 7th Avenue, 4th Floor
New York, NY
10019
(212) 887-6753
kbw.com
[EMAIL PROTECTED]
"For thousands more years the mighty ships tore across the empty wastes of space and finally dived screaming on to the first planet they came across - which happened to be the Earth - where due to a terrible miscalculation of scale the entire battle fleet was accidentally swallowed by a small dog." - HHG
This communication is confidential and is intended solely for the addressee. It is not to be forwarded to any other person or copied without the permission of the sender. Please notify the sender in the event you have received this communication in error. This communication is not an offer to sell or a solicitation of an offer to buy any securities discussed herein. Keefe, Bruyette & Woods, Inc. makes no representation as to the accuracy or completeness of information contained in this communication.
_______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs