Strict and Warnings safe (the warning issued is part of the poem)#!/usr/bin/perl use strict; use warnings; use constant AWHILE => 1; my $life = new Life; until ($@) { eval { !$life->fulfilled ? sleep(AWHILE) && $life->tick : die('hap +py') } } print $life->fullfilled if $@ =~ /happy/; #_____________________________________________________________________ package Life; sub new { my ($existance, $self) = (shift,{age=>0, maxage=>int(rand(100))}); bless $self, $existance; } sub fulfilled { $ENV{ENLIGHTENMENT} } sub tick { no warnings 'once'; seek ENLIGHTENMENT, 0, 1; $_[0]->{age}++; die( $_[0]->{age} ) if (($_[0]->{age}) > ($_[0]->{maxage})) }
The Eightfold Path: 'use warnings;', 'use strict;', 'use diagnostics;', perltidy, CGI or CGI::Simple, try the CPAN first, big modules and small scripts, test first.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Life on the Path of Wisdom (?)
by mugwumpjism (Hermit) on May 24, 2005 at 23:51 UTC |