[Dbix-class] RFC: Inflating user-supplied values

Matt S Trout dbix-class at trout.me.uk
Mon May 7 14:02:56 GMT 2007


On Sun, May 06, 2007 at 09:16:41AM -0400, Jason Kohles wrote:
> So everybody probably saw my confusion with inflation from yesterday,  
> and while it is all working now (thanks Claco!) I have to admit I  
> still find the behavior counter-intuitive at best.  I guess when I  
> was just inflating DateTime objects it made more sense, since the  
> inflated values were so much more complex than the representation  
> that was stored in the database, but when I started using  
> DBIx::Class::InflateColumn::Currency, it seemed odd to me that  
> '$10.00' would be inflated to a Data::Currency object if it came from  
> the database, but not if it came from the user.  I've fixed this for  
> my immediate need by writing an HTML::FormFu::Inflator subclass that  
> parallels DBIx::Class::InflateColumn::Currency, but going forward I'd  
> like to avoid repeating so much code, so I've come up with an idea to  
> extend DBIx::Class::InflateColumn to allow user-provided values to be  
> inflated the same way that database values are.

Well, if you call $obj->inflated_field('$10.00');

then do $obj->inflated_field; the second call will return the inflated object.

I'm not sure I see what the problem you're trying to solve is?

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
Shadowcat Systems Ltd.   Contact mst (at) shadowcatsystems.co.uk for a quote
                                          http://www.shadowcatsystems.co.uk/ 



More information about the Dbix-class mailing list