in reply to 'Set' Method Return Value

If you've got a member that can be set and got, do away with (or hide via tie) the accessor methods and just let the user directly access the member.

If it's a set-only value, return the object.


Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re^2: 'Set' Method Return Value
by Limbic~Region (Chancellor) on Nov 23, 2005 at 14:17 UTC
    Roy Johnson,
    You asked in the CB what was wrong with this node. I am replying here for the benefit of everyone - not just those present in the CB at the time. It sounds like you are recommending breaking encapsulation. This may not be the case, but when you say "just let the user directly access the member", it implies $obj->{member} which would break if the underlying object were later turned into an array for instance.

    I am not saying your node is wrong, I am saying I can see why people might think that. If this isn't what you are suggesting, perhaps you should provide something a bit more clear.

    Cheers - L~R