OKOK, forget the actual file reading - it was just an example of a simple model that needs a little bit of configuration (the directory) and a parameter to spit out some result.
I still don't quite get what's wrong with using this in several controllers. the model is completely separated from the controller and if I need to make a change to the way I read files (i.e. use something more sensible than backticks in this case...), I still only change the model, i.e. my NonCatalyst::FileCat module in a single place. How would the adaptor approach help me with that?
It seems to me that the only benefit of using an Adaptor is that the model has access to the config. I can see the point for that if the model needs a lot of configuration and is tightly tied in with the Catalyst App but if it simply requires a directory to work with or some other trivial data, then it seems that I get much better separation of web app implementation and back-end model by using the NonCatalyst class directly. The way I suggested, I can just as easily use the model class from a command line script or a desktop GUI app or something.
Apologies for being so persistent :-) and thanks a lot for your patience. It's just that this seems so counterintuitive to me and I can imagine that others have the same questions. I like Catalyst so far but there is not as much information out there as for some other web frameworks.
In reply to Re^8: Trying to understand Catalyst::Model::Adaptor
by tospo
in thread Trying to understand Catalyst::Model::Adaptor
by tospo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |