Iam sitting at work bored out of brain and decide to code
something. What I usally code here at work are custom scripts
to import data from a client of my company's to our oracle
database. Needless to say this means alot of loading data into
variable's and arrays. So I wrote a perl module to handle loading chars :)

p.s. Some would say I am a prime example of miss-led youth in my generation.
The module :)
package popchar; use strict; sub new { bless { chars => [qw( | / - | - \ )] },$_[0]; } sub pc { $_[0]->{char} = shift(@{$_[0]->{chars}}); push(@{$_[0]->{chars}},$_[0]->{char}); return($_[0]->{char}); } 1;
Example script:
#!/usr/bin/perl -w use strict; $|=1; use popchar; my($pch) = popchar->new; while(1) { print "\rLoading ".$pch->pc(); }

Replies are listed 'Best First'.
RE: Quite possibly the stupidest perl module ever written :)
by japhy (Canon) on Sep 22, 2000 at 05:23 UTC
    I'd rewrite it using overload:
    package whirly; use overload ('""' => \&nextchar, fallback => 1); use strict; sub new { bless [ '|', '/', '-', '\\' ] } sub nextchar { push @{ $_[0] }, shift @{ $_[0] }; return $_[0][0]; }
    Used like so:
    use whirly; $waiting = new whirly; until (file_downloaded()) { print $waiting; }


    $_="goto+F.print+chop;\n=yhpaj";F1:eval
RE: Quite possibly the stupidest perl module ever written :)
by ZZamboni (Curate) on Sep 22, 2000 at 05:06 UTC
    Well, not as useless as you may think. In fact, whirley thingies were the subject of an interesting thread some time ago.

    --ZZamboni

RE (tilly) 1: Quite possibly the stupiest perl module ever written :)
by tilly (Archbishop) on Sep 20, 2000 at 23:32 UTC
    IMHO not as stupid as less. :-)

    (At least it does something...)

      Actually it is spelled "use less" where the space is optional. :)

              - tye (but my friends call me "Tye")
RE: Quite possibly the stupiest perl module ever written :)
by turnstep (Parson) on Sep 20, 2000 at 05:17 UTC

    Definitely the stupiest perl module I've ever seen, period.

    Just one question - what does "stupiest" mean? *g,d&r*

      it means stupidest when you miss you 'd' key :)


      lindex
      /****************************/ jason@gost.net, wh@ckz.org http://jason.gost.net /*****************************/