Old partially finished screen saver

By k0pp on Jul 08, 2009

It was some 3 or 4 years ago I wrote this bit, basically it'll execute find on your *nix system, find all perl/C source code (.pl/.c) and print it out character by character with a half second delay. I was going to turn it into a screen saver for KDE, i guess i got sidetracked. Im just posting this to get the Perl section moving a little bit, i'll browse my old tarballs of perl code and see if i cant find something more interesting to post. bye.

#!/usr/bin/perl

use strict;
use Time::HiRes qw/usleep/;

if(!-e 'pop.lst') {
        my $pop1 = `find / -name *.c >>/tmp/pop.lst`;
        my $rand_a_lil_bit = `sort pop.lst`;
}
open(POP,"pop.lst");
my @lines=<POP>;
close(POP);
my $x = 1;
for($x .. scalar(@lines)){
        my $r=rand(scalar @lines);
        my $file=$lines[$r];
        open my $fh, $file or die "Cant open $file: $!";
        $| = 1;
        while ( read( $fh, my $chr, 1 ) ) {
                print $chr;
                usleep(75000);
        }
        close $fh;
        $x++;
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.