in reply to Re^5: tt2 with perl cgi and a csv file
in thread tt2 with perl cgi and a csv file

I guess I had a little to much fun sticking tags into my last post, I took so long you had another post waiting for me... So do I also need/want DBIx::Class? Once I am finished what files would I have? A .tt lib file for Catalyst and a .tt view file? Or a view file for edit one for search and one for edit? Although I kind of like going to the same url for list/search etc. Is there any quick start guide into this?

Replies are listed 'Best First'.
Re^7: tt2 with perl cgi and a csv file
by Your Mother (Archbishop) on Mar 28, 2008 at 15:41 UTC

    Jump in here: Catalyst manual intro. It discusses the layout of files and application structure. I recommend DBIx::Class (abbreviated DBIC) and there is also Rose::DB looks great but I haven't tried yet. There is also a budding Catalyst wiki (that address might not be permanent) which has lots of goodies.

    Another thing I like about the Cat community is there is a serious approach to designing applications "correctly" (where correctly means extensibly and to standards). Something like a list/search would be best broken up. But it would be easy to use almost exactly the same code in the background (not duplicating it but "chaining" it or passing around a single result set and adding parameters as they are introduced... well, you see the learning curve starting to kick in).

      Ok its been a few days I looked over the intro and I went through the Tutorial. I also found the #catalyst and #tt chans on "MAGnet". I have been thinking about my design and wondering how catalyst fits into it all.

      I want to keep most of the site static (everything but archives) but I also need to generate the side bars for the other top links. Right now I have the side bars defined in a .tt lib that every page links to. So for example Interlinear used the lib interlinear.tt which has Introduction Matthew on and on in a manually defined AoH. This is fine for my little test however I want to have the side links generated from the file name.

      Then I need to somehow figure out how to sort the links. First of all the first part of every file name is a book of the bible the books need to be in order and a non-link title needs to be on the bar for every book there is content in. Then the 2nd part of the file name is the chapter and verse so that needs to be sorted within the correct book. Then for the name of the link the . should be replaced with : and last of all this link needs to be indented. This will be slightly different for every section under the top bar. I guess catalyst does not need to know about all this going on. Somehow though I have got to cram all that logic into tt.

      Or I should make a controller for catalyst with that logic built in then after letting you approve its bars (I want to have every change approved before it goes live anyway) catalyst could shove a config::general config file tt`s way and call ttree. That is if tt can use a config::general config file.

      Now back to archives and my, about to be started, catalyst app. I am thinking of a DBIC DB like in the Tutorial using mysql (I used mysql in the tutorial because thats whats on my server) that has a table with "id(auto incrementing, Primary key) file (the actual file on the file system) date (the first part of the file name) name (the rest of the file name)". I will have part one of my app that, checks for new files in the file drop, converts any new ones to html, adds them to the table, gets verification for its changes, has login (though a client side Certificates would be REALLY cool), and last but not least moves everything from its testground server to the production server. The hard part about this is going to be getting the testground mysql table synced with the production one. Then on the production server would be a striped down version with no login that just displays the file list has searching (sorting would be awesome) and links to the files and possible links to downloadable pdf/odf/doc files.

      Does this sound reasonable to you or have I made some bad design flaw that I should fix before making all this?

      Thanks!

        Sorry it took so long to respond.

        Mostly sounds good. Serving files from a DB is a bit more work and much less performance than it's normally worth though. There is a newish (funny, it doesn't look newish; ho-ho) Catalyst model just for files; Catalyst::Model::File. I haven't used it but it looks interesting. And doing your own model based on just about anything is pretty simple and straightforward. There are CPAN packages for WSDL and RSS models, for example, along with an adaptor -- Catalyst::Model::Adaptor -- to make models even easier. I understand Catalyst blog Angerwhale is all file based if you wanted to peek at the code.