Coder Profile - Show off your skills, get a coder profile.
 
 
 
The Author
thetrojan01
Lucas X.
Send A Message
Screenshot
View Full Size
screenshot_2009_1.... ( 0.86Mb )
Rating
Not
Rated
Please login to rate source codes.

Click here to register a free account with us.
General Details
Perl
Posted 1.17 Year Ago
145 Views
Received 0 Ratings
More Codes By This Author
Prime Number Finder - C/C...
Prime Number Finder - Jav...
Simple PHP port scanner (...
[perl] [*nix] Uptime
Make'EmCaps
Articles By This Author
How to fix scratched cds...
thetrojan01's brainfuck t...

[perl] [*nix] Uptime


Description
This is a little perl script made for *nix systems. It takes the uptime (which is in seconds format) and shows it as hh:mm:ss (hours:minutes:seconds)
if hours/minutes/seconds are/is less than 10, a zero digit ('0') is put, so the output is pretty.

I personally don't know much shell scripting so I made it in perl to show the uptime on my wmii bar.

In the screenshot, I use DWM, put that script to run in the .xinitrc and it's the first 09:mm:ss thing from the left, at the right side of the bar at the bottom.
Technical
System Requirements: Modern UNIX system and Perl interpreter.

You may need to change the Perl interpreter line to where the perl binary is located in your system.
For example:

change `#!/bin/perl` to `#!/usr/bin/perl`
Source Code
Comments
Please login to post comments.
 
thetrojan01     Posted 1.7 Year Ago
 
 
OK :-)
 
VBAssassin     Posted 1.7 Year Ago
 
 
I've learn't some perl... the syntax is the same... but perl adds a few
new/different things... it's those sort of things that you forget.

Like perl has eq to compare strings... php has ===/==... perl is also very context
sensitive... php isn't... perl has shortcuts like qw (quoted words)... and perl
allows different opening and closing things like qw// or qw"" or
qw&& etc... all work the same... php can't... perl doesnt require
brackets around functions... php does... perl allows the same name for a function,
variable, etc... php can't... perl uses default variables... php doesn't
have them... and so on...

It's that stuff you forget ;-)

Kind regards,
Scott
 
thetrojan01     Posted 1.8 Year Ago
 
 
if you know cpp/php you can't forget it... the syntax is the same :-p
 
VBAssassin     Posted 1.8 Year Ago
 
 
Neither do i really... just finished a book about perl... been doing perl for about 3
to 4 weeks... it's not a very nice language so i'd imagine i'll forget
it in a few years.

Kind regards,
Scott
 
thetrojan01     Posted 1.9 Year Ago
 
 
I don't know perl that much... :-)
 
VBAssassin     Posted 1.10 Year Ago
 
 
Nice, but how does that differ from:
http://search.cpan.org/~barabas/Sys-Load-0.2/Load.pm

or more specifically:

use Sys::Load qw/uptime/;
print "System uptime: ", int uptime(), "\n";

Kind regards,
Scott
Page 1 of 1
More "Perl" Source Codes By This Author
Recently Posted "Perl" Source Codes
Recently Rated "Perl" Source Codes
 
 
Latest News About Coder Profile
Coder Profile Poll
If you made money from keeping your profile up to date, say $30 and up, per month. What extra time would you spend on your profile?

No extra time
A few hours at weekends
A whole day each week
Every minute i can get free


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
1.67 Year Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2010, Scott Thompson, All Rights Reserved