Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Excellent tutorial! The only problem is that I've gotten errors from the regex on three different unixes. I've quadruple-checked my syntax, so i don't think it's that.

the program I'm using with the the module is ...

#!/usr/bin/perl -w use strict; use lib("."); use Uptime; $|++; my $uptime; tie $uptime, 'Uptime'; printf("%20s%-20s\n", "uptime:\t", $uptime->uptime); printf("%20s%-20s\n", "users:\t", $uptime->users); printf("%20s%-20s\n", "load(1):\t", $uptime->load('one')); printf("%20s%-20s\n", "load(5):\t", $uptime->load('five')); printf("%20s%-20s\n", "load(15):\t", $uptime->load('fifteen')); printf("%20s%-20s\n", "string:\t", $uptime->as_string);


... and the output I get on an AIX system, a Solaris system, and a Darwin system, is ...

./dumpuptime.pl uptime: 21 days, 8:02 Use of uninitialized value in printf at ./dumpuptime.pl line 14. users: load(1): 1 load(5): 0.04 load(15): 0.03 string: 20:39pm up 21 days, 8:02, 1 users, load +average: 0.04, 0.03, 0.04


Do I have something wrong, or is the regex in the tutoral off? Thanks, -s-

In reply to Re: Tie: Creating Special Objects by blueflashlight
in thread Tie: Creating Special Objects by btrott

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 romping around the Monastery: (5)
As of 2024-04-16 18:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found