Re: [Catalyst] TT via AJAX
Hi Roland, you shouldn't need to forward to a JSON view. Calling the status_ok method should set up the response and return the serialized data. Is there anything showing in the error logs? What client are you using to test? there isn't really a space between sub ajaxaction _GET { in your source is there? J On Fri, Apr 27, 2012 at 9:54 PM, Roland Philibert rphilib...@aptina.comwrote: Hi Jason, ** ** My ajax action are already set as you say. I still need to forward to a JSON view, which was in my “end” action. If I dont forward it, I don’t get anything back at the client..but if I do then back to square one.. ** ** ** ** *From:* Jason Galea [mailto:li...@eightdegrees.com.au] *Sent:* 27 April 2012 02:52 *To:* The elegant MVC web framework *Subject:* Re: [Catalyst] TT via AJAX ** ** ** ** On Fri, Apr 27, 2012 at 12:03 AM, Roland Philibert rphilib...@aptina.com wrote: If I remove the end action and wite $body in the log, I do get what I want (ie rendered html from my TT with its “result” variable). …so your conclusion about not serializing the @content seems to be on the right track. …is this liked to what Will has suggested to get around this issue? What do you suggest I do next? ** ** well, now a GET request to your ajaxaction action (with content-type application/json) should return the request body containing a json array with the first (and only) element being your html. Thanks R. *From:* Jason Galea [mailto:li...@eightdegrees.com.au] *Sent:* 26 April 2012 14:32 *To:* The elegant MVC web framework *Subject:* Re: [Catalyst] TT via AJAX Hi Roland, On Wed, Apr 25, 2012 at 11:26 PM, Roland Philibert rphilib...@aptina.com wrote: Hello all, I’d like to render some HTML content being formatted from a TT view via AJAX. Can anybody recommend a way to do that please? The method I am using now for AJAX is REST controller and JSON View. ... sub ajaxaction :Local :ActionClass('REST') {} sub ajaxaction _GET { my ($self, $c) = @_; my $rs = $c-model(DN)-resultset(Table)-find(...); my $body = $c-view(MYTT)-render($c,'dir/temp.mailtt',$c-stash( result = [ $rs ] )); ß this is the weird bit I guess. my @content =(); push @content, $body; $self-status_ok( $c, entity = \@content, ); } sub end :Private { my ($self, $c) = @_; $c-forward(View::JSON); } ..but doing this I get the error: Caught exception in MyApp::View::JSON-process encountered object 'MyApp::Model::DB::Table=HASH(0xdb2c330)', but neither allow_blessed nor convert_blessed settings are enabled at (eval 1606) line 151. have you tried this without the 'end' action? What is MyApp::View::JSON trying to serialize? or what module are you subclassing? Looks to me like $body should be what you think it is (have you confirmed that?) but I don't think MyApp::View::JSON is serializing your content array, but instead is attempting to serialize the result in your stash.* *** cheers, J Thanks for your help. Roland Aptina (UK) Limited, Century Court, Millennium Way, Bracknell, Berkshire, RG12 2XT. Registered in England No. 06570543. This e-mail and any attachments contain confidential information and are solely for the review and use of the intended recipient. If you have received this e-mail in error, please notify the sender and destroy this e-mail and any copies. ___ 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/ Aptina (UK) Limited, Century Court, Millennium Way, Bracknell, Berkshire, RG12 2XT. Registered in England No. 06570543. ** ** This e-mail and any attachments contain confidential information and are solely for the review and use of the intended recipient. If you have received this e-mail in error, please notify the sender and destroy this e-mail and any copies. ** ** ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail
Re: [Catalyst] TT via AJAX
Hi Roland, On Wed, Apr 25, 2012 at 11:26 PM, Roland Philibert rphilib...@aptina.comwrote: Hello all, I’d like to render some HTML content being formatted from a TT view via AJAX. Can anybody recommend a way to do that please? ** ** The method I am using now for AJAX is REST controller and JSON View. ** ** ... sub ajaxaction :Local :ActionClass('REST') {} ** ** sub ajaxaction _GET { ** ** my ($self, $c) = @_; my $rs = $c-model(DN)-resultset(Table)-find(...); my $body = $c-view(MYTT)-render($c,'dir/temp.mailtt',$c-stash( result = [ $rs ] )); ß this is the weird bit I guess. my @content =(); push @content, $body; $self-status_ok( $c, entity = \@content, ); } sub end :Private { my ($self, $c) = @_; $c-forward(View::JSON); } ** ** ..but doing this I get the error: ** ** Caught exception in MyApp::View::JSON-process encountered object 'MyApp::Model::DB::Table=HASH(0xdb2c330)', but neither allow_blessed nor convert_blessed settings are enabled at (eval 1606) line 151. have you tried this without the 'end' action? What is MyApp::View::JSON trying to serialize? or what module are you subclassing? Looks to me like $body should be what you think it is (have you confirmed that?) but I don't think MyApp::View::JSON is serializing your content array, but instead is attempting to serialize the result in your stash. cheers, J ** ** Thanks for your help. Roland ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** Aptina (UK) Limited, Century Court, Millennium Way, Bracknell, Berkshire, RG12 2XT. Registered in England No. 06570543. This e-mail and any attachments contain confidential information and are solely for the review and use of the intended recipient. If you have received this e-mail in error, please notify the sender and destroy this e-mail and any copies. ___ 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] TT via AJAX
On Fri, Apr 27, 2012 at 12:03 AM, Roland Philibert rphilib...@aptina.comwrote: If I remove the end action and wite $body in the log, I do get what I want (ie rendered html from my TT with its “result” variable). …so your conclusion about not serializing the @content seems to be on the right track. …is this liked to what Will has suggested to get around this issue? What do you suggest I do next? well, now a GET request to your ajaxaction action (with content-type application/json) should return the request body containing a json array with the first (and only) element being your html. ** ** Thanks R. ** ** *From:* Jason Galea [mailto:li...@eightdegrees.com.au] *Sent:* 26 April 2012 14:32 *To:* The elegant MVC web framework *Subject:* Re: [Catalyst] TT via AJAX ** ** ** ** Hi Roland, ** ** On Wed, Apr 25, 2012 at 11:26 PM, Roland Philibert rphilib...@aptina.com wrote: Hello all, I’d like to render some HTML content being formatted from a TT view via AJAX. Can anybody recommend a way to do that please? The method I am using now for AJAX is REST controller and JSON View. ... sub ajaxaction :Local :ActionClass('REST') {} sub ajaxaction _GET { my ($self, $c) = @_; my $rs = $c-model(DN)-resultset(Table)-find(...); my $body = $c-view(MYTT)-render($c,'dir/temp.mailtt',$c-stash( result = [ $rs ] )); ß this is the weird bit I guess. my @content =(); push @content, $body; $self-status_ok( $c, entity = \@content, ); } sub end :Private { my ($self, $c) = @_; $c-forward(View::JSON); } ..but doing this I get the error: Caught exception in MyApp::View::JSON-process encountered object 'MyApp::Model::DB::Table=HASH(0xdb2c330)', but neither allow_blessed nor convert_blessed settings are enabled at (eval 1606) line 151. ** ** have you tried this without the 'end' action? ** ** What is MyApp::View::JSON trying to serialize? or what module are you subclassing? ** ** Looks to me like $body should be what you think it is (have you confirmed that?) but I don't think MyApp::View::JSON is serializing your content array, but instead is attempting to serialize the result in your stash.* *** ** ** cheers, ** ** J Thanks for your help. Roland Aptina (UK) Limited, Century Court, Millennium Way, Bracknell, Berkshire, RG12 2XT. Registered in England No. 06570543. ** ** This e-mail and any attachments contain confidential information and are solely for the review and use of the intended recipient. If you have received this e-mail in error, please notify the sender and destroy this e-mail and any copies. ** ** ___ 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/ ** ** Aptina (UK) Limited, Century Court, Millennium Way, Bracknell, Berkshire, RG12 2XT. Registered in England No. 06570543. This e-mail and any attachments contain confidential information and are solely for the review and use of the intended recipient. If you have received this e-mail in error, please notify the sender and destroy this e-mail and any copies. ___ 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] Catalyst::ActionRole::RequireSSL under development server
On Tue, Apr 17, 2012 at 4:11 AM, Rippl, Steve rip...@woodlandschools.orgwrote: We're just upgrading to Catalyst 5.9 from 5.8, and therefore switching from the old Catalyst::Plugin::RequireSSL to Catalyst::ActionRole::RequireSSL. The old module would detect when is was running under the standalone server and so was fine under development. I could be wrong, but I think you'll find both of those modules are testing for Catalyst::Engine::HTTP which is not applicable since the move to PSGI. (Possibly depending on how you're running things). Catalyst::ActionRole::RequireSSL doesn't seem to play nicely under the development server when hitting an action requiring SSL. Am I doing something wrong? Are there some settings in the config somewhere to disable that under debug or something? I want to avoid having different versions of the Controllers themselves between dev and production. Thanks, Steve -- Steve Rippl Technology Director Woodland Public Schools 360 841 2730 ___ 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] Using Test::WWW::Mechanize::Catalyst on a test database
On Thu, Feb 16, 2012 at 1:25 AM, Robert Rothenberg rob...@gmail.com wrote: I would like to use Test::WWW::Mechanize::Catalyst with an alternative database schema (since I want to test reading and writing on a database with the same schema but known data that is not the live database), but it's not clear to me from reading the documentation on how to do this, or even if it's possible. I've found examples using Catalyst::Test with DBICx::TestDatabase, but I cannot get it to work. The line $c-model('DBIC')-schema($schema); fails with Can't call method schema on an undefined value... use Test::DBIx::Class; My::App-model('DB')-schema(Schema); works for me so.. Your::App-model('DBIC')-schema($schema); should work for you.. Worse, the application uses some PostgreSQL extensions, so DBICx::TestDatabase is not appropriate. I am looking into Test::DBIx::Class as an alternative, but again, it's still not clear how to change the database that Test::WWW::Mechanize uses. Regards, Rob ___ 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] nginx/FastCGI configuration issues
On Thu, Feb 16, 2012 at 3:02 AM, Jesse Sheidlower jes...@panix.com wrote: location /incomings { include fastcgi_params; fastcgi_param SCRIPT_NAME /incomings/; fastcgi_param PATH_INFO $fastcgi_script_name; fastcgi_pass unix:/tmp/incomings.socket; } in those docs they say if your application is rooted at /myapp.. do they mean with this..? http://wiki.nginx.org/HttpCoreModule#root location /incomings/static { alias /usr/local/www/modules/Incomings/root/static; } I tried to follow the docs (at C::M::Deployment::nginx::FastCGI) exactly, and if I'm doing something wrong, I'm not clear what it is. I'd be very grateful for any suggestions for how to solve this, as this is the one thing preventing the server from going live! Thanks. Jesse Sheidlower ___ 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] Re: Using model layers between Catalyst and DBIC
On Tue, Feb 7, 2012 at 1:26 PM, Bill Moseley mose...@hank.org wrote: My idea was that Catalyst would call a method in the new model layer and possibly get a DBIC object back. There is concern from some at my meeting that we don't want to give the Catalyst app developer a raw DBIC object and that we should wrap it (as it appears you are doing, Jason) in yet another object. That is, we want to allow $user-first_name, but not $user-search_related or $user-delete. That requires writing new wrapper classes for every possible result -- not just mirroring DBIC's result classes but possibly many more because the new model might have multiple calls (with different access levels) for fetching user data. That is, $user-email might work for some model methods that return a user but not methods called on the model. Frankly, to me this seems like a lot of code and work and complexity just to prevent another developer from doing something stupid -- which we cannot prevent anyway. And smart programmers can get at whatever they want, regardless. Seems more risky to make the code more complex and thus harder to understand. The cost/benefit ratio just doesn't seem that great. Am I missing something? nope.. the complexity involved continues to reveal itself to me.. - account for the fact that sometimes a DBIC relation gives us our instance object and sometimes a dbic result object. (to do with how it got there) my ($self) = @_; 2727** my $user = $self-_record-user; 2828** my $user_class = $self-user_instance_class; 29 ** -return $user ? 30 ** -$user_class-new('_record' = $user ) 31 ** -: $user_class-new(); 29** +$user = $user_class-new('_record' = $user ) if $user !$user-isa($user_class); 30** +return $user || $user_class-new(); 3231** } 3332** J I suppose this is not unlike the many discussions about what to pass to the view. Does the controller, for example, fetch a user object and pull the data required for the view into a hash and then pass that to the view? Or does the controller just fetch a user object and pass that directly to the view to decide what needs to display? I prefer just passing the object to the view. The controller code is much cleaner and then when the view needs to change don't need to also change the controller. And when there's a different view (like an API or moble ) the same controller action can be used. Thanks, In addition to everything already mentioned I wanted to get Bread::Board in on the act.. I've put Lecstor up on GitHub if you're interested along with a Catalyst app that uses it. Neither really do much but boy is there a lot of scaffolding! ..and all the tests pass! 8) The basic hook-up is Catalyst - Catalyst Models - Bread::Board Containers - Lecstor App/Models - DBIC and others.. decoupled like a broken bag o marbles.. the Catalyst Models: - LecstorApp - application lifetime - LecstorModel - application lifetime - LecstorRequest - request lifetime - Lecstor - request lifetime LecstorModel LecstorRequest return Bread::Board containers. LecstorApp returns a parameterized Bread::Board container Lecstor grabs the first two and shoves them into the third to make another Bread::Board container from which I get my app.. have I gone walkabout!? https://github.com/lecstor/Lecstor https://github.com/lecstor/Lecstor-Shop-Catalyst comments welcome. cheers, J On Tue, Jan 10, 2012 at 12:16 AM, Jason Galea li...@eightdegrees.com.auwrote: On Mon, Jan 9, 2012 at 3:14 PM, Bill Moseley mose...@hank.org wrote: On Monday, January 2, 2012, Jason Galea wrote: I think I've added another layer but I'm not sure where you draw the line.. I have a model layer over DBIC pulling together related result classes under a single model class. Then the app? layer uses the model layer to get things done. So I'd probably have one distribution that is our DBIC wrapped in a model layer layer and use that in a number of apps.. 8) Each app can then be used as the single model in a Catalyst app or script or whatever.. (I think I need more names for the parts..) Yes, where to draw the line is difficult to know. I've only had a few hours to work on this but already I feel like I'm reinventing Catalyst -- mostly because my model layer is pulling in much of the components that my Catalyst app would normally do -- DBIC, caching, even some concept of the current user. Access control is another topic. The problem parts for me are DBIC and TT. I thought I could just set up the components as usual, then load my app with them but it get's tricky calling one component from another at setup time, although it all works fine if you instantiate the app per request. So now I'm connecting/creating those myself. For other things provided by plugins I'm working more with Catalyst so for caching I will probably have my app accept a cache object
Re: [Catalyst] Basic Background Question, DBIx::Class
Hi Rob, from the google cache for http://wiki.catalystframework.org/wiki/necessarybackgroundknowledge Here is where the two schools diverge. The older school (popularized by the Smalltalk language) holds that the *business* *logic* should go in the Model. The younger school (popularized by recent web applications) holds that the *business* *logic* should go in the Controller. Both approaches work, and each has pros and cons. Which one you choose is more a matter of personal mindset and preference than anything else: does it suit your thinking better to have a smart Controller managing a thin database connection (the Model), or a smart Model that is tracking the state of your application and telling a thin request handler (the Controller) how to process requests? I've ended up putting business logic in a Catalyst model, but keeping it separate from the DBIx::Class model, basically building my app as standalone and hooking it into Catalyst as a model ( http://lecstor.com/catalyst_fat_model.html). It's not perfect though.. If you search the list you should find more than a few related discussions.. cheers, J On Sun, Feb 5, 2012 at 9:43 PM, Rob Brown r...@intelcompute.com wrote: Hi, I've recently jumped into Catalyst and DBIx::Class, and after following some tutorials, I am left with some controllers and a view which I'm completely happy with. The lib/Schema and lib/Model directories have me a little confused however. I have a single class in lib/Model, inheriting from Catalyst::Model::DBIC::Schema with some db connection details. Then the lib/Schema.pm class and dir, and Result classes for my db tables. I understand what they're all doing, but... Shouldn't I have classes in lib/Model/ for each of my tables/models? Is this what the Schema/ classes should be doing? I'm used to creating set classes for each model in my apps, so just having the DBIx::Class ones is a little odd right now, with no REAL logic in them to model my app logic. I would have expected some basic wrapper model classes in lib/Model/ for each Schema/Result. Maybe a single class in lib/Model/ is correct, to model the entire DB, it just threw me a little. some feedback/direction would be great. Thanks, Rob ___ 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] fcgid configuration for catalyst
Can you grab the app for the phrase PERL_ENV, and show us the top level application class, and whichever class contains PERL_ENV? t0m meant to say Can you grep the app for the phrase PERL_ENV, ..just to avoid any confusion.. PATH_INFO = /static/images/logo.gif, PATH_TRANSLATED = /auto/web-sciam/app/root/**static/images/logo.gif, QUERY_STRING= , REMOTE_ADDR = 10.78.184.182, REMOTE_PORT = 2596, REMOTE_USER = rkurien, REQUEST_METHOD = GET, REQUEST_URI = /cts/static/images/logo.gif, SCRIPT_FILENAME = /auto/web-sciam/app/script/ct**s_fastcgi_eifweb.plhttp://cts_fastcgi_eifweb.pl , SCRIPT_NAME = /app, SCRIPT_URI = http://app.com/cts/static/**images/logo.gifhttp://app.com/cts/static/images/logo.gif , SCRIPT_URL = /cts/static/images/logo.gif, SERVER_ADDR = 10.22.181.151, SERVER_ADMIN = webmaster-cts\@cisco.com, SERVER_NAME = app.com, SERVER_PORT = 80, So these look like at whatever point this is captured, the environment is sane - why this isn't being picked up by Catalyst::Engine::CGI (which the FastCGI engine subclasses) is a mystery to me, but I suspect your app code.. I removed the FcgidInitialEnv lines fromhttpd conf. But still am not able to move forward. Does it all work if you use the development server? I.e. is it _only_ FastCGI that's an issue, or generally with anything not mod_perl We are using catalyst 5.7014. This version is almost 4 years old, which is a lifetime! But it's probably easier to get you sorted out where you are right now than trying to upgrade as well. Cheers t0m Cheers t0m __**_ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-**bin/mailman/listinfo/catalysthttp://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/** catalyst@lists.scsys.co.uk/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] uri_for method is returning relative URLs
On Fri, Jan 27, 2012 at 11:23 PM, Robert Rothenberg rob...@gmail.comwrote: On 21/01/12 21:49 Jason Galea wrote: On Jan 22, 2012 1:35 AM, Robert Rothenberg rob...@gmail.com mailto:rob...@gmail.com wrote: : : Ok, it's working now. Apparently including the default fastcgi_params, even when they are edited to have the exact same values, does not seem to work. For history's sake, can you just confirm what DID work for you? Following the *exact* instructions in https://metacpan.org/module/Catalyst::Manual::Deployment::nginx::FastCGI#Configuration Basically, including the settings in the /etc/nginx/conf.d/myapp.conf file rather than relying on the default settings in /etc/gninx/fastcgi.conf that had the same values as the instructions. thanks, Robert. I think there's some confusion with the file to be edited.. I'm not sure what fastcgi.conf is for, but I've not touched it in my deployments. The file that needs to be changed is nginx-1.0.11/conf/fastcgi_params (in the nginx source I downloaded recently).. and the changes that need to be made are (in diffish format) - fastcgi_param SCRIPT_NAME$fastcgi_script_name; + fastcgi_param SCRIPT_NAME /; + fastcgi_param PATH_INFO $fastcgi_script_name; This works fine for me. cheers, 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/ ___ 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 method is returning relative URLs
sent by my android... On Jan 22, 2012 1:35 AM, Robert Rothenberg rob...@gmail.com wrote: On 18/01/12 12:36 Tomas Doran wrote: On 18 Jan 2012, at 12:03, Robert Rothenberg wrote: I'm relying on the default /etc/nginx/fastcgi.conf - which has the exact same values that the document says. Oh no it doesn't! Do I need to manually move them into the configuration for that virtual host? Nope. But the default config _is not correct_. Ok, it's working now. Apparently including the default fastcgi_params, even when they are edited to have the exact same values, does not seem to work. For history's sake, can you just confirm what DID work for you? Cheers, J Thanks. ___ 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] Re: Using model layers between Catalyst and DBIC
On Mon, Jan 9, 2012 at 3:14 PM, Bill Moseley mose...@hank.org wrote: On Monday, January 2, 2012, Jason Galea wrote: I think I've added another layer but I'm not sure where you draw the line.. I have a model layer over DBIC pulling together related result classes under a single model class. Then the app? layer uses the model layer to get things done. So I'd probably have one distribution that is our DBIC wrapped in a model layer layer and use that in a number of apps.. 8) Each app can then be used as the single model in a Catalyst app or script or whatever.. (I think I need more names for the parts..) Yes, where to draw the line is difficult to know. I've only had a few hours to work on this but already I feel like I'm reinventing Catalyst -- mostly because my model layer is pulling in much of the components that my Catalyst app would normally do -- DBIC, caching, even some concept of the current user. Access control is another topic. The problem parts for me are DBIC and TT. I thought I could just set up the components as usual, then load my app with them but it get's tricky calling one component from another at setup time, although it all works fine if you instantiate the app per request. So now I'm connecting/creating those myself. For other things provided by plugins I'm working more with Catalyst so for caching I will probably have my app accept a cache object at construction and pass in the Catalyst cache. For Authentication I've created my own store and user for the Catalyst Authentication plugin and they use my app to do what they have to. I've also created a store for the session plugin which uses my app, so all-in-all my app can see/touch everything that Catalyst is doing, and I can still make use of all the Catalyst stuff available (hopefully). I have Sets in lu of ResultSets and Models for Results. Although in most instances a Model will actually cover the usage of multiple Results. Each Set gets the dbic schema object and knows it's resultset name. Each model has a data attribute which contains a dbic row object and handles any methods I don't need to override via the Moose handles attribute attribute!? Set-create($hash) creates the dbic object and stuffs it into a model class and returns that. So you are mirroring DBICs class structure a bit. I need to consider that approach more as currently my model layer returns the DBIC row object directly. So, I have something like this: my $user_model = Model::User-new; my $new_user = $user-new_user( $user_data ); Not as flexible as your approach but my goal currently is to just abstract out the ORM so that Model::User can hide the specifics of the database. Actually, it's not that hard to do directly with DBIC, either. yeh, I decided a while back that DBIx::Class is complicated enough and I'm too lazy to keep trying to work out complicated solutions in the DBIC classes to do things I know I can do quickly and easily with regular Moose classes.. and I like having nice clean DBIC classes.. Each result class that has a model class overrides it's inflate_result method which again stuffs the dbic row object into the model object so searches on the related dbic resultsets return my model objects. Can you show a code example of that? I'm not sure I'm following why you use that approach instead of having your layer on top of DBIC do that. and the exception to the rule.. I did have my Set classes (which I now refer to as Model Controllers) grabbing search results and looping through, inflating them all into my Model Instances but then I couldn't just grab a resultset if I needed to limit/restrict/whatever, and any search or find had to be put through that ringer. With inflate_result I know that no matter how I get the results they'll be instances of my model. create is the only thing that doesn't work for so my controller does the wrapping there. package Lecstor::Schema::Result::Person; use base qw/DBIx::Class/; __PACKAGE__-load_components(qw/ Core /); __PACKAGE__-table('person'); __PACKAGE__-add_columns('id' ,'firstname','surname'); __PACKAGE__-set_primary_key('id'); sub inflate_result { my $self = shift; my $ret = $self-next::method(@_); return unless $ret; return Lecstor::Model::Instance::Person-new( _record = $ret ); } 1; Each model class has a validation class based on.. Validation::Class and create update run their input through that. If there are errors I stuff the errors into a very basic exception object and return that. This way I can return the same exception object no matter where the error comes from, eg a dbic exception.. Yes, I'm doing something very similar where validation happens before the method in the model and on validation errors and exception is thrown (if you are on the Moose list you may have seen my example). Thanks for the feedback and the ideas, no worries at all, happy to be able to provide it. cheers, J -- Bill
Re: [Catalyst] Re: Using model layers between Catalyst and DBIC
hehe.. you want layers, I got layers.. In addition to everything already mentioned I wanted to get Bread::Board in on the act.. I've put Lecstor up on GitHub if you're interested along with a Catalyst app that uses it. Neither really do much but boy is there a lot of scaffolding! ..and all the tests pass! 8) The basic hook-up is Catalyst - Catalyst Models - Bread::Board Containers - Lecstor App/Models - DBIC and others.. decoupled like a broken bag o marbles.. the Catalyst Models: - LecstorApp - application lifetime - LecstorModel - application lifetime - LecstorRequest - request lifetime - Lecstor - request lifetime LecstorModel LecstorRequest return Bread::Board containers. LecstorApp returns a parameterized Bread::Board container Lecstor grabs the first two and shoves them into the third to make another Bread::Board container from which I get my app.. have I gone walkabout!? https://github.com/lecstor/Lecstor https://github.com/lecstor/Lecstor-Shop-Catalyst comments welcome. cheers, J On Tue, Jan 10, 2012 at 12:16 AM, Jason Galea li...@eightdegrees.com.auwrote: On Mon, Jan 9, 2012 at 3:14 PM, Bill Moseley mose...@hank.org wrote: On Monday, January 2, 2012, Jason Galea wrote: I think I've added another layer but I'm not sure where you draw the line.. I have a model layer over DBIC pulling together related result classes under a single model class. Then the app? layer uses the model layer to get things done. So I'd probably have one distribution that is our DBIC wrapped in a model layer layer and use that in a number of apps.. 8) Each app can then be used as the single model in a Catalyst app or script or whatever.. (I think I need more names for the parts..) Yes, where to draw the line is difficult to know. I've only had a few hours to work on this but already I feel like I'm reinventing Catalyst -- mostly because my model layer is pulling in much of the components that my Catalyst app would normally do -- DBIC, caching, even some concept of the current user. Access control is another topic. The problem parts for me are DBIC and TT. I thought I could just set up the components as usual, then load my app with them but it get's tricky calling one component from another at setup time, although it all works fine if you instantiate the app per request. So now I'm connecting/creating those myself. For other things provided by plugins I'm working more with Catalyst so for caching I will probably have my app accept a cache object at construction and pass in the Catalyst cache. For Authentication I've created my own store and user for the Catalyst Authentication plugin and they use my app to do what they have to. I've also created a store for the session plugin which uses my app, so all-in-all my app can see/touch everything that Catalyst is doing, and I can still make use of all the Catalyst stuff available (hopefully). I have Sets in lu of ResultSets and Models for Results. Although in most instances a Model will actually cover the usage of multiple Results. Each Set gets the dbic schema object and knows it's resultset name. Each model has a data attribute which contains a dbic row object and handles any methods I don't need to override via the Moose handles attribute attribute!? Set-create($hash) creates the dbic object and stuffs it into a model class and returns that. So you are mirroring DBICs class structure a bit. I need to consider that approach more as currently my model layer returns the DBIC row object directly. So, I have something like this: my $user_model = Model::User-new; my $new_user = $user-new_user( $user_data ); Not as flexible as your approach but my goal currently is to just abstract out the ORM so that Model::User can hide the specifics of the database. Actually, it's not that hard to do directly with DBIC, either. yeh, I decided a while back that DBIx::Class is complicated enough and I'm too lazy to keep trying to work out complicated solutions in the DBIC classes to do things I know I can do quickly and easily with regular Moose classes.. and I like having nice clean DBIC classes.. Each result class that has a model class overrides it's inflate_result method which again stuffs the dbic row object into the model object so searches on the related dbic resultsets return my model objects. Can you show a code example of that? I'm not sure I'm following why you use that approach instead of having your layer on top of DBIC do that. and the exception to the rule.. I did have my Set classes (which I now refer to as Model Controllers) grabbing search results and looping through, inflating them all into my Model Instances but then I couldn't just grab a resultset if I needed to limit/restrict/whatever, and any search or find had to be put through that ringer. With inflate_result I know that no matter how I get the results they'll be instances of my model. create is the only thing
Re: [Catalyst] Using model layers between Catalyst and DBIC
Hi Bill, On Mon, Jan 2, 2012 at 11:41 AM, Bill Moseley mose...@hank.org wrote: So, I'm looking at adding a separate model layer(s) (pattern #3 in link above), as is commonly suggested. My plan is to have one distribution that is our DBIC layer and then use that in a number of separate model layers (split out by functionality). The goal is to allow separate teams to work on different parts of the app, have separate unit tests, and separate release schedules. And to thin out the controllers. Much more manageable and scalable. I think I've added another layer but I'm not sure where you draw the line.. I have a model layer over DBIC pulling together related result classes under a single model class. Then the app? layer uses the model layer to get things done. So I'd probably have one distribution that is our DBIC wrapped in a model layer layer and use that in a number of apps.. 8) Each app can then be used as the single model in a Catalyst app or script or whatever.. (I think I need more names for the parts..) Anyone here doing something like this? As I look into this I'm coming up with quite a few questions, of course. I've been trying learn the steps to this little dance for a while now and still haven't put anything into production, but for what it's worth, here are some of the things I've implemented in my most recent code.. I have Sets in lu of ResultSets and Models for Results. Although in most instances a Model will actually cover the usage of multiple Results. Each Set gets the dbic schema object and knows it's resultset name. Each model has a data attribute which contains a dbic row object and handles any methods I don't need to override via the Moose handles attribute attribute!? Set-create($hash) creates the dbic object and stuffs it into a model class and returns that. Each result class that has a model class overrides it's inflate_result method which again stuffs the dbic row object into the model object so searches on the related dbic resultsets return my model objects. Each model class has a validation class based on.. Validation::Class and create update run their input through that. If there are errors I stuff the errors into a very basic exception object and return that. This way I can return the same exception object no matter where the error comes from, eg a dbic exception.. So my app can use the Login set to create a login model which has methods to set/get email username, check the password, set a temporary password, add to roles, and get roles by name. Beneath that is 3 or 4 DBIC result classes which the model class works with via custom methods or delegation. ok, sorry.. I'll stop there. This has turned into a brain dump and clarity has suffered badly.. I hope you got something for your trouble.. cheers, J This is more of a Perl question than a Catalyst one, but one question I have is about data validation. Catalyst provides a nice defined request structure so, for example, I have input data validation managed very consistently (e.g. validation classes can be mapped to Catalyst actions automatically and likewise validation errors can be added to the response in a common way). That makes the controller code simple since when the controller runs it knows if the data it has received is valid or not and the controller does not worry about gathering up error messages. So, I'm wondering how best to do that if I provide a separate model layer that includes data validation. For example, say I have a model for user management which includes a method for creating new users. If I have a model method $users-add_user( \%user_data ) I would tend to have it return the new user object or throw an exception on failure. What probably makes sense is using exception objects and have Catalyst catch those to render the error in an appropriate way. Is this an approach you are using? Any other tips on structuring the model layer that works well with both Catalyst and non-Catalyst applications? Looking back, I think my question isn't that much about data validation as is about providing a framework for model creation such that a consistent API is provided -- making it easy to hook it into Catalyst for things like rendering errors in a consistent way. Thanks for any feedback you can provide, -- Bill Moseley mose...@hank.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/ ___ 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 model layers between Catalyst and DBIC
oh, I've also started playing with Bread::Board and its looking like my model layer consisting of the DBIC Schema and all my Sets will be pulled together into a single Bread::Board container. J On Mon, Jan 2, 2012 at 1:36 PM, Jason Galea li...@eightdegrees.com.auwrote: Hi Bill, On Mon, Jan 2, 2012 at 11:41 AM, Bill Moseley mose...@hank.org wrote: So, I'm looking at adding a separate model layer(s) (pattern #3 in link above), as is commonly suggested. My plan is to have one distribution that is our DBIC layer and then use that in a number of separate model layers (split out by functionality). The goal is to allow separate teams to work on different parts of the app, have separate unit tests, and separate release schedules. And to thin out the controllers. Much more manageable and scalable. I think I've added another layer but I'm not sure where you draw the line.. I have a model layer over DBIC pulling together related result classes under a single model class. Then the app? layer uses the model layer to get things done. So I'd probably have one distribution that is our DBIC wrapped in a model layer layer and use that in a number of apps.. 8) Each app can then be used as the single model in a Catalyst app or script or whatever.. (I think I need more names for the parts..) Anyone here doing something like this? As I look into this I'm coming up with quite a few questions, of course. I've been trying learn the steps to this little dance for a while now and still haven't put anything into production, but for what it's worth, here are some of the things I've implemented in my most recent code.. I have Sets in lu of ResultSets and Models for Results. Although in most instances a Model will actually cover the usage of multiple Results. Each Set gets the dbic schema object and knows it's resultset name. Each model has a data attribute which contains a dbic row object and handles any methods I don't need to override via the Moose handles attribute attribute!? Set-create($hash) creates the dbic object and stuffs it into a model class and returns that. Each result class that has a model class overrides it's inflate_result method which again stuffs the dbic row object into the model object so searches on the related dbic resultsets return my model objects. Each model class has a validation class based on.. Validation::Class and create update run their input through that. If there are errors I stuff the errors into a very basic exception object and return that. This way I can return the same exception object no matter where the error comes from, eg a dbic exception.. So my app can use the Login set to create a login model which has methods to set/get email username, check the password, set a temporary password, add to roles, and get roles by name. Beneath that is 3 or 4 DBIC result classes which the model class works with via custom methods or delegation. ok, sorry.. I'll stop there. This has turned into a brain dump and clarity has suffered badly.. I hope you got something for your trouble.. cheers, J This is more of a Perl question than a Catalyst one, but one question I have is about data validation. Catalyst provides a nice defined request structure so, for example, I have input data validation managed very consistently (e.g. validation classes can be mapped to Catalyst actions automatically and likewise validation errors can be added to the response in a common way). That makes the controller code simple since when the controller runs it knows if the data it has received is valid or not and the controller does not worry about gathering up error messages. So, I'm wondering how best to do that if I provide a separate model layer that includes data validation. For example, say I have a model for user management which includes a method for creating new users. If I have a model method $users-add_user( \%user_data ) I would tend to have it return the new user object or throw an exception on failure. What probably makes sense is using exception objects and have Catalyst catch those to render the error in an appropriate way. Is this an approach you are using? Any other tips on structuring the model layer that works well with both Catalyst and non-Catalyst applications? Looking back, I think my question isn't that much about data validation as is about providing a framework for model creation such that a consistent API is provided -- making it easy to hook it into Catalyst for things like rendering errors in a consistent way. Thanks for any feedback you can provide, -- Bill Moseley mose...@hank.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] Re: Catalyst::Test Test::DBIx::Class
On Sun, Dec 4, 2011 at 7:59 PM, Dimitar Petrov mita...@gmail.com wrote: You might want to check this blog post also: http://www.modernperlbooks.com/mt/2011/11/parallelism-and-test-suites.html thanks, but that's what got me into this mess.. well http://www.modernperlbooks.com/mt/2011/12/controlling-test-parallelism-with-prove.html which also links to that.. ok, actually I've tidied up the mess and I'm rather pleased with how it looks.. I'm going to have a lot more tests than this by the time I'm finished so I think it's been well worth the effort.. (note the wallclock secs) $ prove Lecstor/t BB/t BB-Site-Catalyst/t aid_proxy/AID-Proxy/t ... All tests successful. Files=29, Tests=369, 109 wallclock secs ( 0.15 usr 0.04 sys + 26.25 cusr 4.36 csys = 30.80 CPU) $ prove -j9 Lecstor/t BB/t BB-Site-Catalyst/t aid_proxy/AID-Proxy/t ... All tests successful. Files=29, Tests=369, 19 wallclock secs ( 0.18 usr 0.04 sys + 34.14 cusr 4.98 csys = 39.34 CPU) cheers, J Cheers On Sun, Dec 4, 2011 at 10:49 AM, Jason Galea li...@eightdegrees.com.auwrote: On Sun, Dec 4, 2011 at 7:10 PM, Tomas Doran bobtf...@bobtfish.netwrote: On 4 Dec 2011, at 04:13, Jason Galea wrote: hmm.. actually.. can I hand Catalyst::Test the schema I can get from Test::DBIx::Class? I think you can just force replace the schema, with something like MyApp-model('DB')-schema($**mytestschema); yup, works a treat.. thanks again. $ prove t ... All tests successful. Files=6, Tests=90, 27 wallclock secs ( 0.07 usr 0.02 sys + 9.87 cusr 1.14 csys = 11.10 CPU) Result: PASS $ prove -j9 t ... All tests successful. Files=6, Tests=90, 8 wallclock secs ( 0.06 usr 0.01 sys + 11.24 cusr 1.34 csys = 12.65 CPU) Result: PASS woohoo! Alternatively, you can setup a test config (by writing out a config file with the extra DB details in) before using Catalyst::Test (although N.B. that use Catalyst::Test will happen at compile time, so you probably need the initial setup in a BEGIN block). Cheers t0m __**_ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-**bin/mailman/listinfo/catalysthttp://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/** catalyst@lists.scsys.co.uk/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/ ___ 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] Catalyst::Test Test::DBIx::Class
Dear lazyweb.. not sure if this is staring me in the face.. If I'm using Catalyst::Test Test::DBIx::Class, with the latter starting up MySQL with a random socket location, how do I tell my Catalyst server how to connect to the MySQL instance? I'm also trying to get my tests running in parallel so I don't want to pre-set anything.. cheers, 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/
[Catalyst] Re: Catalyst::Test Test::DBIx::Class
hmm.. actually.. can I hand Catalyst::Test the schema I can get from Test::DBIx::Class? On Sun, Dec 4, 2011 at 1:56 PM, Jason Galea li...@eightdegrees.com.auwrote: Dear lazyweb.. not sure if this is staring me in the face.. If I'm using Catalyst::Test Test::DBIx::Class, with the latter starting up MySQL with a random socket location, how do I tell my Catalyst server how to connect to the MySQL instance? I'm also trying to get my tests running in parallel so I don't want to pre-set anything.. cheers, 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/
Re: [Catalyst] Catalyst::Plugin::AutoCRUD setup_components
On Tue, Nov 1, 2011 at 10:00 PM, Jason Galea li...@eightdegrees.com.auwrote: On Tue, Nov 1, 2011 at 9:44 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 1 Nov 2011, at 10:48, Jason Galea wrote: On Tue, Nov 1, 2011 at 7:38 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 1 Nov 2011, at 03:24, Jason Galea wrote: any suggestions? Can you show us the code that doesn't work when it's in your app? Hi t0m, thanks, I'll try to keep it relevant. If you don't see anything and you'e still keen there's more but I think these are the relevant parts.. Yeah, gotcha. I'm not sure offhand why this doesn't work, but I can have a poke into how AutoCRUD extends things and see if I can reproduce and/or recommend a way for AutoCRUD to do it better.. Hi t0m, I'll try and do some further testing on this tomorrow but at first glance it appears I've managed to turn the AutoCRUD plugin into a role which works with the rest of my app.. (file attached). cheers, J AutoCRUD.pm Description: Perl program ___ 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::AutoCRUD setup_components
On Tue, Nov 1, 2011 at 7:38 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 1 Nov 2011, at 03:24, Jason Galea wrote: any suggestions? Can you show us the code that doesn't work when it's in your app? Hi t0m, thanks, I'll try to keep it relevant. If you don't see anything and you'e still keen there's more but I think these are the relevant parts.. #- package MyApp::Catalyst; extends 'Catalyst'; with MyOtherApp::Web::Role'; # I added some warn statements to AutoCRUD.pm # if I take this out the app starts and autocrud actions are listed at startup and my warns are printed. # with it in my app runs as it should, but no autocrud actions and my warns are not printed. after 'setup_components' = sub { my $class = shift; $class-inject_components('Model', qw! MyAppModel !); $class-inject_components('View', qw! TT JSON !); $class-inject_components('Controller', qw! Account Basket !); }; #- package MyOtherApp::Web::Role; use Moose::Role; use namespace::autoclean; use CatalystX::InjectComponent; my %component_types = ( Model = 1, View = 1, Controller = 1, ); sub inject_components{ my ($class, $type, @components) = @_; return unless $component_types{$type}; foreach(@components){ CatalystX::InjectComponent-inject( into = $class, component = MyOtherApp::Catalyst::${type}::.$_, as = $_ ); } } cheers, 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/
Re: [Catalyst] Catalyst::Plugin::AutoCRUD setup_components
On Tue, Nov 1, 2011 at 9:44 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 1 Nov 2011, at 10:48, Jason Galea wrote: On Tue, Nov 1, 2011 at 7:38 PM, Tomas Doran bobtf...@bobtfish.net wrote: On 1 Nov 2011, at 03:24, Jason Galea wrote: any suggestions? Can you show us the code that doesn't work when it's in your app? Hi t0m, thanks, I'll try to keep it relevant. If you don't see anything and you'e still keen there's more but I think these are the relevant parts.. Yeah, gotcha. I'm not sure offhand why this doesn't work, but I can have a poke into how AutoCRUD extends things and see if I can reproduce and/or recommend a way for AutoCRUD to do it better.. oh, ok, cool, thans again. I was looking at the AutoCrud code and thinking I should be doing things differently, ie creating a plugin to do what I'm trying to do.. ie2 have a base app that I can import controllers and stuff from into other apps so I'd love to know what you think. cheers, 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/
[Catalyst] Catalyst::Plugin::AutoCRUD setup_components
Hi all, I'm trying to use Catalyst::Plugin::AutoCRUD but when correctly set up no actions are added to my app. After much hair pulling I found that my use of after 'setup_components' in my main Catalyst class was preventing setup_components in AutoCRUD from being called at all. After removing after 'setup_components' from my app AutoCRUD is loaded but breaks the rest of my app. any suggestions? (I'm using CatalystX::InjectComponent in the after 'setup_components' method) cheers, 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/
Re: [Catalyst] Integrating multi-levelled meta-shopping-cart using Catalyst
Hi Alec, yes, this can be done with Catalyst. I'm currently developing similar functionality a couple of applications. The complexity will depend on the similarity of functionality between the individual stores. Pre-condition: • More than 1 eCommerce store setup on this one Catalyst site • Each store has it's own account, self managed by them with a certain payment-gateway (i.e. PayPal) I have taken the approach of implementing the base app which is used as a Catalyst Model. On each request the app identifies the store by the host name being used and loads that store's config file from which it can access the location of site templates, payment gateway details, and other custom config details. For the templates I have a directory containing the base templates and each store can have a directory containing templates which override base. Using chained actions or an auto action you can then set the stash-{additional_template_paths} to a list of these template directories. The TT view will then search those directories for the templates to be used. I imagine you would want all stores to use the same database so user records, product records etc would need to include a store id. One of my products has a common product table and a store_product table which maps products to a store as not all stores have all products. Using DBIx::Class you can configure your ResultSets (or db interface classes) to automatically include the store id in queries which need it. Use case: • Customer wants to purchase multiple items, from multiple stores System functionality required: • Integrate the various store's carts into one [separated into groups, with a total collated into the one receipt] as above, your basket would need to identify which store a product belongs to and I image this would continue through to order and sales records. System functionality preferred (but not required): • Integration with multiple payment gateways (with a minimum of dialogues presented to the customer) each payment gateway could have it's own Catalyst checkout action and the customer is sent through the appropriate action based on customer choices and the store config. If you were looking for pre-built solutions this might not help so much but I hope it gives you an idea of the possible solutions. cheers, Jason Can this be done with Catalyst? - If so, can you point me in the right direction? Thanks for all suggestions, Alec Taylor ___ 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] Question on user role management
No I didn't even think that I could get that information that way, still very new to Catalyst/MVC/OO programing. I will give that a try, because it is being stored into an array in your example I would still need to put it in a stash and go through it with a FOR or FOREACH loop in my view correct? just stash the user and call roles on it as you did with the current user. Also yes I do have a many_to_many relationship in my user.pm for roles. On Tue, May 17, 2011 at 10:05 AM, Jason Galea li...@eightdegrees.com.au wrote: Hi Adam, have you tried using the roles method on the other users? my $user = $c-stash-{users_rs}-find({ uniqid = $uniqid }); die No such user: $uniqid\n if (!$user); my @roles = $user-roles; do you have a many_to_many defined in your user table class? eg __PACKAGE__-has_many(user2role_maps = 'MyApp::DB::Result::User2Role', 'user'); __PACKAGE__-many_to_many(roles = 'user2role_maps', 'role'); I'm guessing you do as c.user.roles works.. cheers, J On Tue, May 17, 2011 at 11:10 AM, Adam Jimerson vend...@gmail.com wrote: I am trying to come up with a way to manage roles for users in my Catalyst app, I have a database structure much like what is used in Chapter 5 of the Catalyst::Manual::Tutorial http://search.cpan.org/~bobtfish/Catalyst-Manual-5.8007/lib/Catalyst/Manual/Tutorial/05_Authentication.pod where I have a user table, a role table, and and a usertorole table. I am trying to find a way to get a list of roles for a user to be able to make changes, add new roles and/or remove roles from the user. I have both authentication and authorization working in my app and I can fetch the roles for the user currently logged in by ul [% FOR role = c.user.roles %]li[% role %]/li[% END %] /ul But when I try to get a list from a different user it doesn't work as expected, here is what I am currently doing sub base : Chained('/'): PathPart('admin') :CaptureArgs(0) { my ( $self, $c ) = @_; $c-stash( users_rs = $c-model('DB::User')); $c-stash( role_rs = $c-model('DB::Role')); $c-stash( usertorole_rs = $c-model('DB::Userstorole')); } sub user : Chained('base'): CaptureArgs(1) { my ( $self, $c, $uniqid ) = @_; if ( $uniqid == m/[^0-9]/ ) { die The ID number is not numeric\n; } my $user = $c-stash-{users_rs}-find({ uniqid = $uniqid }); die No such user: $uniqid\n if (!$user); my $roles = $c-stash-{usertorole_rs}-search( undef, { where = { 'userid', $uniqid } }, ); warn No such role: $uniqid\n if (!$roles); $c-stash(user = $user, roles = $roles); } [% FOR role IN roles %] trtdRole #:/tdtdRole [% role.role %] Role ID [% role.roleid %] User id [% role.userid %]/td/tr [% END %] My database schema is so CREATE TABLE roles ( uniqid integer NOT NULL, role character varying(32) NOT NULL ); CREATE TABLE users ( uniqid integer NOT NULL, username character varying(20) NOT NULL, password character varying(40) NOT NULL, firstname character varying(20) NOT NULL, lastname character varying(20) NOT NULL, email character varying(20) NOT NULL, active boolean DEFAULT true NOT NULL, created timestamp without time zone DEFAULT now() NOT NULL ); CREATE TABLE userstoroles ( userid integer NOT NULL, role integer NOT NULL ); Am I going about this the wrong way or is there something that I am over looking? ___ 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/ ___ 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/ -- don't treat 'em like they'll always be around.. me, 5/4/11 Jason Galea Web Developer Ph 07 40556926 Mob 04 12345 534 www.eightdegrees.com.au ___ 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] HTML::FormHandler IDs not playing with JQuery
On Tue, Mar 29, 2011 at 8:43 PM, Victor Churchill victorchurch...@gmail.com wrote: Trouble is I would like to use id=q1_select.0 as a JQuery selector to control the show/hide of 'child' questions, and the selector does not like the .0. I determined with a couple of manual tests that I can't select an item with a period in the ID - or so it appears anyway. I had the same issue, not sure if it was for the same reasons.. but now have this in my code.. (use '-' instead of '.' in form id's) my forms have a base class which contains: has '+field_traits' = ( default = sub { ['My::Form::Role'] } ); and then.. package My::Form::Role; use Moose::Role; around 'build_id' = sub { my $orig = shift; my $self = shift; my $prefix = ( $self-form $self-form-html_prefix ) ? $self-form-name . - : ''; return $prefix . $self-full_name; }; no Moose::Role; 1; cheers, 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/
Re: [Catalyst] Best prcatice: same back-end, different UI
Hi Julien, I've used a couple of different tactics.. assuming you are subclassing Catalyst::View::TT for your view you can do: $c-stash-{additional_template_paths} = [$c-config-{root}.'/'.$theme_dir]; in your controller, auto, chain, whatever. This will tell TT to look for templates there first. You can also hook right into TT utilising the fact that the INCLUDE_PATHS config can be filled dynamically.. http://template-toolkit.org/docs/manual/Config.html#section_INCLUDE_PATH my $template = Template-new({ INCLUDE_PATH = [ '/usr/local/templates', \incpath_generator, My::IncPath::Generator-new( ... ) ], }); cheers, J On Wed, Mar 9, 2011 at 2:48 PM, Julien Sobrier jul...@sobrier.net wrote: Hello, I have multiple domain names tight to the same back-end. I'd like to be able to present different templates based on: * the domain name * the language (not just a translation) * user agent (mobile version) I am wondering what is the best way to achieve this. Thanks Julien ___ 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/ -- Jason Galea Web Developer Ph 07 40556926 Mob 04 12345 534 www.eightdegrees.com.au ___ 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] redirect and ajax
AFAIK you would need to return the uri to the browser, as your ajax response and redirect the browser using javascript. On Mon, Mar 7, 2011 at 10:24 PM, Cylon Toaster cylontoas...@gmx.de wrote: Hello, I use an ExtJS-form, which sends an AJAX-request to the server. Depending on the server-results the user should now be redirected to another page, but somehow it doesn't work any more, when I use AJAX-requests. Normal forms are no problem. I have used constructions like this: $c-res-redirect($c-uri_for($c-controller('aaa')-action_for('bbb'))); or ... $c-detach('/aaa/bbb'); Any hint for me? Thank u. ___ 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] Making secure session cookies (or, how do we make Explorer stop complaining about nonsecure content on a secure page?)
you're not using a non-ssl cdn for your javascript libraries? (had me searching once..) On Mon, Feb 21, 2011 at 1:32 PM, will trillich will.trill...@serensoft.com wrote: Catalyst::Plugin::Session::State::Cookie shows how to make a secure cookie, which is great when you're rolling cookies by hand in your code. But how do you set a secure cookie in the context of a myapp.conf setup? session flash_to_stash = 1 dbic_class = MyApp::Session expires = 3600 cookie_secure = 1 # just kidding /session That's not doing the trick. Which doc reveals the right mojo? === This is in pursuit of stopping the Explorer error This page contains both secure and nonsecure items... Other than the doctype and the html xmlns= attribute, we can't find any http:// references, even looking in css @import and url() ... so the next culprit seems to be the nonsecure cookie. Other guidance is more than welcome! -- The first step towards getting somewhere is to decide that you are not going to stay where you are. -- J.P.Morgan ___ 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/ -- Jason Galea Web Developer Ph 07 40556926 Mob 04 12345 534 www.eightdegrees.com.au ___ 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] Getting Error while running server script
On Tue, May 18, 2010 at 8:23 PM, svi...@gist.in wrote: Couldn't load class (Info::Search) because: Couldn't instantiate component Info::Search::Model::DBIx, Attribute (schema_class) is required at /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Class/MOP/Class.pm line 364 Hi Sachin, it sounds like you have Info::Search::Model::DBIx which is extending Catalyst::Model::DBIC::Schema something like this? package Info::Search::Model::DBIx; use Moose; extends 'Catalyst::Model::DBIC::Schema'; __END__ but you haven't configured schema_class. you can either add config code to Info::Search::Model::DBIx: __PACKAGE__-config( schema_class = 'Your::DB::Schema::Class', connect_info = [ 'dbi:mysql:dbase_name', 'username', 'password', ], ); or to your config file: Model::DB: schema_class: Your::DB::Schema::Class connect_info: - dbi:mysql:dbase_name - username - password -- Jason Galea Web Developer www.eightdegrees.com.au ___ 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] Subclass $c-log-debug(...) to prepend ${\$c-action}: ...
not as simple as I thought. I'd be interested to know if there's an easier way.. package MyApp; use MyApp::Catalyst::Log; __PACKAGE__-setup; __PACKAGE__-log( MyApp::Catalyst::Log-new ); around 'log' = sub{ my $orig = shift; my $self = shift; return $self-$orig if @_; my $log = $self-$orig; $log-action($self-action) if blessed $self $self-action; return $log; }; package MyApp::Catalyst::Log; use Moose; extends 'Catalyst::Log'; has 'action' = ( isa = 'Object', is = 'rw' ); around 'debug' = sub{ my $orig = shift; my $self = shift; $_[0] = $self-action.: .$_[0]; return $self-$orig(@_); }; 1; cheers, J On Tue, Jan 19, 2010 at 6:22 AM, Kiffin Gish kiffin.g...@planet.nl wrote: I'd like to subclass $c-log-debug(message) so that it prints out: ''.$c-action.': '.'message' What's the easiest way to do this? -- Kiffin Gish kiffin.g...@planet.nl Gouda, The Netherlands ___ 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/ -- Jason Galea Web Developer Ph 07 40556926 Mob 04 12345 534 www.eightdegrees.com.au ___ 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::Test configuration questions
On Tue, Oct 27, 2009 at 8:17 AM, Evan Carroll li...@evancarroll.com wrote: I want to dynamically modify the configuration of my application for the purpose of testing. That configuration is loaded from a yaml. I'm unsure of how to to load a different yaml-conf for the purpose of testing alternate configurations, or of how to best manipulate the configuration of my app after the load to simulate a test in a different environments then the default. http://search.cpan.org/~bricas/Catalyst-Plugin-ConfigLoader-0.27/lib/Catalyst/Plugin/ConfigLoader.pm get_config_local_suffixhttp://search.cpan.org/%7Ebricas/Catalyst-Plugin-ConfigLoader-0.27/lib/Catalyst/Plugin/ConfigLoader.pm#___top Determines the suffix of files used to override the main config. By default this value is local, which will load myapp_local.conf. The suffix can be specified in the following order of preference: - $ENV{ MYAPP_CONFIG_LOCAL_SUFFIX } - $ENV{ CATALYST_CONFIG_LOCAL_SUFFIX } - $c-config-{ 'Plugin::ConfigLoader' }-{ config_local_suffix } The first one of these values found replaces the default of local in the name of the local config file to be loaded. For example, if $ENV{ MYAPP_CONFIG_LOCAL_SUFFIX } is set to testing, ConfigLoader will try and load myapp_testing.conf instead of myapp_local.conf. cheers, J -- Jason Galea Web Developer Ph 07 40556926 Mob 04 12345 534 www.eightdegrees.com.au ___ 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: generating and redirecting to pdfs
On Sun, Oct 25, 2009 at 12:49 AM, Aristotle Pagaltzis pagalt...@gmx.dewrote: * Jason Galea li...@eightdegrees.com.au [2009-10-21 01:50]: $c-res-header( 'Content-Disposition' = 'attachment;filename='.$c-stash-{pdf_filename} ); This will break for filenames with spaces in them. For strict correctness, you want this: ( my $pdf_filename = $c-stash-{ pdf_filename } ) =~ s!!\\!g; $c-res-header( 'Content-Disposition' = qq(attachment; filename=$pdf_filename) ); hmm.. I'm missing something here.. won't that simply escape double quotes and not affect spaces? -- Jason Galea Web Developer Ph 07 40556926 Mob 04 12345 534 www.eightdegrees.com.au ___ 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] generating and redirecting to pdfs
On Sat, Oct 24, 2009 at 12:23 AM, Steve Rippl rip...@woodlandschools.orgwrote: Thanks for this! I did get this working, the only change I seemed to have to make was $c-response-content_type('application/pdf'); In order to get my browser to open it using a pdf reader (with 'text/pdf' it was using a text editor). cool. ah, I did see/wonder about that. I've changed my code now. 'text/pdf' worked for me in my Lenny desktop but I had done any other testing.. thanks, J -- Jason Galea Web Developer Ph 07 40556926 Mob 04 12345 534 www.eightdegrees.com.au ___ 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] generating and redirecting to pdfs
Hi Steve, not sure if you can gleen anything from this but I recently set myself up to produce PDFs from basic HTML produced by TT. I created a view that processes a TT template then converts to PDF using HTML::Doc and shoves it as a string straight to $c-response-body. I'm pretty happy with the results and ease of use.. (automatically handles multi page output amoung other things) # package Lecstor7::View::PDF; use base qw/Catalyst::View/; use HTML::HTMLDoc; __PACKAGE__-config-{template_extension} = '.tt'; __PACKAGE__-config-{tmp_dir} = '/tmp'; __PACKAGE__-config-{page_size} = 'a4'; __PACKAGE__-config-{header} = ['t', '.', '/']; __PACKAGE__-config-{footer} = ['t', '.', '/']; sub process { my ( $self, $c ) = @_; my $template = $c-stash-{template} || $c-action . $self-config-{template_extension}; unless (defined $template) { $c-log-debug('No template specified for rendering') if $c-debug; return 0; } my $output = $c-view('TT')-render($c, $template); if (UNIVERSAL::isa($output, 'Template::Exception')) { my $error = qq/Couldn't render template $output/; $c-log-error($error); $c-error($error); return 0; } my $doc = HTML::HTMLDoc-new( 'mode' = 'file', 'tmpdir' = $self-config-{tmp_dir} ); $doc-set_page_size($self-config-{page_size}); $doc-set_header(@{$self-config-{header}}); $doc-set_footer(@{$self-config-{footer}}); $doc-set_html_content($output); my $pdf = $doc-generate_pdf(); unless ( $c-response-content_type ) { $c-response-content_type('text/pdf; charset=utf-8'); } $c-res-header( 'Content-Disposition' = 'attachment;filename='.$c-stash-{pdf_filename} ); $c-response-body($pdf-to_string()); return 1; } 1; # in my Controller I can then do.. (simplified version of my actual controller) sub packing_slip : Local{ my ($self, $c) = @_; $c-stash( pdf_filename = 'packingslip.pdf' ); $c-forward( $c-view('PDF') ); } cheers, J On Wed, Oct 21, 2009 at 8:25 AM, Steve Rippl rip...@woodlandschools.orgwrote: Hi, I'm using TT for my View templates, and I'm experimenting with Template::Plugin::Latex for generating pdf reports. Now I'm generating pdfs (which is nice!) but not redirecting to them at the end, so I suspect I'm using the wrong approach. Right now I've added OUTPUT_PATH = 'root/tmp' to lib/WsdSis/View/TT.pm and when I hit the /report/test it using the following template (without a wrapper) [% META no_wrapper = 1; META title = 'Latex'; -%] [% USE Latex(output='example.pdf') -%] [% FILTER latex %] \documentclass[letterpaper]{article} \begin{document} ...LaTeX document... \end{document} [% END -%] which produces root/tmp/example.pdf but leaves me looking at a blank page on the screen. I realize my view is supposed to provide the final view and I've redirected that way to the pdf file, is there a quick way to redirect to that or do I need a different approach (similar to the Catalyst::View::Email::Template example in the book?). Any pointers would be much appreciated... Thanks, Steve -- Steve Rippl Technology Director Woodland Public Schools 360 225 9451 x326 ___ 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/ -- Jason Galea Web Developer Ph 07 40556926 Mob 04 12345 534 www.eightdegrees.com.au ___ 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: Debian recommendation
On Sat, Oct 17, 2009 at 12:33 PM, Paul Makepeace pa...@paulm.com wrote: I recently have completely tossed using Debian's perl packages because, while I do love Debian and all its package awesomeness, there simply wasn't the package lib*-perl support in stable/lenny and even testing/squeeze didn't have all the goods needed for a (what I think is) fairly regular Catalyst install. So my question then is: given you've presumably done this, which of your quoted solutions do you like best? I tried dh-make-perl many moons ago and gave up due to annoyances around following dependencies. Maybe CPP::Dist::Deb or something else solves that. I'm hoping local::lib + cpan + git solves this but curious how Debian-integrated solutions work too. Paul I would have to agree with Paul here. I went the dh-make-perl CPANPLUS::Dist::Deb routes, had my own repositories and packaged my own modules as debs. I basically found it complicated everything too much for my liking. I pursued this for quite a while knowing Debian used Perl extensively in it's own admin scripts and messing with them carried the threat of screwing with more than my own stuff. I encounted repeated issues with the automated packaging systems and more trying to manage my own repository. I currently have cpanp configured on my servers so I can install modules to a user's home directory. I then modify other users' .bashrc to add that directory to inc. Getting cpanp configured and set up this way has proved to be tricky so in future I will be trying the local::lib method. I love Debian and settled on it as my dist of choice many years ago but wanting to use the latest greatest Perl modules means not sticking with 100% Debian packages. Catalyst DBIx::Class (as examples) move way too quickly for that and the benefits that the latest versions offer are often too good to refuse. I still use aptitude as my first port-o-call for installing Perl modules whenever I can but when that fails cpanp easily picks up the slack and as a last resort I can always use cpanp as root. I've been running like this for a year or so now and in that time I haven't had to spend more than 10 minutes ugrading or installing any module I've needed. ..just my 2c cheers, J -- Jason Galea Web Developer Ph 07 40556926 Mob 04 12345 534 www.eightdegrees.com.au ___ 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] What is correct way to re-check user password for authenticated user?
Oleg Kostyuk wrote: Hello subscribers, On some pages I need to re-check user password (to be more concrete - each time when user change any settings on user settings page). I can't compare passwords directly (something like: $form-{password} eq $c-user-password()), because in DB I have only hashed passwords. how are you hashing your passwords? If using DBIx::Class::EncodedColumn you can get it to generate a 'check_password' method (see docs). Seems that I can try to authenticate user again, by calling $c-authenticate(name=$c-user-name, pass=$form-{password}), but I concerned is this acceptable - calling authenticate, when user is already authenticated. And what will be if provided password is incorrect - user will be auto-logout'ed or not? May be there is some other way, that is not obvious to me? Any thoughts is welcome, Thanks. ___ 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] nginx configuration tute for catalyst
Hi K, that'd be your nginx.conf. You should find it in /etc/nginx/ or maybe /usr/local/nginx all depending on how nginx was installed. cheers, J kakim...@tpg.com.au wrote: hi, all i am looking at http://dev.catalyst.perl.org/wiki/adventcalendararticles/2008/02-catalyst_and_nginx. First of all, let me apologise as i dont have a sent folder in this lite mail client of mine. Hence, i cannot post this question to my previously sent mail. i am looking at http://dev.catalyst.perl.org/wiki/adventcalendararticles/2008/02-catalyst_and_nginx. Under the following, which file do we put the fastcgi_pass unix:/var/www/MyApp/fastcgi.socket; in ? Nginx Configuration Configuring a location in nginx to be handled by FastCGI is trivial. It's a simple one-liner, nestled into a location block, which points out the location to the socket: ___ 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] Catalyst::View::Email config error after Catalyst upgrade
Hi David, setting default_view in my config appears to have fixed this for me.. (I have other, unrelated, issues now) default_view: MyApp::View::TT hope this helps.. cheers, J David Schmidt wrote: Hello everyone I've just upgraded Catalyst from 5.7015 to 5.71001. If I start my project development server it loads but upon requesting any page I get the error: Caught exception in MyApp::View::myEmail-process Can't send email without a valid email structure at /usr/local/share/perl/5.10.0/Catalyst/Action.pm line 46 On the cpan site of C::V::Email the developer says that the config options have changed slightly but I cannot figure out wether the docs represent the new or old config style. http://search.cpan.org/~jshirley/Catalyst-View-Email-0.13/lib/Catalyst/View/Email.pm WARNING: since version 0.10 the configuration options slightly changed! This is were the error comes from in /Catalyst/View/Email.pm my $email = $c-stash-{$self-{stash_key}}; croak Can't send email without a valid email structure unless $email; but I have the stash_key configured in MyApp/lib/MyApp.pm __PACKAGE__-config( 'View::Email' = { stash_key = 'email', default = { content_type = 'text/plain', charset = 'utf-8' }, sender = { mailer = 'SMTP', mailer_args = { Host = 'test.smtp.at', # defaults to localhost username = 'blah', password = 'foo', ssl = 1 } } } }; and it also seems to be configured in MyApp/lib/MyApp/View/myEmail.pm __PACKAGE__-config( stash_key = 'email' ); well, that's it for now. thanks in advance for any pointers. david ___ 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] testing catalyst app - need context
Hi Kate, have a look at http://search.cpan.org/~jkutej/Catalyst-Plugin-CommandLine-0.05/lib/Catalyst/Plugin/CommandLine.pm I've only used it once or twice and I don't know if it's considered best practice or not but it worked for me.. (I wanted easy access to Catalyst app config) cheers, J package MyApp; use Catalyst qw/ CommandLine /; package main; use MyApp; my $c = MyApp-commandline; my $acc = $c-model('Account')-find(1); Kate Yoak wrote: Hi there, Here is a newbie question: I like to test my functionality in bits and pieces as I write it. How do I go about getting myself the context object in a test script? For example, one of the tests catalyst installs is t/model_App.t where it loads the model. I'd love to then be able to use the model the same way a controller would: my $acc = $c-model('Account')-find(1); Instead, I am doing my $model = MyApp::Model::App-new(); my $acc = $model-recordset('Account')-find(1); In addition to being less than ideal because I am doing something different that I expect real application code to do, it presents configuration problems. Like, turns out, in order for config to take effect, I have to run __PACKAGE__-setup; after configuring it - which won't be necessary, I think, in a real app. Is the practice of unit tests that break up the layers of catalyst frowned upon? Or what should I do to make it work right? Thanks for the help! Cheers, Kate ___ 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/