Fayland Lam wrote:
the first is to load all modules at beginning. I want to ask why? for $c->forward()? I think $c->model() can load when called. why I hate this is because it eats too many memory. one of my App has 80+ pm then it takes 150+M. I can't afford that!

You don't mention how you are running the catalyst application, I presume you're using fastcgi or mod_perl or some other long running persistent process ?

In which case you want to load everything first, particularly in mod_perl so it can be shared between processes.

In any event, the answer is to throw more ram at it, ram is cheap and it's not really worth trying to optimise for low ram conditions.

the second one is hard to use model in cron pl. I know we can do something like my $c = MyApp->prepare(); or Catalyst::Model::Adaptor (trust me, that's not so easy or fast) why I can't get a simple $c without function forward, without req, without res. just get $c->model and $c->cache like?
I don't want this $c to load any Controller modules or View modules.

Catalyst is a web application framework. You have two choices:

1. Use a simple LWP type script in cron to call the necessary web URI and let the server do the heavy lifting; or

2. Make sure you encapsulate the business logic in the model and not in the controller, then you can just load the necessary schema classes and ignore catalyst entirely.

In the latter case there's still some work to do if you want to have a shared config file but that's not too hard to figure out.

Simon.

_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to