My dad came to visit and I was showing him the internet so I
never have to write a letter again(email)! I was showing
him how to bid on things on ebay. We placed a bid on a
coin he wanted, but he was driving me crazy checking it every
five minutes. I decided to take the email feature from my
adminmail.pl(posted already) program and the webpage
grabbing feature of my fatbrain.pl(also posted) program. I
turned it into the program you see bellow to tell me if I
lose the high bid. I set it in cron to check every five
minutes and we were able to relax the rest of the weekend.
I never thought perl would improve my relationship with my
dad, but it did! What other programming language can say
that! Since I had the code written and a pager that accepts
email it took about five minutes to setup. I am sure my
fellow monks will come up with creative ways to use email
pagers!
There is a line in the code that generates an error. Something
like "System cannot find file." The line is marked bellow.
The program works, but I was just curious.
use strict;
use Net::SMTP;
use LWP::UserAgent;
my $from = 'ergowolf07@home.com';
my @recip_list = ('XXXXXXX@skytel.com');
my $smtp_host = "mail";
# This line generates and error
my $smtp = Net::SMTP->new($smtp_host, Timeout => 30) || die "Can't con
+nect to $smtp_host.\n";
$smtp->mail($from) || die "cannot mail from.\n\n";
$smtp->recipient(@recip_list);
$smtp->data();
$smtp->datasend("To:\tEbay info\n");
my $page = 'http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item=XXX
+XXXXXXX';
my $ua = new LWP::UserAgent;
my $req = new HTTP::Request GET => $page;
my $string = $ua->request($req)->as_string;
if ($string =~ m/tmonte/g) {
$smtp->datasend("you are the high bidder.\n");
} else {
$smtp->datasend("You are no longer the high bidder.\n");
}
$smtp->dataend;
$smtp->quit;
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.