I'm rewriting a program that I use occasionally to track UPS shipments and have the status sent to a pager or e-mail address through a program that I use. My previous version used Lynx to fetch the package tracking info and dump the status to a file which was parsed and the pertinent info was sent out. This time, I'm sending out all the data (because of the limitations on hashes and the
Business::UPS module. In running my code below on ActiveState Perl on a Win2000 box, I get the following error.
Can't use string "File::CounterFile" as a HASH ref while "strict ref" in use at E:/perl/lib/file/CounterFile.pm line 68.
Code is below
#!/usr/local/bin/perl
use Business::UPS;
use File::CounterFile;
$counter = File::CounterFile->new("./msgid", "00000000");
$id = File::CounterFile->value;
$filename = "pagemsg".$id;
print "Enter in your UPS package tracking number: ";
$track = <STDIN>;
chomp($track);
print "Enter in the receiver ID or e-mail address of the recipient";
$receiverID = <STDIN>;
chomp($receiverID);
print "Enter in the name of the messaging service, phone number (no da
+shes or special characters), or Internet messaging server address (SN
+PP, WCTP, or e-mail server address or IP address)";
$service = <STDIN>;
chomp($service);
%t = UPStrack("$track");
$t{error} and die "ERROR: $t{error}";
open (FILE, $filename);
print FILE "MSG:\n";
print FILE "TO: $receiverID $service\n";
print FILE "CONTENTS: This package is $t{'Current Status'}\n"; # 'Del
+ivered' or
# 'In-transit'
print FILE "Package route\n";
foreach $key (keys %t) {
print FILE "KEY: $key = $t{$key}\n";
File::CounterFile->lock();
$counter->inc;
File::CounterFIle->unlock();
}
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.