[Catalyst] Model configuration through .yml
Hi, I'd like to know something, probably a basic problem but just to be sure. Is it possible to configure Application db connection into .yml configuration file like : Model::MyAppDB schema_class: Schema::MyApp connect_into: - dbi:Pg:dbname=myapp - user - password - options Actually i tried this way but I cannot connect to the database, neither start my application, perl is not able to locate my schema class...!! Here is the error: Couldn't load class (Schema::MyApp) because: Couldn't instantiate component BiblioList::Model::MyAppDB, Can't locate Schema/MyApp.pm in @INC I can make it working if I add into Model::MyApp this : __PACKAGE__-config( ... ); I first did it, just adding 'schema_class' infos and leaving connect_info into config file and it works like a charm. However, the strange thing is that, other db connection I configured for other databases can connect correctly even if I use another Schema module like Schema::FooBarDB located under the same directory as Schema::MyApp For example in another confg file I load using C::Plugin::ConfigLoader::Multi I can define this Model::RemoteDB::AnotherDB: schema_class: Schema::FooBarDB connect_info: - .. and it connect correctly to my foobardb without throwing errors above. Is this normal behavior from Catalyst or is there something I am doing wrong or just a bug? Thanks for any hint. Regards Emmanuel ___ 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] Model configuration through .yml
Please ignore, I made a mistake (typo) I am really sorry having bothered the list with my previous email. Regards Emmanuel On 1/13/10 3:17 PM, Emmanuel Quevillon wrote: Hi, I'd like to know something, probably a basic problem but just to be sure. Is it possible to configure Application db connection into .yml configuration file like : Model::MyAppDB schema_class: Schema::MyApp connect_into: - dbi:Pg:dbname=myapp - user - password - options Actually i tried this way but I cannot connect to the database, neither start my application, perl is not able to locate my schema class...!! Here is the error: Couldn't load class (Schema::MyApp) because: Couldn't instantiate component BiblioList::Model::MyAppDB, Can't locate Schema/MyApp.pm in @INC I can make it working if I add into Model::MyApp this : __PACKAGE__-config( ... ); I first did it, just adding 'schema_class' infos and leaving connect_info into config file and it works like a charm. However, the strange thing is that, other db connection I configured for other databases can connect correctly even if I use another Schema module like Schema::FooBarDB located under the same directory as Schema::MyApp For example in another confg file I load using C::Plugin::ConfigLoader::Multi I can define this Model::RemoteDB::AnotherDB: schema_class: Schema::FooBarDB connect_info: - .. and it connect correctly to my foobardb without throwing errors above. Is this normal behavior from Catalyst or is there something I am doing wrong or just a bug? Thanks for any hint. Regards Emmanuel ___ 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/
[Catalyst] myapp_fastcgi.pl does not run in background
Hi, First of all, happy new year for all the catalysters and all the best for this new year. I am running Catalyst 5.80016, and when launch my production server, using FastCGI, myapp_fastcgi.pl does not run into background even if I specify option -d or --daemon. Is it a bug or should I use another option? Thanks for any hint. Regards -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] myapp_fastcgi.pl does not run in background
On 01/05/2010 12:51 PM, Андрей П. Ковбович wrote: Hi, try this option: --detach Hi, That solved my problem. But it could be good to change it from the help message which is still : Usage: myapp_fastcgi.pl [options] Options: -? -help display this help and exits ... -d --daemon daemonize (requires -listen) -M --manager specify alternate process manager (FCGI::ProcManager sub-class) or empty string to disable -e --keeperr send error messages to STDOUT, not to the webserver Cheers Emmanuel 2010/1/5 Emmanuel Quevillont...@pasteur.fr: Hi, First of all, happy new year for all the catalysters and all the best for this new year. I am running Catalyst 5.80016, and when launch my production server, using FastCGI, myapp_fastcgi.pl does not run into background even if I specify option -d or --daemon. Is it a bug or should I use another option? Thanks for any hint. Regards -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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/ -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] View::TT render_output disappeared?
Hi list, I'd like to render output of some template inside my catalyst application. I remembered that it did exist a method called 'render_output' that allow edit. However in Catalyst::View::TT this method seems to have disappeared. I can use 'render' from this module but it calls the wrapper I configured in my App::View::TT. Does anyone know how to render a small piece of template with args without calling the wrapper to surround the output? Thanks for any hint. Regards -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] View::TT render_output disappeared?
Tomas Doran wrote: Emmanuel Quevillon wrote: I'd like to render output of some template inside my catalyst application. I remembered that it did exist a method called 'render_output' that allow edit. However in Catalyst::View::TT this method seems to have disappeared. Nope, you're just thinking of the render method I think I can use 'render' from this module but it calls the wrapper I configured in my App::View::TT. Does anyone know how to render a small piece of template with args without calling the wrapper to surround the output? Try something like this? http://dev.catalyst.perl.org/wiki/gettingstarted/howtos/disabling_a_tt_wrapper_for_ajax_requests Cheers t0m Thanks tOm, this is a good url you pointed me to! You're still that responsive and efficient! :) Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Can't redirect using $c-res-redirect()
Tomas Doran wrote: Emmanuel Quevillon wrote: [Fri Nov 6 15:36:13 2009] [error] Caught exception in engine Can't call method as_string on an undefined value at /usr/local/share/perl/5.10.0/Catalyst/Engine.pm line 95. Can you start your server with perl -MDevel::SimpleTrace script/myapp_server.pl -d and attach the full app startup, and the request which breaks (which should now include a full stack trace in its error). Thanks. t0m Hi Tomas, Here is the log generated : [Mon Nov 9 10:08:03 2009] [info] [tuco,localhost,x,x] Logging out [Mon Nov 9 10:08:03 2009] [debug] Deleting session(User logging out) [Mon Nov 9 10:08:03 2009] [debug] Redirecting to http://localhost:3000/login; [Mon Nov 9 10:08:03 2009] [error] Caught exception in engine Can't call method as_string on an undefined value at Catalyst::Engine::finalize_cookies(/usr/local/share/perl/5.10.0/Catalyst/Engine.pm:95) at Catalyst::finalize_cookies(/usr/local/share/perl/5.10.0/Catalyst.pm:1700) at Catalyst::finalize_headers(/usr/local/share/perl/5.10.0/Catalyst.pm:1763) at Catalyst::Plugin::Session::finalize_headers(/usr/local/share/perl/5.10.0/Catalyst/Plugin/Session.pm:99) at Catalyst::finalize(/usr/local/share/perl/5.10.0/Catalyst.pm:1666) at Catalyst::Plugin::FillInForm::finalize(/usr/local/share/perl/5.10.0/Catalyst/Plugin/FillInForm.pm:67) at Catalyst::Plugin::Static::Simple::finalize(/usr/local/share/perl/5.10.0/Catalyst/Plugin/Static/Simple.pm:80) at eval(/usr/local/share/perl/5.10.0/Catalyst.pm:1829) at Catalyst::handle_request(/usr/local/share/perl/5.10.0/Catalyst.pm:1819) at Catalyst::Engine::HTTP::_handler(/usr/local/share/perl/5.10.0/Catalyst/Engine/HTTP.pm:394) at Catalyst::Engine::HTTP::run(/usr/local/share/perl/5.10.0/Catalyst/Engine/HTTP.pm:291) at Catalyst::run(/usr/local/share/perl/5.10.0/Catalyst.pm:2121) at main::__ANON__(script/bibliolist_server.pl:68) at Catalyst::Restarter::Forking::_fork_and_start(/usr/local/share/perl/5.10.0/Catalyst/Restarter/Forking.pm:20) at Catalyst::Restarter::run_and_watch(/usr/local/share/perl/5.10.0/Catalyst/Restarter.pm:68) at main::(script/bibliolist_server.pl:104) Just to add a little more info, when on the blank page after clicking 'Logout' button, if I do a 'reload' in my browser, I am redirected to the login page as expected and this is the following log generated : [Mon Nov 9 10:08:31 2009] [info] *** Request 7 (0.135/s) [5954] [Mon Nov 9 10:08:31 2009] *** [Mon Nov 9 10:08:31 2009] [debug] GET request for logout from 127.0.0.1 [Mon Nov 9 10:08:31 2009] [debug] Path is logout [Mon Nov 9 10:08:31 2009] [debug] Found sessionid fcd469f228156f819cf7d7ab3b8742ceaf444388 in cookie [Mon Nov 9 10:08:31 2009] [debug] Deleting session(session expired) [Mon Nov 9 10:08:31 2009] [debug] Redirecting to http://localhost:3000/login; [Mon Nov 9 10:08:31 2009] [info] Request took 0.028152s (35.521/s) .+---. | Action | Time | ++---+ | /auto | 0.006261s | | /end | 0.000699s | '+---' [Mon Nov 9 10:08:31 2009] [info] *** Request 8 (0.154/s) [5954] [Mon Nov 9 10:08:31 2009] *** [Mon Nov 9 10:08:31 2009] [debug] GET request for login from 127.0.0.1 [Mon Nov 9 10:08:31 2009] [debug] Path is login [Mon Nov 9 10:08:31 2009] [debug] Rendering template login.tt2 [Mon Nov 9 10:08:31 2009] [debug] Created session d3461d4598946c79a5a95e095672819fa6c09bef [Mon Nov 9 10:08:32 2009] [info] Request took 0.058135s (17.201/s) .+---. | Action | Time | ++---+ | /auto | 0.001886s | | /login/index | 0.000486s | | /end | 0.032852s | | - BiblioList::View::TT-process | 0.030826s | '+---' Thanks for your time Regards Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Bug into Catalyst::Devel 1.16 and later?
Hi, I've just upgraded my Catalyst::Devel to 1.17 (was in 1.15). Unfortunately, when I attempted to start my dev server I couldn't and received an error : t...@gin bibliolist$ script/bibliolist_server.pl -r Can't locate object method _fork_and_start via package Catalyst::Restarter at /usr/local/share/perl/5.10.0/Catalyst/Restarter.pm line 62. (in cleanup) Can't locate object method _kill_child via package Catalyst::Restarter at /usr/local/share/perl/5.10.0/Catalyst/Restarter.pm line 103. I've tried to downgrade to 1.16 but the same problem occured. It looks like this problem is not present in Catalyst::Devel 1.15 I've already post a Bug in CPAN RT about this : https://rt.cpan.org/Ticket/Display.html?id=46341 Can a developer has a glance at it? Cheers Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Bug into Catalyst::Devel 1.16 and later?
Rodrigo wrote: Just update your scripts. It's advisable to do it with every Catalyst update, specially with a ::Devel update. # from directory one level above your app: /apps/MyApp $ cd .. /apps $ catalyst.pl -force -scripts MyApp Hi, Ok forgot to do it as I usually get a message in my log to reminding me to upgrade my scripts as mentioned above :) Cheers ___ 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/ -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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 and where to run a method at Catalyst start up?
Emmanuel Quevillon wrote: I'd also recommend you start a new TestApp, and try to make just the smallest subset of an application you can to demonstrate / prototype out the functionality you want. a) This is gonna be easier to debug for you as there are less moving parts b) It's then possible to post your app on github or upload a tarball somewhere, and an interested party could have a play and see if they can see your issue, without conjecture/guessing, and also without having to wade through the rest of your application. Hi Tom, I created a small App with Catalyst that does nothing at all but can reproduce the error encountered with my Application. This git app has been uploaded to github at : http://github.com/tuco/startup/tree/master I hope this will help. Thanks for any clue/advice Regards Emmanuel 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/ -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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 and where to run a method at Catalyst start up?
Tomas Doran wrote: Emmanuel Quevillon wrote: Thanks to try helping me. Here is the Trace from Devel::SimpleTrace. Actually, the error is not even when I try to call my method from my Catalyst::Model but when I start the dev server : Aha, yes - the stack trace makes it fairly clear what's happening! Catalyst is trying to create your Model::Mapping _before_ it creates your other model.. And creating an instance of Model::Mapping relies on the other model having been setup first. Ok understood ! :) I'll do it and post it to the list (github). Ok, and having looked at the code - that isn't the issue that you're having in that test app.. The result classes for your DBIC models were in the wrong place, so DBIC wasn't finding them, ergo the call to -model returning undef.. Well yes, it is because when I created my classes using schema_loader, it created a 'Result' dir under Startup(2) direcotry. But with the application I started earlier (BiblioList), this directory wasn't present. So I decided to remove it :( And the diff is that in BiblioList, It uses load_classes instead of load_namespaces. Why this changes? I don't know, probably an API change from DBIx::Class I used before. Anyway, I read DBIx::Class::Schema doc and now see the diff between the 2 methods. However don't know if one is better than the other one? I have also fiddled with the code to make it not order sensitive, and (I think) more elegant. I looks more PROFESSIONAL anyway ;) ! http://github.com/bobtfish/startup/tree/ea22d1ac4af4a9e9f46dbbfd0c9f9963ede3fa5f Cheers t0m Thanks for your time Tom! Cheers -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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 and where to run a method at Catalyst start up?
Rodrigo wrote: The strange thing is that if I copy the body of BUILD to BiblioList.pm (just after __PACKAGE__-setup()) The function works just fine and I don't get any error. Strange indeed. Just try, as a possible workaround, just get rid of the GenoList level in your Model. That would shorten the model call to something like MyApp-model('bovisR1db::Organism'). See if that works. Hi Rodrigo I tried what you mentioned but it didn't change anything unfortunately. Has someone in the list another idea what's is going wrong? Help will be much appreciated. Regards Emmanuel -rodrigo ___ 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/ -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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 and where to run a method at Catalyst start up?
Tomas Doran wrote: Emmanuel Quevillon wrote: I tried to follow your advices, but unfortunately, I looks like MyApp-model().. does not work : Couldn't instantiate component MyApp::Model::Mapping, Can't locate object method model via package MyApp::Model::Mapping I also tried with $self without success :( You're not doing what Rodrigo suggested, at all. 'model' is a method on Catalyst, therefore you need to call it on an object which ISA Catalyst (i.e. MyApp, or $c). I can't really give you much more help unless you give us your _entire_ model code, and the controller code you're trying to call it. Hi Tom, I can't even instantiate my new Model 'MyApp::Model::Mapping' following Rodrigo's code : package BiblioList::Model::Mapping; use Moose; extends 'Catalyst::Model'; has 'mapping_data' = ( is = 'rw', isa = 'HashRef', default = sub { { } } ); no Moose; sub BUILD { my($self) = shift; my $ROrgs = { }; #Get all the remote supported dbname configured foreach my $db (sort keys %{BiblioList-config()-{remote_supported_dbs}}){ #Create appropriate model my $model = join(::, GenoList, $db, Organism); my $r = BiblioList-model($model)-search()-first(); $ROrgs-{$db} = $r; } my $mapping = { }; #We handle more than one organism, so loop over results my $f = BiblioList-model('BiblioListDB::Organism')-search({isavailable = '1'}); while(my $o = $f-next()){ #print STDERR - ,$o-id_org(), , $o-shortname(), \n; my $oname = $o-fullname(); $oname .= .$o-strain() if($o-strain()); foreach my $db (sort keys %{$ROrgs}){ my $remote = $ROrgs-{$db}; my $rname = $remote-fullname(); $rname .= .$remote-strain() if($remote-strain()); if($rname eq $oname){ $mapping-{$o-id_org} = $db; delete $ROrgs-{$db}; last; } } } $self-mapping_data($mapping); } 1; However, the strange is that I can access my config values through BiblioList-config() whereas I get an error complaining about an undefined value (here BiblioList-model($model)) : Here is the error: Couldn't instantiate component BiblioList::Model::Mapping, Can't call method search on an undefined value at /home/tuco/src/perl/projects/Catalyst/BiblioList/dev/bibliolist-0.08/script/../lib/BiblioList/Model/Mapping.pm line 28. at script/bibliolist_server.pl line 66 Compilation failed in require at script/bibliolist_server.pl line 66. If I use $self instead of BiblioList the error change: Couldn't instantiate component BiblioList::Model::Mapping, Can't locate object method model via package BiblioList::Model::Mapping at /home/tuco/src/perl/projects/Catalyst/BiblioList/dev/bibliolist-0.08/script/../lib/BiblioList/Model/Mapping.pm line 28. at script/bibliolist_server.pl line 66 Compilation failed in require at script/bibliolist_server.pl line 66. Any clue? Cheers Cheers t0m -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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 and where to run a method at Catalyst start up?
/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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 and where to run a method at Catalyst start up?
Hi all, I am developing a Catalyst App and I'd like to know how to launch a method at Catalyst start up? The idea is to check and create some kind of a data structure that will be loaded into memory (__PACKAGE__-{mydata} = { ... }) of my application and will be then accessible at anytime from anywhere in any controller as sub foo: Local { my($self, $c) = @_; my $personnal_data = $self-_get_mydata(); ... } sub get_mydata will reside into MyApp.pm But how can I access my database within MyApp.pm ? I tried (in MyApp.pm): sub _test { my $self = shift; @rs = $self-comp('MyApp::DB::Table')-search({ id = { '' = 2 } }); #If I print each values of @rs #it prints something like 'MyApp::DB::Table=HASH() #But from each item of my array, if I tried any call to #column sub (like $_-id()) I get 'Unkown error' #Also it looks like $_ is a 'DBIx::Class' only } Has somebody any clue how could I solve my problem Thanks in advance Regards -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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 and where to run a method at Catalyst start up?
Rodrigo wrote: Hi Rodrigo, Thanks for your reply. In MyApp.pm: # Start the application __PACKAGE__-setup(); mymethod(); sub mymethod { ... } But that's probably not what you're looking for... Well, that's what I was thinking of actually. However, your following code looks interesting :) The idea is to check and create some kind of a data structure that will be loaded into memory (__PACKAGE__-{mydata} = { ... }) of my application and will be then accessible at anytime from anywhere in any controller Create a model for it. $ script/myapp_create.pl model MyData Then create the data structure in Model/MyData.pm: package MyApp::Model::MyData; use Moose; extends 'Catalyst::Model'; has 'mydata' = ( is='rw', isa='HashRef', default=sub{{}} ); no Moose; sub BUILD { my $self=shift; my $data = MyApp-model('DB::Table')-search(...)-first; # I rather avoid storing dbic resultsets in memory for a long time. $self-mydata({ foo= $data } ); } } I tried to follow your advices, but unfortunately, I looks like MyApp-model().. does not work : Couldn't instantiate component MyApp::Model::Mapping, Can't locate object method model via package MyApp::Model::Mapping I also tried with $self without success :( Cheers Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Using JSON
Octavian Râşniţă wrote: Hi, What's the recommended module for getting a JSON request and creating a JSON response in a Catalyst app? (I want to use them with JQuery.) Thanks. Octavian ___ 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/ Hi Octavian, For my part, I use Catalyst::Controller::REST and jQuery. I don't even use Catalyst::View::JSON to send Json data, as everything (for what I need) is done by Controller::REST. I force REST to use json from my config file like : Controller::REST: stash_key: rest default: 'application/json' Right now I only use REST to delete some entry in my db. For that I created a Javascript function (using jQuery) that use type 'DELETE' as method. Here is an example of my tt2 file : a href=# onclick=remove('[% rest %]');return false;Remove/a Here the JS function called: function remove(url){ jQuery.ajax( { type: DELETE, dataType: json, url: url, success: function(data) { ... } And I implemented the corresponding method to delete/update/create/insert in my Controller::REST It works like a charm for me. Hope this will help Regards -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Authentication methods question
Hi there, I just wondered, if it would be possible, via a login page and Catalyst::Authentication to configure more than one way to identify a user? My idea would be to let the user authenticate through its OpenID account, if (s)he has one, or then, by default using an user account stored in a database. If someone has already done it, clue welcome. Thanks in advance -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Authentication methods question
J. Shirley wrote: On Wed, Apr 15, 2009 at 7:40 PM, Iain iainhubb...@googlemail.com mailto:iainhubb...@googlemail.com wrote: On Wed, 2009-04-15 at 12:35 +0200, Emmanuel Quevillon wrote: Hi there, I just wondered, if it would be possible, via a login page and Catalyst::Authentication to configure more than one way to identify a user? My idea would be to let the user authenticate through its OpenID account, if (s)he has one, or then, by default using an user account stored in a database. If someone has already done it, clue welcome. Thanks in advance Haven't used it myself but Catalyst::Authentication::Realm::Progressive - http://bit.ly/3beuPm sounds like it will do the trick. Iain. As the person to blame for that realm, yes, that is what it is for. It is exactly for that purpose, and I wrote up an advent article with the specific idea of linking OpenID to a traditional account. You can view it at http://www.catalystframework.org/calendar/2008/19 Good luck. -J ___ 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/ Thanks guys! :) -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] DELETE through REST and Jemplate
J. Shirley wrote: On Mon, Mar 30, 2009 at 10:31 AM, Emmanuel Quevillon t...@pasteur.fr mailto:t...@pasteur.fr wrote: J. Shirley wrote: On Mon, Mar 30, 2009 at 7:39 AM, Emmanuel Quevillon t...@pasteur.fr mailto:t...@pasteur.fr mailto:t...@pasteur.fr mailto:t...@pasteur.fr wrote: J. Shirley wrote: On Mon, Mar 30, 2009 at 7:24 AM, Emmanuel Quevillon t...@pasteur.fr mailto:t...@pasteur.fr mailto:t...@pasteur.fr mailto:t...@pasteur.fr mailto:t...@pasteur.fr mailto:t...@pasteur.fr mailto:t...@pasteur.fr mailto:t...@pasteur.fr wrote: Hi, I am playing with REST and Jemplate from the great Tuts from JRock's book. However, I am facing a problem. I understand well how to retrieve data from a REST url and playing Ajax with it, by a GET method. However, I don't know how to change the method to DELETE from a simple link like: test.js contains: function remove_item(id){ Jemplate.process('test.tt2', '[% Catalyst.uri_for(/rest/item/) %]'+id, '#_item'); } template test.tt2: a href=# onclick=remove_item('[% item.id http://item.id http://item.id http://item.id %]'); return false;Remove item/a If I code my template like this, it just do a GET request. How can I introduce DELETE method to tell REST API to delete my item id? Sorry if my question seems stupid, I am a bit lost. If anybody has any clue, very welcome. Regards -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - You didn't include your remove_item method. Can you post that? -J It is very basic, it took code from Jrock's book :) sub item_DELETE { my($self, $c) = @_; my $id = $c-stash()-{id}; my $set = $c-model('MyAppDB::Item')-find({id = $id}); if($set){ $self-status_ok($c, entity = mk_entity($set)); $set-delete(); } else{ $self-status_not_found($c, message = Item not found); } } -- I meant the javascript method, not the Catalyst method. There should be a function remove_item() somewhere, as it doesn't seem part of Jemplate. Also, you probably want to use jQuery or something more robust for your asynchronous calls. Jemplate docs don't even seem to have a delete method. -J Ooops sorry, but it is already in the first email, mentionned as 'in test.js': function remove_item(id){ Jemplate.process('test.tt2', '[% Catalyst.uri_for(/rest/item/) %]'+id, '#_item'); } Thanks for this help Emmanuel Oh, I missed it because it just is a Jemplate.process line... didn't even see the remove_item. That's a GET request, since it just fetches something remotely from the server and does nothing else. You need to change the method to DELETE, and then handle the response. You'll have to read the pod on Jemplate and jQuery and figure out exactly how to change the request method to DELETE, and then process the response. The Jemplate pod has a bit that shows how to use jQuery directly to get the response (using getJSON) -- you should just have to modify that bit accordingly. As part of the jquery docs on the ajax object, it seems just setting type to DELETE should do the trick. You can read more here: http://docs.jquery.com/Ajax/jQuery.ajax#options -J Hi J, Thanks pointing me to this doc. It seems very useful and adequate for what I want to do. Thanks for your help. Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ List: Catalyst@lists.scsys.co.uk Listinfo: http
[Catalyst] DELETE through REST and Jemplate
Hi, I am playing with REST and Jemplate from the great Tuts from JRock's book. However, I am facing a problem. I understand well how to retrieve data from a REST url and playing Ajax with it, by a GET method. However, I don't know how to change the method to DELETE from a simple link like: test.js contains: function remove_item(id){ Jemplate.process('test.tt2', '[% Catalyst.uri_for(/rest/item/) %]'+id, '#_item'); } template test.tt2: a href=# onclick=remove_item('[% item.id %]'); return false;Remove item/a If I code my template like this, it just do a GET request. How can I introduce DELETE method to tell REST API to delete my item id? Sorry if my question seems stupid, I am a bit lost. If anybody has any clue, very welcome. Regards -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] DELETE through REST and Jemplate
J. Shirley wrote: On Mon, Mar 30, 2009 at 7:24 AM, Emmanuel Quevillon t...@pasteur.fr mailto:t...@pasteur.fr wrote: Hi, I am playing with REST and Jemplate from the great Tuts from JRock's book. However, I am facing a problem. I understand well how to retrieve data from a REST url and playing Ajax with it, by a GET method. However, I don't know how to change the method to DELETE from a simple link like: test.js contains: function remove_item(id){ Jemplate.process('test.tt2', '[% Catalyst.uri_for(/rest/item/) %]'+id, '#_item'); } template test.tt2: a href=# onclick=remove_item('[% item.id http://item.id %]'); return false;Remove item/a If I code my template like this, it just do a GET request. How can I introduce DELETE method to tell REST API to delete my item id? Sorry if my question seems stupid, I am a bit lost. If anybody has any clue, very welcome. Regards -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - You didn't include your remove_item method. Can you post that? -J It is very basic, it took code from Jrock's book :) sub item_DELETE { my($self, $c) = @_; my $id = $c-stash()-{id}; my $set = $c-model('MyAppDB::Item')-find({id = $id}); if($set){ $self-status_ok($c, entity = mk_entity($set)); $set-delete(); } else{ $self-status_not_found($c, message = Item not found); } } -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] DELETE through REST and Jemplate
J. Shirley wrote: On Mon, Mar 30, 2009 at 7:39 AM, Emmanuel Quevillon t...@pasteur.fr mailto:t...@pasteur.fr wrote: J. Shirley wrote: On Mon, Mar 30, 2009 at 7:24 AM, Emmanuel Quevillon t...@pasteur.fr mailto:t...@pasteur.fr mailto:t...@pasteur.fr mailto:t...@pasteur.fr wrote: Hi, I am playing with REST and Jemplate from the great Tuts from JRock's book. However, I am facing a problem. I understand well how to retrieve data from a REST url and playing Ajax with it, by a GET method. However, I don't know how to change the method to DELETE from a simple link like: test.js contains: function remove_item(id){ Jemplate.process('test.tt2', '[% Catalyst.uri_for(/rest/item/) %]'+id, '#_item'); } template test.tt2: a href=# onclick=remove_item('[% item.id http://item.id http://item.id %]'); return false;Remove item/a If I code my template like this, it just do a GET request. How can I introduce DELETE method to tell REST API to delete my item id? Sorry if my question seems stupid, I am a bit lost. If anybody has any clue, very welcome. Regards -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - You didn't include your remove_item method. Can you post that? -J It is very basic, it took code from Jrock's book :) sub item_DELETE { my($self, $c) = @_; my $id = $c-stash()-{id}; my $set = $c-model('MyAppDB::Item')-find({id = $id}); if($set){ $self-status_ok($c, entity = mk_entity($set)); $set-delete(); } else{ $self-status_not_found($c, message = Item not found); } } -- I meant the javascript method, not the Catalyst method. There should be a function remove_item() somewhere, as it doesn't seem part of Jemplate. Also, you probably want to use jQuery or something more robust for your asynchronous calls. Jemplate docs don't even seem to have a delete method. -J Ooops sorry, but it is already in the first email, mentionned as 'in test.js': function remove_item(id){ Jemplate.process('test.tt2', '[% Catalyst.uri_for(/rest/item/) %]'+id, '#_item'); } Thanks for this help Emmanuel ___ 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] Problem creating accessors once per server instance
Hi list, I am trying to create accessors to load static data once per server instance as described at : http://search.cpan.org/~hkclark/Catalyst-Manual-5.7017/lib/Catalyst/Manual/Cookbook.pod#Create_accessors_to_preload_static_data_once_per_server_instance Following this tuts, I modified my Schema class as follow in MyApp/lib package GenoList; use strict; use warnings; use base 'DBIx::Class::Schema'; __PACKAGE__-load_classes; __PACKAGE__-register_class('Organism', 'GenoList::Organism'); __PACKAGE__-mk_group_accessors('simple' = 'org_infos'); sub connection { my($self, @rest) = @_; $self-next::method(@rest); my $rs = $self-resultset('Organism') -search(undef, { 'columns' = [qw/id name shortname fullname strain/]}); $self-org_infos({ id = $rs-id(), name = $rs-fullname(), shname = $rs-shortname(), strain = $rs-strain || undef, #dbname = $rs-dbname, }); } The first problem I have, sorry not to understand all the terms, is to distinguish what is a RESULTSOURCEMONIKER. While I start the catalyst server, I get the following error: Couldn't instantiate component BiblioList::Model::GenoList::bovisR1db, Can't locate object method id via package DBIx::Class::ResultSet at /home/tuco/src/perl/projects/Catalyst/BiblioList/bibliolist-0.06_02/script/../lib/GenoList.pm line 23. at script/bibliolist_server.pl line 55 Can someone tell me what I am doing wrong? Thanks for any help Regards Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Catalyst::Plugin::Captcha
Hi list, I am trying to use C::P::Captcha. It woks like a charm generating the captcha. However, the text generated in the png/jpeg captcha image is so tiny that I can't even decode it as a human being. I checked the doc and also the one from GD::SecurityImage from where the plugin is derived from but I've been unable to find an option to control the text size inside the image. Has anybody a hint or clue? Thanks in advance Manu -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Catalyst::Plugin::Captcha
Octavian Râsnita wrote: From: Emmanuel Quevillon t...@pasteur.fr Better use Catalyst::Controller::HTML::FormFu. You can easy add reCAPTCHA with it. reCAPTCHA also creates an audio file so more human beeings would be able to pass it. Sure, but reCAPTCHA needs that you regsiter to get an api key from their web site. I wanted to use C::P::Captcha because it does not require that kind of thing. -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Re: How to print/display some data in an end action
Aristotle Pagaltzis wrote: Hi Emmanuel, * Emmanuel Quevillon [EMAIL PROTECTED] [2008-04-30 16:30]: Maybe I can clarify the situation. OK; but all of that was already reasonably obvious. The issue is, you are doing something to forward to ::View::TT automatically at the end of a request. Catalyst does not do that by itself. So the problem would have to be fixed there. First question: what does the `end` action in your Root controller do? Do you have any other `end`s? If so, what do those do? Regards, Hi Aristotle, My Root::end action is simply : sub end : ActionClass(RenderView) { } And I don't have any other end action in other controllers. Regards Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Re: How to print/display some data in an end action
Aristotle Pagaltzis wrote: * Andreas Marienborg [EMAIL PROTECTED] [2008-05-01 10:50]: No point in forwarding to end, since that is done automaticly. In which case it would run twice, actually. But maybe he has a more specific `end` action and so forwarding to ::C::Root::end is actually a useful thing to do in his app. As I said, we have seen too little of the code to make any meaningful suggestions. Regards, Hi Aristotle, You're right, Root/end action is called twice : | /auto | 0.002877s | | /admin/auto | 0.001081s | | /admin/display | 0.136538s | | - MycoBiblio::View::TT-process | 0.098517s | | /end| 0.000431s | ... ... | /auto | 0.002108s | | /admin/auto | 0.000884s | | /admin/rg | 0.053757s | | /end| 0.000521s | We see that in the first call list, the template is well called and process correctly as asked in the 'display' code action method. Then the first 'end' call. Then as in the 'execute' method from C::A::RenderView, it is forwarded to the appropriate view, so in 'display' to 'C::V::TT'. Then, in the second 'end' call, nothing is forwarded to any view as it is asked in C::A::RenderView 'execute' action. So this is the behavior I wanted :) even if 'end' is called twice. From C::A::RenderView - sub execute { my $self = shift; my ($controller, $c ) = @_; $self-NEXT::execute( @_ ); ... ... return 1 if $c-req-method eq 'HEAD'; return 1 if defined $c-response-body length( $c-response-body ); return 1 if scalar @{ $c-error } !$c-stash-{template}; return 1 if $c-response-status =~ /^(?:204|3\d\d)$/; my $view = $c-view() || die Catalyst::Action::RenderView could not find a view to forward to.\n; $c-forward( $view ); }; -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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 to print/display some data in an end action
Mitch Jackson wrote: Emmanuel, Your object is going to request the svg file from your display method, just like a web browser would. When catalyst delivers the file, it needs to look like an SVG to the browser. Some browsers look for different things. http://www.getsvg.com/implementation_issues/content_type_image_svg_xml Looks like you need to end the URL with .svg, and also set the content type. You may need to add a dummy parameter at the end of your url, that you throw away and ignore, so the url looks like a .svg. for example... http:///display/1/something.svg. Setting the filename, as I recommended, may or may not replace the need for this... however, it will make it so if you hit the URL in the web browser that it behaves properly. You also need to set the content type to image/svg+xml sub end : Private { my($self, $c) = @_; my $g = $c-req-args()-[0]; $c-res-content_type( image/svg+xml ); $c-res-body( $g ); } Good luck, /Mitch Hi Mitch, You were right! Thanks a lot. Adding the '.svg' in the end of my url : http://.../rg/1.svg displays correctly the image inside the template! So I'd like to thank all people who have tried to help me with this problem, thinking it is a Catalyst problem. It looks like it is more a browser issue. Cheers Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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 to print/display some data in an end action
Hi, I'd like to incorporate an action into an object tag that only prints some data (XML SVG). I have an action in a controller Foo that do this : sub display : Local : Args(1) { my $t = $object-display_graph(); $c-detach('Foo', 'end', [$t]); } sub end : Private { my($self, $c) = @_; my $g = $c-req-args()-[0]; print $g; } then in a template : object data=http:///display/1;/object However, my output remains empty in my template. If I directly call the 'display' action from my browser as : http://.../display/1, it works ok although I get some extra code from Catalyst : 1HTTP/1.0 200 OK Connection: close Date: Wed, 30 Apr 2008 09:47:49 GMT Status: 200 X-Catalyst: 5.7012 and so an xml error parsing reported. So my questions are: 1: Do I do this the best way? 2: If so, how to avoid to print this extra code from catalyst? Thanks in advance -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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 to print/display some data in an end action
Andreas Marienborg wrote: On Apr 30, 2008, at 11:51 AM, Emmanuel Quevillon wrote: Hi, I'd like to incorporate an action into an object tag that only prints some data (XML SVG). I have an action in a controller Foo that do this : sub display : Local : Args(1) { my $t = $object-display_graph(); $c-detach('Foo', 'end', [$t]); } sub end : Private { my($self, $c) = @_; my $g = $c-req-args()-[0]; print $g; } Never use print. use $c-res-write[2], or set $c-res-body[1]. - andreas [1]: http://cpansearch.perl.org/~mramberg/Catalyst-Runtime-5.7012/lib/Catalyst/Response.pm#$res-%3Ebody(%3C$text|$fh|$iofh_object) [2]: http://cpansearch.perl.org/~mramberg/Catalyst-Runtime-5.7012/lib/Catalyst/Response.pm#$res-%3Ewrite(_$data_) Hi Andreas, Thanks for your reply. I tried your solutions without success. Catalyst always try to wrap the action result 'display' into a template. However I don't want it, I just want an action that throw data when called. I get an error from Catalyst saying it cannot find the template 'display.tt2'. Cheers Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Re: How to print/display some data in an end action
Aristotle Pagaltzis wrote: * Emmanuel Quevillon [EMAIL PROTECTED] [2008-04-30 15:05]: Catalyst always try to wrap the action result 'display' into a template. No, it doesn’t. If that happens in your app, then you have set it up to happen like that. But the code you pasted does not include that portion, so no one will be able tell you what to do instead. Regards, Thanks Aristotle, Maybe I can clarify the situation. In controller Foo I have 2 methods: sub bar : LocalRegex ('^(\d+)$') { my($self, $c) = @_; my $id = $c-req-captures-[0]; $c-detach(qw/Root _softwareError/, [An id is required to get related genes.]) unless $id; $c-stash()-{url} = $c-uri_for(/admin/rg/$id); $c-stash()-{template} = 'admin/relatedgenes.tt2'; $c-detach('View::TT'); } sub rg : Local : Args(1) { my($self, $c) = @_; my $id = $c-req-args-[0]; $c-detach(qw/Root _softwareError/, [An id is required to get related genes.]) unless $id; my $gr = GeneRelations-new( %{$c-config()-{dbinfos}}, org = $c-session()-{org}-{id_org}, ); my $t = $gr-display_graph(type = 'id_gene', value = $id); $c-res-write($t); $c-forward('Root', 'end'); } Template 'admin/relatedgenes.tt2' contains an object tag as : object data=[% url %] width=100% height=100%/object with [% url %] value coming from 'Foo::bar' here: object data=http:///rg/id/object I know that object tag can contain an url to be call on load, and that's what I want to do with My app to avoid storing svg files. If I put url for a svg image it works fine. But I don't want to store temp files. I hope the situation will be clearer like this and someone will be able to give clues or solutions. Thanks in advance Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] CatalystSites.org
Stephen Sykes wrote: Hello Friends, For the past few days I have been putting together a site for listings of websites driven by the Catalyst MVC framework. The site idea was born out of a discussion on the list here a few weeks ago regarding a lack of any definitive list of sites based on the Catalyst MVC framework. Well, today I would like to announce the site launch. I hope everyone finds the site to their liking and can find the time to register and post their Catalyst driven websites. Note: I am also planning to release the source code for the site via subversion/trac as soon as I get a couple more admin features finished. So if anyone is interested in helping with the site code we can do this under version control, a sort of community driven project if you will. URL: http://www.catalystsites.org Kind Regards, Stephen Sykes ___ 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/ Hi Stephen, Nice website you put on line! I just wondered how did you do to know that such websites where running under Catalyst? There is no tag(s) like 'Catalyst powered' in the footer of the page. BTW, wouldn't it be nice to have an image/icon like other platforms have saying 'Catalyst powered', as we can see for PHP, mySQL, Hibernate, Apache, Just a though, maybe a good point to make catalyst known for more and more people? Regards Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] uri_for problem
Hi, I am trying to build some url from TT using uri_for sub but I encounter some problem with it. When in my tt I have : [%- ourl = Catalyst.uri_for('/search?stype=seqidquery=') -%] when I click on it, I get an url that looks like : search%5C%3Fstype=seqidquery= Is there a way to get the proper url produce in the HTML page without '%5C%3F' ? I tried quoting and double quoting the url and escaping the question mark but without success. Thanks a lot. -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] uri_for problem
Moritz Onken wrote: [%- ourl = Catalyst.uri_for('/search') _ ?stype=seqidquery= -%] ? Am 05.03.2008 um 10:50 schrieb Emmanuel Quevillon: Thanks! That did the work. - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ 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] Create and store new cookie
Hi list, I would like to be able to create and store new cookie(s) for user display options for my application. I am currently using C::P::Session::Store::Cooke to store the user session but I would like to add a new cookie. I am trying by setting in one of my Controller sub a cookie like that: $c-res-cookies-{my_options} = { foo = 1, bar = 2 }; $c-res-redirect($c-uri_for('some_url')); If I dump $c-res I can see the cookie freshly created. However if I come back to the options page later, I don't have this cookie anymore. I check with this : unless($c-req-cookie($c-config-{my_cookie_name})){ $c-log()-info(New cookie to create...); } Then I can see this message each time I go the options page. Also, I can see that my session cookie 'myapp_session' is well stored but as a CGI::Simple::Cookie object, not a hash reference as mentioned in the response 'cookie' doc (http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7011/lib/Catalyst/Response.pm#$res-%3Ecookies) Does anyone has a clue about this? Does the redirect causes the reset of the cookies? Thanks a lot Regards Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ List: Catalyst@lists.scsys.co.uk 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/