http://qs1969.pair.com?node_id=86157
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.