[Biodevelopers] Object Oriented Perl issue

Joe Landman landman at scientificappliance.com
Thu Apr 25 10:29:16 EDT 2002


On Wed, 2002-04-24 at 17:25, Steve O wrote:
> Joe,
> 
> You might want to check out Damian Conway's book Object Oriented Perl.
> He shows how to use perl's AUTOLOAD feature to create get/set
> methods on the fly if they don't exist.  This allows you to write 
> get/set methods that have interesting behavior, and leave the simple 
> ones for perl to make up. 

I saw this in the book and wondered if it introduced too much complexity
in what I thought should be a simple problem.

[...]

> The argument I think OO people would have with your get_attribute
> and set_attribute functions is that it allows access to all
> of the object's state and allows no extra processing.  The methods
> are providing no extra benefit over the simpler:

So what you are saying is that my get/set pair let you run roughshod
over the object (which is a potential security/stability risk) without
bound.  The autogenerated accessor/mutator do not.

That is a good argument to use the autogenerated ones. 

>   $object->{fragment}="foo";
>   print "fragment: ",$object->{fragment},"\n";






More information about the Biodevelopers mailing list