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 ...
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 ...
uptime: 21 days, 8:02
Use of uninitialized value in printf at ./dumpuptime.pl line 14.
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-
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
Outside of code tags, you may need to use entities for some characters:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] |