[Israel.pm] OO Perl and Exporter

Offer Kaye offer.kaye at gmail.com
Tue Dec 28 02:27:21 PST 2004

On Tue, 28 Dec 2004 12:09:33 +0200 (IST), Shlomo Yona
<shlomo at cs.haifa.ac.il> wrote:
> You can imaging how ugly a code that has stuff like
>         $This::Is::My::Module::With::Its::Long::Name::variable
> or
>         This::Is::My::Module::With::Its::Long::Name::method
> in it looks like...

Yes, if I didn't supply all the needed method. But the whole point of
OO, I thought, was so the user doesn't/shouldn't have to write code
like the above. Instead she should write:

my $object = My::Module::With::Its::Long::Name->new();
my $variable = $object->some_var(); # returns the value of some_var
$object->some_var($new_val); # sets the value of some_var
$object->method(@args); # you get the idea...

As you can see, I only had to write "My::Module::With::Its::Long::Name" once.
Am I missing anything?

Offer Kaye

More information about the Perl mailing list