Skip Menu |

This queue is for tickets about the Object-Tiny CPAN distribution.

Report information
The Basics
Id: 29355
Status: rejected
Priority: 0/
Queue: Object-Tiny

People
Owner: Nobody in particular
Requestors: rt.cpan [...] sartak.org
Cc:
AdminCc:

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



Subject: Setters?
Hi Adam, I like the idea behind Object::Tiny. Any particular reason why you don't support setters on the attributes? I may have to fork this.. :) Shawn
Subject: Re: [rt.cpan.org #29355] Setters?
Date: Mon, 17 Sep 2007 13:48:13 +1000
To: bug-Object-Tiny [...] rt.cpan.org
From: "Adam Kennedy" <adamkennedybackup [...] gmail.com>
Because naively allowing anyone to write unvalidated data to the property is almost as bad as allowing people to naively write to the hash key. Thus, I'm almost certainly going to want to write setters myself, so I can validate the input etc. Adam K On 14/09/2007, Shawn M Moore via RT <bug-Object-Tiny@rt.cpan.org> wrote: Show quoted text
> > > Thu Sep 13 23:09:21 2007: Request 29355 was acted upon. > Transaction: Ticket created by SARTAK > Queue: Object-Tiny > Subject: Setters? > Broken in: (no value) > Severity: Wishlist > Owner: Nobody > Requestors: sartak@gmail.com > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=29355 > > > > Hi Adam, > > I like the idea behind Object::Tiny. Any particular reason why you > don't support setters on the attributes? I may have to fork this.. :) > > Shawn >
On Sun Sep 16 23:48:39 2007, adamkennedybackup@gmail.com wrote: Show quoted text
> Because naively allowing anyone to write unvalidated data to the
property is Show quoted text
> almost as bad as allowing people to naively write to the hash key. > > Thus, I'm almost certainly going to want to write setters myself, so
I can Show quoted text
> validate the input etc. > > Adam K
Fair enough. As you're no doubt aware, there is a difference in that you can always add your own explicit setter later that does validation/ munging/black magic, and it won't disrupt any well-behaved code. Shawn
Subject: Re: [rt.cpan.org #29355] Setters?
Date: Mon, 17 Sep 2007 14:21:55 +1000
To: bug-Object-Tiny [...] rt.cpan.org
From: "Adam Kennedy" <adamkennedybackup [...] gmail.com>
Likewise with Object::Tiny. If in the same class, you just remove the name from the list you provide to Object::Tiny. If in a subclass, you just add it. This isn't THAT simple in something like Class::Accessor, which even creates a private _accessor_foo for you to use. I find Object::Tiny's method far more pragmatic. It isn't trying to create a model for the class, it's just a shortcut to generate the code you would otherwise be writing anyway. Adam K On 17/09/2007, Shawn M Moore via RT <bug-Object-Tiny@rt.cpan.org> wrote: Show quoted text
> > > Queue: Object-Tiny > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=29355 > > > On Sun Sep 16 23:48:39 2007, adamkennedybackup@gmail.com wrote:
> > Because naively allowing anyone to write unvalidated data to the
> property is
> > almost as bad as allowing people to naively write to the hash key. > > > > Thus, I'm almost certainly going to want to write setters myself, so
> I can
> > validate the input etc. > > > > Adam K
> > Fair enough. As you're no doubt aware, there is a difference in that > you can always add your own explicit setter later that does validation/ > munging/black magic, and it won't disrupt any well-behaved code. > > Shawn >