Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Tie::Hash::Cannabinol

by davorg (Chancellor)
on Jun 06, 2001 at 13:54 UTC ( #86157=sourcecode: print w/replies, xml ) Need Help??
Category: Fun Stuff
Author/Contact Info Dave Cross <dave@dave.org.uk>
Description:

The idea of writing a module that could be called T::H::C was too good to ignore.

Don't trust anything this hash tells you :)

package Tie::Hash::Cannabinol;

use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);

require Exporter;
require Tie::Hash;

@ISA = qw(Exporter Tie::StdHash);
@EXPORT = qw();
@EXPORT_OK =();

$VERSION = '0.01';

sub FETCH {
  my $self = shift;

  my @keys = keys %$self;

  return $self->{$keys[rand $#keys]};
}

sub EXISTS {
  return rand > 0.5;
}

1;
Replies are listed 'Best First'.
Re: Tie::Hash::Cannabinol
by wrboyce (Initiate) on Jan 09, 2005 at 15:11 UTC
    hmm, Tetra::Hydro tbh.
Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://86157]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2016-10-01 21:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (7 votes). Check out past polls.