anybody who works on call, or has a pager 24/7 will CRINGE at this.... I set out to learn some perl, get some attention at work, and look busy in between video games.
it turns out, with the help of the mighty monks, i stumbled on LWP!
you mean that i can issue an HTTP POST command, and have it read from a file ??!??!!
uhoh...the pager company is see me loitering around!!
it also turns out that I have a REALLY lazy co-worker...who gets a way with redrum, and thinks he has too much "crap to deal with all day....(well it just got worse)
well...when I got his pager number, this is what happened...
#!/usr/bin/perl -w
$|++;
use HTTP::Request::Common;
use LWP::UserAgent;
my $file = '/home/steven/error-codes';
open(INFO, $file) or die "Couldn't open $file: $!";
while (<INFO>){
chomp;
$ua = LWP::UserAgent->new;
$ua->request (POST 'http://www.pager-co.hah/cgi-bin/wwwpage.cgi',
[PIN => 'xxx5551212',
MSSG => "$_",
]);
}
close(INFO) or die "Error writing $file: $!";
i put some dummy error codes into a file (which look strikingly similar to real error codes), which he gets as a page, but when he gets the page, he has no idea what is happening, because he never RTFM!! PS...this script will be set as a cron job @ 3 am every night!! ...and they thought i was an underachiever
update:
????
Edit by castaway - restored original content
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.