Skip Menu |

This queue is for tickets about the Class-XSAccessor CPAN distribution.

Report information
The Basics
Id: 42579
Status: resolved
Priority: 0/
Queue: Class-XSAccessor

People
Owner: Nobody in particular
Requestors: siracusa [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Hybrid get/set methods
It'd be great if Class::XCAccessor could create a (fast :) method that's the equivalent of this: sub foo { return $_[0]->{'foo'} = $_[1] if(@_ > 1); return $_[0]->{'foo'}; } That is, a single method that acts as a mutator if an argument is passed, and an accessor otherwise.
Hi John, those accessors are already there. I guess the docs aren't all that great. There's "getters" which are pure, read-only getters, there's "setters" which are write-only setters, and there's "accessors"/mutators which do both. Documentation patches welcome :) Cheers, Steffen