[Dbix-class] Proposed readonly patch for DBIx::Class
Alex Povolotsky
tarkhil at over.ru
Thu Aug 11 05:56:37 GMT 2011
Ben Tilly пишет:
> Often database schemas have tables that should not be changed at
> runtime in the application. It would be convenient to be able to mark
> this fact in the class. However to avoid accidents you wind up having
> to override methods in both the Row class and the ResultSet class.
> Having to synchronize changes to 2 classes is kind of messy.
>
> The attached patch makes this look much nicer in the client code.
> With this in the Result class you just say:
>
> __PACKAGE__->readonly(1);
>
> and now you won't accidentally update that table from in Perl. It can
> be unset at any time and so doesn't provide any actual security, but
> it is a useful hint.
>
> Is there any possibility that this could be considered for inclusion
> in DBI
Readonly component (dies on insert/update/delete) seems to me to be much
more reasonable solution. Do not overbloat base class, it is not too
thin already.
Alex
More information about the DBIx-Class
mailing list