in reply to AbstractClassFactory
Like any piece of art the trick it knowing when to stop. You went one step too far here. Your code reference should not be blessed and the incant method is completely superfluous. I'd normally prefer to write that sort of thing as $obj -> ( 'method', @args ) since that's really what is happening anyway. The only thing you lose is the blessing's inheritance tree but you didn't mention that so I'm not sure if you even intended to use it. Personally I'm looking at your implementation as a way of getting to classless objects. All you really need here is the code reference - you just call it with the method/property name as a parameter to the object.
Also, some comments on style:
$class = ref($class) || $class;How about quiting the cargo cult line? For your concept it really doesn't fit here.
for (keys %$props) { $props->{$_} = $colors{$_}; }
Better done as a hash slice - your existing form is much less readable than it could be. Clearer: @{$props}{ keys %$props } = @colors{ keys %$props }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: AbstractClassFactory
by hypochrismutreefuzz (Scribe) on Jan 14, 2003 at 01:46 UTC | |
by diotalevi (Canon) on Jan 14, 2003 at 14:28 UTC |