On Thu, Oct 21, 2004 at 01:54:29AM +0900, Brian Candler wrote:
> I've been trying to maintain someone else's Perl code over the last few
> days, and although it was written using OO features, making changes has had
> me pulling my hair out. For example, when I want to define another class, I
> am *forced* to put it in a separate file,

This is not quite accurate. If you stick the following in a file and run it,
it will output `HELLO'.

package Foo;

sub new
{
    my $class = shift;
    my $arg = shift;

    my $data = {message => $arg};
    return bless $data, $class;
}

sub greet
{
    my $self = shift;

    return uc $self->{'message'};
}

package main;

my $foo = new Foo("hello");
print $foo->greet, "\n";

> with about a screenful of module declarations at the top; and then stick
> $self-> in front of every method call, and dereference pointers all over the
> place. Yuk - might as well have been writing in C.

I wouldn't go that far but Perl is uglier than Ruby in my eyes, too.

-- 
Jos Backus                       _/  _/_/_/      Sunnyvale, CA
                                _/  _/   _/
                               _/  _/_/_/
                          _/  _/  _/    _/
jos at catnook.com        _/_/   _/_/_/          require 'std/disclaimer'