drieuxster (drieuxster) wrote,
drieuxster
drieuxster

Silly Code For the Poly Folks


#!/usr/bin/perl -w
use strict;

#------------------------
# lj_poly_term - to solvle a technical
# question for the poly amorry joker
#------------------------

my $foo = new Lj::Poly::Burper;





$foo->burp;

#
# the handy dandy class in a Begin Block,
# Just for the Fun Of It.
#
BEGIN {
package Lj::Poly::Burper;

use 5.006;
use strict;
use warnings;

our $VERSION = '0.01';
#---------------------------------
# Our Stock Constructor
# note: <http://www.perlmonks.org/index.pl?node_id=52089>
sub new
{
my $class = shift;
my $self = {};
bless $self, $class;

} # end of our simple new

#---------------------------------
# so that AUTOLOAD finds one here

sub DESTROY {}

#---------------------------------
# The Constants
#---------------------------------

#
# the list of phrases is what we select from
# so update this with what ever will be used.
#
my @phrases = (
'phrase zero',
'phrase one',
'phrase two',
'phrase three'
);

# this way we have a single instance of the
# max token at the time of the compile In case
# anyone were to Use This
#
my $phrase_max = $#phrases;

#------------------------
# The Function get_rand_number_in_range() requires
#
# a. $min - the minimum value
# b. $max - the maximum value
#
# It will return a random number within those two
# numbers inclusively.
#
#
sub get_rand_number_in_range
{
my ($me, $max, $min) = @_;

$min = 0 unless(defined($min));
my $base = $max - $min + 1;
my $tmp = int(rand($base)) + $min;

} # end of get_rand_number_in_range

#------------------------
# boring intermediary method for getting
# merely the phrase.

sub get_phrase
{
my ($me) = @_;

my $key = $me->get_rand_number_in_range($phrase_max);

$phrases[$key];

} # end of get_phrase

#------------------------
# This of course allows for the actual
# all in one, get the random phrase and print it.

sub burp
{
my ($me) = @_;

my $phrase = $me->get_phrase;

print "$phrase\n";

} # end of burp

1; # so that the 'use Lj::Poly::Burper'
# will know we are happy
} # end begin

#
# end of the world as I knew it drieux@wetware.com all rights reserved
# but provided as an as is piece of comedy. If you like it, use it,
# and be polite and leave the notice
#

Subscribe

  • What if we had to be a nation of laws

    First off a h/t to a dear fiend, for Crackdown on herd-share farms over certification which is such a classical attack of the FeeMarketeers meets…

  • why do folks forget the clinton years?

    Essentially I agree with When The Magic Starts in that there is much that will need to be undone from the failure of the deregulation game that was…

  • Oil does not grow on trees.

    Let us start from the premise that fossil fuels are not like renewable products such as fruits, vegetables and other forms of…

  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 2 comments