[Dbix-class] So they want ME to give a presentationaboutDBIx::Class

iain iainhubbard at googlemail.com
Mon Feb 1 12:43:27 GMT 2010


Octavian Rasnita wrote:
> From: "Ihnen, David" <dihnen at amazon.com>
> Good point, especially for an introduction... why to use an ORM.
> I'll have to spin up myself a bit on Template Toolkit (I'd been using 
> HTML::Template previously) and will probably have to merely mention 
> rather than explore the FormMu stuff, as I've never worked in Catalyst.
> David
>
> You can tell them that they can use a resultset in a template directly 
> like:
[snip]
>
> Of course, using this way, the designer will be able to print 
> something like
>
> [% user.password %] or [% user.another_private_info %]
>
> and the programmers might not want to allow the designers of the 
> templates to have that freedom, but if this is not an issue, it is a 
> very helpful way of using DBIC.
Its not just security thats a problem. Your front end guy makes a 
"small" template change and the next thing you know your web app is 
generating hundreds of SQL queries in its view because you didn't think 
that relationship needed pre-fetching. (Pre-fetch is a good thing to 
talk about as its often missed by people starting with DBIC)

I vote for not letting the template guys have access to the DB. Give 
them an intermediate object or wipe the schemas storage before passing 
to the template That way you still have a nice object to play with and 
can trap unexpected access to the DB whilst still in development.

I do know some people who prefer the flexibility you get by having the 
view be able to access the full DBIC object though.

So as always, TMTOWTDI :-)

Iain Hubbard.



More information about the DBIx-Class mailing list