Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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(); }

In reply to File::CounterFile problems and hashes by cecil36

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-24 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found