http://www.perlmonks.org?node_id=94682


in reply to Tie: Creating Special Objects

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-