pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:
Hail, ye Monks!
I'm new to Catalyst and writing my first app. I'm querying my os for user disk quotas and then displaying them. I'm trying to figure out the appropriate place to put logic to convert the quota data from kilobytes to more friendly values. Here's what I'm talking about:
| Limit | Used |
|---|---|
| 20000 | 546 |
| Limit | Used | Used Percent |
|---|---|---|
| 20 MB | 546 Kb | 03% |
I get a hash from my model which contains block_curr,block_hard etc... in kilobytes, courtesy of Quota. I want to display in megabytes or gigabyes as appropriate and also show the percentage of used space. I do this now inside the controller, but that seems wrong to me. I feel like I should handle that inside my view, but I don't know how. I'm using Template Toolkit as my view, so I could do what I want with Template Toolkit plugins...
So! My question is, where is the right place in a Catalyst app to put this kind of view specific logic and how do I put it there? If there are any good articles discussing this, please point the way.
Thanks!
--Pileofrogs
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Catalyst & Pretty Data
by bellaire (Hermit) on Mar 06, 2009 at 01:30 UTC | |
|
Re: Catalyst & Pretty Data
by Tanktalus (Canon) on Mar 06, 2009 at 00:43 UTC | |
|
Re: Catalyst & Pretty Data
by CountZero (Bishop) on Mar 06, 2009 at 06:01 UTC |