#!/usr/local/bin/perl -w package Mary; $lamb = new Sheep (size => 'little'); $lamb->fleece("#FFFFFF"); sub go { my $self = shift; $location = shift; $lamb->go($location); } Mary->go('school'); package Sheep; sub new { my $class = shift; bless { @_ }, $class; } sub fleece { my $sheep = shift; $sheep->{fleece} = shift; } sub go { my $sheep = shift; $sheep->{location} = shift; if ($sheep->{location} =~ /school/i) { warn "Sheep are not allowed at school.\n"; Children->see($sheep, $sheep->{location}); } } package Children; sub see { my $children = shift; my($object, $location) = @_; if ($object->isa('Sheep') and $location =~ /school/i) { $children->laugh(); $children->play(); } } sub laugh { print "Hahaha!\n"; } sub play { print "Whee!\n"; } # # Mary had a little lamb # Its fleece was white as snow # And everywhere that Mary went # The lamb was sure to go # # It followed her to school one day # Which was against the rules # It made the children laugh and play # To see a lamb at school #

Replies are listed 'Best First'.
Re: mary.pl
by Blue (Hermit) on Dec 02, 2000 at 02:20 UTC
    Very nice. My only quibble is that I'm living in New Jersey, and our snow is closer to "#808080" then "#FFFFFF". {grin}.

    =Blue
    ...you might be eaten by a grue...

      I live in the south.
      I've seen lots of sheep.
      The best I've ever seen is #E8E8E8.

      :)

      /\/\averick

Re: mary.pl
by Yer Mom (Pilgrim) on Dec 01, 2000 at 15:43 UTC
    I can't believe I've reached the age of 30 without knowing there was a second verse to that... :)