[Catalyst] PageCache clear cached page
HEllo! I' trying to cleaner for cached page as shown in http://dev.catalyst.perl.org/wiki/SolvedIssues#si.20 Exempting specific pages from cacheing. I've create MyApp.yml: ... page_cache: expires: 60 set_http_headers: 1 auto_cache: - (?!.*/(debug|expire)\z).* # cache everything but requests ending in /(debug|expire) and added some constructions to my Root.pm: sub begin : Private { my ( $self, $c ) = @_; if ($c-config-{page_cache} $c-req-path =~ m#(.*)/expire$#) { $c-clear_cached_page( '/' . $1 ); } } I run myapp_server.pl After run pages autocaches, but it wont to get extra content (such as CSS or images) And using of /expire on root http://localhost:3000/expire get 404 error defined by me in Root.pm On other pages such as http://localhost:3000/network/expire - it work with errors, Network.pm Controller want input parameter (int) net_id (http://localhost:3000/network/1) so expire work and after that controller reports an error wrong param (it's passed to database and query witn wrong param fails ) Where is my mistake? -- dr.eel ___ 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] index and default actions
On Tue, Jan 29, 2008 at 06:29:50PM -0500, Len Jaffe wrote: Matt Trout wrote: I foresee index and default going the fuck away for 5.80 unless you're in compat mode. Why is that? For the reasons already discussed at length up-thread. If any of it needs clarifying, ask a more specific question. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Directorhttp://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/ ___ 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 server response times.
On Jan 30, 2008, at 10:23 AM, Roderick A. Anderson wrote: Ian Docherty wrote: I have moved (back) to using the built in Catalyst server for testing purposes. It is frequently (but not always) taking 20 seconds or so to display a page in my browser even though the timings reported by the Catalyst server are about 0.2 sec. so I know that it is not the Catalyst app that is causing the delay. Having read the other postings on this I wonder if you have a large- ish css or Javascript file being loaded. I've noticed a bit of a delay when I was trying the Ext2.js examples from the Ext2 site. This delay is related more to the complexity of the javascript than it's size. It's essentially the compile-time penalty of the library in use, ExtJS is one of the bigger ones that I've noticed it on, it can take quite a while for it get loaded/decompressed/setup and ready to go. It's much faster when using a release version rather than a testing version, and there are tools that will let you build custom ExtJS versions with just the features you are actually using included, so you don't have to wait for initialization for features you aren't using. -- Jason Kohles, RHCA RHCDS RHCE [EMAIL PROTECTED] - http://www.jasonkohles.com/ A witty saying proves nothing. -- Voltaire ___ 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 server response times.
Hi Ian doing a 'host' command on an IP address works instantly and the contents of the /etc/resolv.conf file look to be correct. Could it be a problem with specific IP addresses rather than with the nameservers? (I can't cause a problem manually with the IP addresses I know the Catalyst app is run from). There are a few things you could try to narrow the problem. 1. You're definitely running the server without flags? i.e. $ perl script/myapp_server.pl The -k and -d flags slow it down a lot. 2. You've got the latest code? $ cpan Catalyst::Devel 3. Use the debugger to see where the program is $ perl -d script/myapp_server.pl Fire up a request from your browser. If it's slow, press CTRL-C to break in the debugger and use 'v'iew, '.' and 'T'race to see where you are. It may seem hit and miss but it's a quick way to see where the program is at. You can use 'c'ontinue to complete dispatching. Some more notes at http://catwiki.toeat.com/fromtrac/debugsample 4. Use DProf to profile a couple of requests. $ PERL5OPT=-d:DProf perl script/myapp_server.pl Do a few requests in your browser $ dprofpp Will show you which routines are eating up time. 5. Use a browser debugging tool like Fiddler2 in IE http://www.fiddlertool.com/fiddler/ or Charles in FF http://www.xk72.com/charles/ if you suspect there's some browser - server idiocy going on. See when the request is sent, see when the header comes back. See how long it takes to get the ancillary .css .js .jpg files. That will indicate whether it's a network problem, the server, or simply slow javascript. Regards, Peter http://perl.dragonstaff.co.uk ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst test server response times.
On Wed, Jan 30, 2008 at 10:41:35AM +, Ian Docherty wrote: Ash Berlin wrote: On 30 Jan 2008, at 09:51, Andrew Payne wrote: On Jan 30, 2008 9:14 AM, Ian Docherty [EMAIL PROTECTED] wrote: It is frequently (but not always) taking 20 seconds or so to display a page in my browser The only times I've had this happen, it's been DNS issues -- in my case, dhcpd putting a duff entry in resolv.conf YMMV, but worth checking. Andrew Also possible is that the Catalyst test server is trying to lookup your reverse DNS. Are you running with or with out debug enabled on the builtin server? I have also tried running a Catalyst app from another server and it does not have the same delay. I am running with debug enabled. (what difference will that make to my issue?) I have also tried it with the IP address in the URL so that DNS is not (should not be ?) used. hang on... 'reverse' DNS? YUP. turning debug mode off has a *big* difference. so, what is this reverse DNS thingy doing and how can I turn it off but leave the other debug on? http://en.wikipedia.org/wiki/Reverse_DNS_lookup Incidentally, you are not RMS, so I see no reason why you need to send mail to read google for you. Please stop asking trivial, unrelated questions on the list, it's a bit unfair to expect people to do basic research for you - I'd have left it if you only did it occasionally but it's becoming a habit and I'm hearing people bitch about it regularly now. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Directorhttp://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/ ___ 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 server response times.
Jason Kohles wrote: On Jan 30, 2008, at 10:23 AM, Roderick A. Anderson wrote: Ian Docherty wrote: I have moved (back) to using the built in Catalyst server for testing purposes. It is frequently (but not always) taking 20 seconds or so to display a page in my browser even though the timings reported by the Catalyst server are about 0.2 sec. so I know that it is not the Catalyst app that is causing the delay. Having read the other postings on this I wonder if you have a large-ish css or Javascript file being loaded. I've noticed a bit of a delay when I was trying the Ext2.js examples from the Ext2 site. This delay is related more to the complexity of the javascript than it's size. It's essentially the compile-time penalty of the library in use, ExtJS is one of the bigger ones that I've noticed it on, it can take quite a while for it get loaded/decompressed/setup and ready to go. It's much faster when using a release version rather than a testing version, and there are tools that will let you build custom ExtJS versions with just the features you are actually using included, so you don't have to wait for initialization for features you aren't using. I am using extjs and realised that this could be an issue but I created a brand new minimal Catalyst application and I saw the same issues. Also I used wget to get the web page, which of course does not execute the javascript. The 15 second long delay is prior to the Catalyst debug information being printed. The actual execution of the various controllers is very quick (sub 0.3 seconds) If I use CATALYST_DEBUG=0 then the problem goes away. Lately, the problem has gone away even without turning debug off. One possibility I am still investigating is that the problem only occurs if two or more developers are running a server at the same time. (jury is still out on this) Regards Ian ___ 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 server response times.
* On Wed, Jan 30 2008, Ian Docherty wrote: My bad. Heard and understood. (by the way who is RMS?) Google. It. Regards, Jonathan Rockway ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst test server response times.
Jason Kohles wrote: On Jan 30, 2008, at 10:23 AM, Roderick A. Anderson wrote: Ian Docherty wrote: I have moved (back) to using the built in Catalyst server for testing purposes. It is frequently (but not always) taking 20 seconds or so to display a page in my browser even though the timings reported by the Catalyst server are about 0.2 sec. so I know that it is not the Catalyst app that is causing the delay. Having read the other postings on this I wonder if you have a large-ish css or Javascript file being loaded. I've noticed a bit of a delay when I was trying the Ext2.js examples from the Ext2 site. This delay is related more to the complexity of the javascript than it's size. It's essentially the compile-time penalty of the library in use, Slap goes the hand to the forehead! Of course I exclaim! ExtJS is one of the bigger ones that I've noticed it on, it can take quite a while for it get loaded/decompressed/setup and ready to go. It's much faster when using a release version rather than a testing version, and there are tools that will let you build custom ExtJS versions with just the features you are actually using included, so you don't have to wait for initialization for features you aren't using. Thanks. I've been looking into ExtJS. This will help a bunch. Rod -- --Jason Kohles, RHCA RHCDS RHCE [EMAIL PROTECTED] - http://www.jasonkohles.com/ A witty saying proves nothing. -- Voltaire ___ 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] Malformed class Name Hidden files
Greetings. I am trying to get started with catalyst and am running into slightly annoying problem. I am working though Catalyst::Manual::Tutorial and when it comes time to start the web-server I get this error: Malformed class Name MyApp::Model::._MyAppDB at /usr/local/perl5.8.3/ lib/site_perl/5.8.3/Catalyst.pm line 1875 Compilation failed in require at script/myapp_server.pl line 53. I have traced this down to the fact that my text editor (TextMate) likes to leave hidden files around with similar names as those being edited. For example the above error says something about ._MyAppDB where this a file named MyApp/lib/MyAppDB.pm AND a file MyApp/ lib._MyAppDB.pm If i delete the ._* file the server will launch and everything works fine. My question is: Is there a way I can tell the scripts to ignore hidden files? thanks in advance -Rajeev Cyrus ___ 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] Malformed class Name Hidden files
On Wed, 30 Jan 2008, Jonathan Rockway wrote: I have traced this down to the fact that my text editor (TextMate) likes to leave hidden files around with similar names as those being edited. For example the above error says something about ._MyAppDB where this a file named MyApp/lib/MyAppDB.pm AND a file MyApp/ lib._MyAppDB.pm If i delete the ._* file the server will launch and everything works fine. My question is: Is there a way I can tell the scripts to ignore hidden files? This issue has come up at least 129387 times in the past. Please read the archives. Yes, unfortunately it's never been freaking fixed, which is why it's come up 129387 times (at least). I did submit a patch to Simon Wistow for Module::Pluggable in September. It made Module::Pluggable ignore editor junk files by default, though it didn't catch ._* files (easy enough to add). Unfortunately he never responded. And yes, editors delete the files when they're closed, but in the case of Emacs, it creates such files _while_ you're editing a buffer, and it's easy to have your Cat dev server try to load these. So maybe someone can either A) poke Simon or B) we could subclass Module::Pluggable and add the fix in there or C) yell at people who complain about it on the list because they expect the software to do the right thing. -dave /*=== VegGuide.Orgwww.BookIRead.com Your guide to all that's veg. My book blog ===*/ ___ 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] Malformed class Name Hidden files
* On Wed, Jan 30 2008, Dave Rolsky wrote: Yes, unfortunately it's never been freaking fixed, which is why it's come up 129387 times (at least). I did submit a patch to Simon Wistow for Module::Pluggable in September. It made Module::Pluggable ignore editor junk files by default, though it didn't catch ._* files (easy enough to add). Unfortunately he never responded. I've also fixed this about 128745 times inside Catalyst (one of my first ever posts to the mailing list, in fact), but it keeps getting reverted. In fact, I think I applied your patch a while ago, but was asked to revert it. I vote to hack around this in Catalyst until it's fixed upstream. This has gone on long enough. /me puts on his fire suit. Regards, Jonathan Rockway ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] Catalyst test server response times.
Just giving my recommendation for what in my opinion is an ESSENTIAL tool for any web developer or even power user Firebug for Firefox https://addons.mozilla.org/en-US/firefox/addon/1843 . Best overall tool I have found. Lets you debug JavaScript, inspect elements and their dom properties, lets you modify anything live and see the change, displays http requests with both post data and returned data, shows response times for each request item, profiles JavaScript on page, list just goes on and on. Great for design, debugging, and security. Thanks, -- Ali Mesdaq (CISSP, GIAC-GREM) Security Researcher II Websense Security Labs http://www.WebsenseSecurityLabs.com -- -Original Message- From: Peter Edwards [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 30, 2008 8:00 AM To: 'The elegant MVC web framework' Subject: RE: [Catalyst] Catalyst test server response times. Hi Ian doing a 'host' command on an IP address works instantly and the contents of the /etc/resolv.conf file look to be correct. Could it be a problem with specific IP addresses rather than with the nameservers? (I can't cause a problem manually with the IP addresses I know the Catalyst app is run from). There are a few things you could try to narrow the problem. 1. You're definitely running the server without flags? i.e. $ perl script/myapp_server.pl The -k and -d flags slow it down a lot. 2. You've got the latest code? $ cpan Catalyst::Devel 3. Use the debugger to see where the program is $ perl -d script/myapp_server.pl Fire up a request from your browser. If it's slow, press CTRL-C to break in the debugger and use 'v'iew, '.' and 'T'race to see where you are. It may seem hit and miss but it's a quick way to see where the program is at. You can use 'c'ontinue to complete dispatching. Some more notes at http://catwiki.toeat.com/fromtrac/debugsample 4. Use DProf to profile a couple of requests. $ PERL5OPT=-d:DProf perl script/myapp_server.pl Do a few requests in your browser $ dprofpp Will show you which routines are eating up time. 5. Use a browser debugging tool like Fiddler2 in IE http://www.fiddlertool.com/fiddler/ or Charles in FF http://www.xk72.com/charles/ if you suspect there's some browser - server idiocy going on. See when the request is sent, see when the header comes back. See how long it takes to get the ancillary .css .js .jpg files. That will indicate whether it's a network problem, the server, or simply slow javascript. Regards, Peter http://perl.dragonstaff.co.uk ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ Protected by Websense Messaging Security -- www.websense.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Malformed class Name Hidden files
On Wed, 30 Jan 2008, Jonathan Rockway wrote: * On Wed, Jan 30 2008, Dave Rolsky wrote: Yes, unfortunately it's never been freaking fixed, which is why it's come up 129387 times (at least). I did submit a patch to Simon Wistow for Module::Pluggable in September. It made Module::Pluggable ignore editor junk files by default, though it didn't catch ._* files (easy enough to add). Unfortunately he never responded. I've also fixed this about 128745 times inside Catalyst (one of my first ever posts to the mailing list, in fact), but it keeps getting reverted. In fact, I think I applied your patch a while ago, but was asked to revert it. Yes, you did. My patch could probably be redone as a Module::Pluggable::Object subclass or something if that'd be more palatable. My original Catalyst patch was much more blunt. I vote to hack around this in Catalyst until it's fixed upstream. This has gone on long enough. ++ for all the say I have ;) -dave /*=== VegGuide.Orgwww.BookIRead.com Your guide to all that's veg. My book blog ===*/ ___ 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] Submitting Multiple Arrays
http://cpansearch.perl.org/~jrobinson/DBIx-Class-0.08009/lib/DBIx/Class/Ordered.pm#Unique_Constraints might be applying to you, and if not, Ordered might help you. - andreas On 31. jan.. 2008, at 02.35, Jay Varner wrote: In short, I'm new to Catalyst and a near intermediate Perl programmer. I've converted (and vastly improved) my app from CGI::Application to Catalyst within an amount of time that made me feel like I wasted those months I spent prior to using Catalyst. However, the past few days I have been struggling with this one function that I just can't get. Honestly, I feel the easiest way for me to explain is to say that this headache began by me trying to translate this bit of PHP code to Perl/Catalyst: http://www.gregphoto.net/index.php/2007/01/16/scriptaculous-sortables-with-ajax-callback/ I'm just stuck. I've tried many things. My current/pressing attempt to implement this is in a newsletter app where there is a has many relationship between a Newsletter table and a table for Articles. The join table has 3 columns – newsletter_id, article_id and ordering. So I want to use that PHP and Ajax to allow a user to set the order that articles will appear in a given newsletter. However, some articles might appear in multiple newsletters. I might be going about this all wrong and I would love to hear any suggestion of a better way. For what it is worth, here is my current effort. I don't know if this is the closest I've gotten, but it's where I'm at right now. This is not actually my attempt at the the above, it's really just a scaled back attempt to just figure out the DBIx for it begin sent by a basic HTML form and not any Ajax shenanigans. sub reorder : Local { my ($self, $c ) = @_; # This just gets the the value for the later redirect to stay on the same page my $link = $c-request-params-{link}; # This is from a hidden value in a loop in the template [% article.id %] my @articles = $c-request-params-{article_id}; # Value for the newsletter we're working on. Again, this is from a hidden value my $newsletter_id = $c-request-params-{newsletter_id}; # This is obviously where I start trying shit to see if I can get it to work # The basic goal is to drop in the new value for ordering for each unique # article_id and newsletter_id in turn foreach my $article ( @articles ) { my $newsletter = $c-model('SASSDB::ArticleNewsletter')- search( { article_id = $article, newsletter_id = $newsletter_id } ); my @orderings = $c-request-params-{ordering}; foreach my $ordering ( @orderings ) { $newsletter-update( { ordering = $ordering } ); } } $c-response-redirect($c-uri_for(/admin/newsletters/ picked_articles/$link)); } This reasonably gives me the following: DBIx::Class::ResultSet::update(): DBI Exception: DBD::mysql::st bind_param failed: Illegal parameter number [for Statement UPDATE articles_newsletters SET ordering = 1 WHERE ( ( ( article_id = ? ) OR ( article_id = ? ) ) AND newsletter_id = ? ) with ParamValues: 1='12', 0='2', 2='18'] at ../lib/SASS/Controller/Admin/Newsletters.pm line 200 Line 200 is $newsletter-update( The body_parameters are: body_parameters = { _submit = Update, _submitted_edit_menu = 1, _submitted_form_create = 1, article_id = [12, 18], id = 1, link = Test, newsletter_id = 1, ordering = [1, 2], }, Let me know if you want to see anything else. Humbly placing myself on the mercy of the community, Jay ___ 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] Submitting Multiple Arrays
I don't know if it'll solve all your problems, but this is definitely wrong: my @articles = $c-request-params-{article_id}; ... foreach my $article ( @articles ) { You're assigning an arrayref to the first item in @articles. Do this instead: my $articles = $c-request-params-{article_id}; # if there was only 1 article_id submitted, it won't be an arrayref # make sure it's an arrayref, so the loop below doesn't break $articles = [$articles] if ref $articles ne 'ARRAY'; # dereference the arrayref for my $id (@$articles) { ... } Carl ___ 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/