2009/5/8 Tomas Doran <bobtf...@bobtfish.net> > Oleg Pronin wrote: > >> Not really :-) While in request, browser header is ok, but the task is to >> be able to authenticate in offline scripts as well - because the controllers >> and etc read logged in user from $c->user. >> Currently we use workaround - fake $c object + setup $c->request->header >> for base authentication as it came from browser. >> > > That's not _too much_ of a hack, given that you've got application logic in > your controllers anyway. > > The recommended thing to do is to not have any application logic in your > controllers (just have web parameter mangling related stuff). If your logic > is all in the model, then your scripts can deal with authenticating without > having to fake up a web request, or in fact load Catalyst at all, which is > much nicer, and makes much more sense in a script context.. >
How do i should in this case read my config in script context ? MyApp initializes everything - memcached, dbic, uuid, json, etc. By writing 'use MyApp' i get everything i need. Additionally, MyApp is complex system which consists of a lot of modules (by means of C3) and is not only a web framework. I would be nagged if i do not load Catalyst at all, then i'll have to use every component from script directly writing a lot of code instead of nice and short 'use MyApp'. I'd say than Catalyst is not _Web_ framework, it is _everything framwork_. In my own opinion it is better to make a little difference for scripts (use MyApp { offline => 1 }) - which will not load web stuff and get start lighter, but framework will stay with many features for such scripts - for example, automatic pid file with double execution prevent, wrapping script for errors detection on log files and many other, i.e. still framework-driven system, not script-driven. > > > Also, what do you mean by 'new Authentication', >> Catalyst::Authentication::Credential::HTTP has _always_ worked like >> this. >> >> I'm not sure but last time i used this feature (several months ago) it >> worked fine >> > > Hmm, well, if you still think I've broken something, I'd love to see a > TestApp or test cases demonstrating what the problem is, as I'm still > unclear.. (And if I did break it, I'd obviously like to fix it again) > > > Cheers > t0m > > _______________________________________________ > List: Catalyst@lists.scsys.co.uk > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ > Dev site: http://dev.catalyst.perl.org/ >
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/