Re: [Catalyst] How can it be - wrong model returned?
Ash Berlin wrote: On 6 Mar 2008, at 11:12, Alex Povolotsky wrote: Hello! I've made a simple many-to-many relationship for user/roles authentication, and suddenly found that my $model = $c-model('Pwuser')-search()-all(); my $roles = $c-model('Role')-search()-all(); my $ur = $c-model('UserRole')-search()-all(); results in SELECT me.uid, me.login, me.password FROM pwuser me: SELECT me.uid, me.rid FROM user_role me: SELECT me.uid, me.rid FROM user_role me: nothing get selected from role table, and $c-model('Role')-search-all selects from wrong table. How can it be and what can I do?... Alex. You are passing the wrong thing to $c-model and its falling back to the (hateful) regexp search. Assuming your DBIC::Schema model is MyApp::Model::DBModel you want $c-model('DBModel::Role'). Thanks a lot! Alex. ___ 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/
[Catalyst] How can it be - wrong model returned?
Hello! I've made a simple many-to-many relationship for user/roles authentication, and suddenly found that my $model = $c-model('Pwuser')-search()-all(); my $roles = $c-model('Role')-search()-all(); my $ur = $c-model('UserRole')-search()-all(); results in SELECT me.uid, me.login, me.password FROM pwuser me: SELECT me.uid, me.rid FROM user_role me: SELECT me.uid, me.rid FROM user_role me: nothing get selected from role table, and $c-model('Role')-search-all selects from wrong table. How can it be and what can I do?... Alex. ___ 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/
Re: [Catalyst] Push services with catalyst
But I still need a lot of code which is run by catalyst, like authentication and of course the whole dbic schema. What about Catalyst::Engine::HTTP::POE? cometd.com is not very informative ... Am 05.03.2008 um 23:47 schrieb Peter Edwards: Jay wrote: On Wed, Mar 5, 2008 at 11:48 AM, Moritz Onken [EMAIL PROTECTED] wrote: I'm combining ajax with push. So it's a real push service, the website is not pulling the data on a constant time rate. A process per client is really bad. I'll need to serve hundreds of client at the same time. Seems like push is not an option... Take a look at cometd: http://cometd.com/ Thanks for mentioning that, it looks interesting, particularly as it's hooked up to perlbal. Moritz, I've done something similar before using POE to handle many connections more cheaply than Apache (thanks to Matt Trout for the suggestion). It was to serve XML formatted requests though you could return JSON formatted data just as easily http://search.cpan.org/perldoc?POE::Component::Server::TCP Regards, Peter http://perl.dragonstaff.co.uk ___ 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/
Re: [Catalyst] How can it be - wrong model returned?
Include the model-name, not only the table $c-model('DBIC::Pwuser') for instance - andreas On Mar 6, 2008, at 12:12 PM, Alex Povolotsky wrote: Hello! I've made a simple many-to-many relationship for user/roles authentication, and suddenly found that my $model = $c-model('Pwuser')-search()-all(); my $roles = $c-model('Role')-search()-all(); my $ur = $c-model('UserRole')-search()-all(); results in SELECT me.uid, me.login, me.password FROM pwuser me: SELECT me.uid, me.rid FROM user_role me: SELECT me.uid, me.rid FROM user_role me: nothing get selected from role table, and $c-model('Role')-search- all selects from wrong table. How can it be and what can I do?... Alex. ___ 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/
RE: [Catalyst] Push services with catalyst
Am 05.03.2008 um 23:47 schrieb Peter Edwards: Jay wrote: On Wed, Mar 5, 2008 at 11:48 AM, Moritz Onken [EMAIL PROTECTED] wrote: I'm combining ajax with push. So it's a real push service, the website is not pulling the data on a constant time rate. A process per client is really bad. I'll need to serve hundreds of client at the same time. Seems like push is not an option... Take a look at cometd: http://cometd.com/ Moritz, I've done something similar before using POE to handle many connections more cheaply than Apache (thanks to Matt Trout for the suggestion). It was to serve XML formatted requests though you could return JSON formatted data just as easily http://search.cpan.org/perldoc?POE::Component::Server::TCP But I still need a lot of code which is run by catalyst, like authentication and of course the whole dbic schema. What about Catalyst::Engine::HTTP::POE? cometd.com is not very informative ... In the article http://www.irishdev.com/NewsArticle.aspx?id=2166 see that diagram of an SOA style architecture? http://alex.dojotoolkit.org/wp-content/Comet.png Browser UI = HTML + Javascript Comet client = Javascript driven by timed events talks persistent TCP to Comet event bus = proxy server, e.g. perlbal or nginx or POE TCP daemon talks HTTP or XML-RPC to Server-side processing = your Catalyst app You need to split the management of the many persistent TCP connections from the generation of content. In a typical web server setup you achieve this by using a scalable caching proxy front end to do the TCP socket handling and a Catalyst backend for the content. In your case you might need something a bit smarter in the front end, hence my mention of a custom POE daemon. Or you could write a plugin for perlbal http://search.cpan.org/dist/Perlbal/. You could make an XML-RPC or HTTP request from the front end to Catalyst to authenticate, and thereafter run periodic front to backend GETs and cache them (in the comet event bus part) ready to serve to the comet client via TCP. That way you don't need to tie up a 30MB Catalyst process just to hold open a socket, are spreading the request load evenly across time and can write it all in Perl. Alternatively, if you have an enormous load the for the proxy you could use nginx and write a C module to call out to your backend http://www.riceonfire.org/emiller/nginx-modules-guide.html Regards, Peter http://perl.dragonstaff.co.uk ___ 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/
Re: [Catalyst] On authentication again
On Thu, Mar 06, 2008 at 07:06:55PM +0300, Alex Povolotsky wrote: Hello! Maybe someone could provide the complete example of auth system with MODERN Catalyst::Plugin::Authentication? I mean, with database, Model and proper config. I have _no idea_ if I'm using old, new or pre-historic authentication, but this it want I cave in myapp.yml: # authentiation settings; perldoc # Catalyst::Plugin::Authentication::Store::DBIC authentication: dbic: user_class: 'Parley::Model::ParleyDB::Authentication' user_field: 'username' password_field: 'password' password_type: 'hashed' password_hash_type: 'MD5' -- Chisel Wright e: [EMAIL PROTECTED] w: http://www.herlpacker.co.uk/ I'm demented in a good way! ___ 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/
Re: [Catalyst] On authentication again
you are outdated ;) someone in the channel say we should use: 'Plugin::Authentication' = { ... } Chisel Wright schrieb: On Thu, Mar 06, 2008 at 07:06:55PM +0300, Alex Povolotsky wrote: Hello! Maybe someone could provide the complete example of auth system with MODERN Catalyst::Plugin::Authentication? I mean, with database, Model and proper config. I have _no idea_ if I'm using old, new or pre-historic authentication, but this it want I cave in myapp.yml: # authentiation settings; perldoc # Catalyst::Plugin::Authentication::Store::DBIC authentication: dbic: user_class: 'Parley::Model::ParleyDB::Authentication' user_field: 'username' password_field: 'password' password_type: 'hashed' password_hash_type: 'MD5' -- Mit freundlichen Grüßen Felix Antonius Wilhelm Ostmann -- Websuche Search Technology GmbH Co. KG Martinistraße 3 - D-49080 Osnabrück - Germany Tel.: +49 541 40666-0 - Fax:+49 541 40666-22 Email: [EMAIL PROTECTED] - Website: www.websuche.de -- AG Osnabrück - HRA 200252 - Ust-Ident: DE814737310 Komplementärin: Websuche Search Technology Verwaltungs GmbH - AG Osnabrück - HRB 200359 Geschäftsführer: Diplom Kaufmann Martin Steinkamp -- ___ 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/
Re: [Catalyst] On authentication again
On Mar 6, 2008, at 9:42 AM, Chisel Wright wrote: On Thu, Mar 06, 2008 at 06:28:11PM +0100, Felix Antonius Wilhelm Ostmann wrote: you are outdated ;) someone in the channel say we should use: 'Plugin::Authentication' = { ... } I'd better add the update to my Roadmap then Also make sure your plugins are up to date. This is a great but pretty new change. I switched naming conventions without updating my plugins and got weird behavior (session worked for exactly one page load but only after a POST) that was hard to track down. -Ashley ___ 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/
RE: [Catalyst] On authentication again
Alex Povolotsky wrote: I even don't understand what __PACKAGE__-config- I should use - {'Plugin::Authentication'}, {authentication} or{authentication}{dbic}. Docs are unclear. Alex, It should be {authentication}. Here's mine: authentication: default_realm: database realms: database: credential: class: Password password_field: password password_type: hashed password_hash_type: SHA-1 store: class: DBIx::Class user_class: DB::Users id_field: username role_field: name role_relation: roles Hope that helps Byron ___ 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/
Re: [Catalyst] On authentication again
On Thu, Mar 06, 2008 at 06:28:11PM +0100, Felix Antonius Wilhelm Ostmann wrote: you are outdated ;) someone in the channel say we should use: 'Plugin::Authentication' = { ... } I'd better add the update to my Roadmap then -- Chisel Wright e: [EMAIL PROTECTED] w: http://www.herlpacker.co.uk/ In theory, there is no difference between theory and practice. But, in practice, there is. ___ 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/
RE: [Catalyst] Base controllers and multiple inheritance
Peter Karman wrote: Byron Young wrote on 3/5/08 4:29 PM: Everything looks good, right? My List actions work! However, the CRUD actions don't work because the FormConfig actions seem to have been ignored -- $c-stash-{form} is undef :( I wouldn't expect anything in stash() to persist from request to request. Don't do anything with stash during new(). new() is called once per app life, at startup. stash() is for each request. Peter - thanks for taking the time to respond. Sorry, I was unclear about that $c-stash-{form} comment. $c-stash-{form} is created by the FormConfig action provided by Catalyst::Controller::HTML::FormFu, which is a base class of my CRUD base controller. For some reason, even though it appears new() is being called down both inheritance chains, the HTML::FormFu actions aren't set up properly. I want to be using new() in my base controllers mainly to set up and error check config(). I understand it's only called once per app life - I don't want to do config() error checking every request. $class-NEXT::new() doesn't do the right thing with this crazy diamond-ish inheritance I have, and I think using Class::C3 in my base classes while Catalyst::Controller and C::C::HTML::FormFu use NEXT is causing some problems. I'll try to reproduce the behavior with a small test later. I guess it's not really Catalyst-specific, but I figured Catalyst people would know since I saw some notes in the docs about wanting to switch Catalyst over to c3. My workaround for now is to have new() in each of my actual controller classes which passes control up to Catalyst::Controller::new() and then calls each superclass's __setup() method specifically. I don't like doing it this way, but for now I need to just keep moving ahead with this project so I will leave it until a better solution appears. Does anyone have any suggestions? Should I just forego using new() and do initial setup the first time auto() is called in each of my base controllers? depends on what kind of thing you are setting up. I have used multiple inheritance in my controllers to good effect (see CatalystX::CRUD::Controller and its descendents for example). In general, only set up things in new() (or its cousins) for stuff you want to set up once per app: config, persistent objects, etc. IME, there isn't much you want like that. I think the difference between your CX::CRUD::Controller's multiple inheritance and mine is that you don't have the diamond pattern. As an aside -- I wish I had seen your CatalystX::CRUD::Controller before! I actually based mine off of your C::C::Rose::CRUD but wanted to use DBIC and C::C::HTML::FormFu, so I made my own. Anyway, kudos! Thanks, Byron ___ 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/
Re: [Catalyst] Base controllers and multiple inheritance
Byron Young wrote on 3/6/08 12:31 PM: $class-NEXT::new() doesn't do the right thing with this crazy diamond-ish inheritance I have, and I think using Class::C3 in my base classes while Catalyst::Controller and C::C::HTML::FormFu use NEXT is causing some problems. You might try the C::Plugin::C3 as well. IIRC, I had to do that when I mixed NEXT-based controllers with C3-based controllers. The plugin overrides NEXT to make it Just Work. As an aside -- I wish I had seen your CatalystX::CRUD::Controller before! I actually based mine off of your C::C::Rose::CRUD but wanted to use DBIC and C::C::HTML::FormFu, so I made my own. Anyway, kudos! Consider contributing a CX::CRUD::Controller::FormFu then! :) If you based yours off the Rose::CRUD API, you're mostly there. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ 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/
Re: [Catalyst] Push services with catalyst
* On Thu, Mar 06 2008, Moritz Onken wrote: But I still need a lot of code which is run by catalyst, like authentication and of course the whole dbic schema. What about Catalyst::Engine::HTTP::POE? Theoretically this should work. When your application is in the state of doing IO (sending data to the client, holding a socket open), other requests can run. That sounds like it is what you want. There are things that will block POE, though; handling a request of course, as well as things that are technically IO (waiting for your database to return a query). That can be fixed, though. Regards, Jonathan Rockway ___ 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/
Re: [Catalyst] Base controllers and multiple inheritance
I would say don't use Catalyst::Controller::HTML::FormFu in that case - the functionality it provides is rather basic. By the way I am also working on a FormFu based CRUD Catalyst base class (continuation of Catalyst::Example::InstantCRUD). Looks like it has become fashionable thing recently. -- Zbigniew On Wed, Mar 5, 2008 at 8:36 AM, Byron Young [EMAIL PROTECTED] wrote: Hi, I've been using Catalyst for a project and decided to make some base controllers for common functionality. So far I've made two: CRUD, and List, for standard database operations and for sortable, paged listings of data. They work fine on their own but I'm running into trouble with multiple inheritance. If I have a controller for some database table that I want to inherit the actions from both CRUD and List, only the first one inherited will initialize properly. The inheritance looks like this: Catalyst::Controller /\ / \ /\ /Catalyst::Controller::HTML::FormFu / | MyApp::Base::Controller::List | \ | \MyApp::Base::Controller::CRUD \/ \ / \/ MyApp::Controller::SomeDatabaseTable Each of the controller base classes has a new() method which sets up config data and does error checking and whatnot. If I inherit both of my base classes, only new() on the first inherited is called. I've tried calling $class-NEXT::new(@_) in each, and I've also tried Class::C3's $class-maybe::next::method(@_), but new() is still not called down the second inheritance chain. When I tried the Class::C3 approach I called Class::C3::initialize() in MyApp.pm - I wasn't sure where to call it so I tried before and after MyApp-setup() - still no luck. Can somebody tell me why new() isn't called down both paths? Thanks, Byron ___ 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/ -- Zbigniew Lukasiak http://brudnopis.blogspot.com/ ___ 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/
[Catalyst] Patch for Catalyst::View::Mason
Hi Florian, Here is a small patch for Catalyst::View::Mason. When setting $c-stash-{template}, template_extension was not added to the component path. In my opinion this should always be added, so one can easily change the view without having to provide extra logic that sets the template extension according to the current view. 0001-Always-do-concatenation-of-template_extension-to-com.patch Description: Binary data -- Best regards, David Jack Olrik [EMAIL PROTECTED] http://david.olrik.dk GnuPG fingerprint C290 0A4A 0CCC CBA8 2B37 E18D 01D2 F6EF 2E61 9894 [The first rule of Perl club is You do not talk about Perl club] ___ 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/
[Catalyst] sending a variable to more than one tt2 template
Hi, I have a variable in a Controller method sent to the stash for a particular tt file. What if I want that same variable to be available to another tt file? I assume I cannot set two templates in one method. Thanks, Emily ___ 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/
Re: [Catalyst] sending a variable to more than one tt2 template
On Thu, Mar 6, 2008 at 7:36 PM, Emily Heureux [EMAIL PROTECTED] wrote: Hi, I have a variable in a Controller method sent to the stash for a particular tt file. What if I want that same variable to be available to another tt file? I assume I cannot set two templates in one method. yeah you can: my $vars = { foo = 'bar' }; my $output1 = $c-view('TT')-render($c, 'template1.tt', $vars); my $output2 = $c-view('TT')-render($c, 'template2.tt', $vars); -- edenc.vox.com ___ 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/
RE: [Catalyst] sending a variable to more than one tt2 template
You can call another template from within the template you specified in the stash, and pass the stash parameters along. I don't use TT, but I think PROCESS is how you call other templates. HTH Byron From: Emily Heureux [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2008 2:36 PM To: 'The elegant MVC web framework' Subject: [Catalyst] sending a variable to more than one tt2 template Hi, I have a variable in a Controller method sent to the stash for a particular tt file. What if I want that same variable to be available to another tt file? I assume I cannot set two templates in one method. Thanks, Emily ___ 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/