Re: [Catalyst] No data showing
Surely that should be [% account.department_id %], etc. All the best Stuart On 2012-04-27, at 10:50 AM, Kenneth S Mclane wrote: [% accounts.department_id %] ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] How best not to use the system perl
Perl 5.10 isn't really supported any more, so it is highly likely that at some stage the system Perl will get upgraded behind the scenes, breaking binary compatibility with modules even if they are in local::lib. The only safe solution is to use your own Perl (I'd not put it directly under /usr/local, but somewhere application specific, but then I am fairly paranoid). That way, no surprise upgrades will break your application. All the best Stuart On 2011-09-30, at 10:39 AM, Dermot wrote: Hi, I have got a new server that I want to put into production. To comply with the manufacturer, I have installed RedHat 6.1 on it. Up till now we have used Debian based machines and have been using the system perl. That worked ok because all the necessay libperl*.deb could be installed via the package manager. That's not an option with yum. I know using the system perl is frowned upon by some so I'd like to do the right thing before the server is deployed. AFAIK, there are two options; 1) install a perl from source into somewhere like /usr/local and set-up the environment so that's the perl that's used or 2) use the system perl (5.10.1) and local::lib. I'm sure there are others with my hardware set-up and I'd be interested in hearing what approached they've taken. Similarly if there are other options to consider or there are strong reasons for using one approach over an other, I'd appreciate hearing them. Thanks, Dermot. ___ 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] Running system commands under FastCGI with IPC::Cmd / IPC::Run
You may want to check your version of FCGI. There are previous reports of related issues, which seem to be an interaction between IPC::* modules expectations of standard input/output/error, and FCGI, which fakes them. See http://www.mail-archive.com/po...@openbsd.org/msg16948.html for an example. In my FCGI, the FILENO method is present, but this appears to have been added in version 0.67_01 on 20 Dec 2009 - this is pretty recent and your Perl may not include it. --S Stuart Watt ARM Product Developer Information Balance On 10/21/2010 2:43 PM, Ian Sillitoe wrote: I have a Catalyst model that runs a system command as part of a search facility. The system call only takes a fraction of a second so is processed inline and this all works fine when tested outside of Catalyst and when called under the Catalyst standalone server. However, when I deploy it to my FastCGI environment I have problems - everything seems to work fine apart from the results of the system call. The system call is (give or take): IPC::Cmd::run( command = [qw/ blastall -d sequences.db -i input.fa -o output.results /], verbose = 0, timeout = 10, ); When run under the test server the file 'output.results' contains the results of the search: gi|5524211|gb|AAD441661|pdb|3cx5C00 45.26 285 154 1 1 283 91 375 4e-73267 gi|5524211|gb|AAD441661|pdb|2e74A00 33.33 99 65 1 21 118 117 215 9e-16 77.0 gi|5524211|gb|AAD441661|pdb|2ih2A01 34.78 23 15 0 115 137 85 107 4.0 25.0 ... When the same application is being run under FastCGI the file is created but is empty. The system call was originally being wrapped with IPC::Cmd (via MooseX::Role::Cmd). I checked what happened when I explicitly used IPC::Run my ($in, $out, $err); my $success = IPC::Run::run [qw/ blastall -d sequences.db -i input.fa -o output.results /], \$in, \$out, \$err, IPC::Run::timeout( 10 ); This works under the test server, but throws the following error under FastCGI: |Can't locate object method FILENO via package FCGI::Stream at /home/ian/perl5/lib/perl5/IPC/Run.pm line 1115. | If I bypass IPC::* and run the system command with backticks then it seems to work fine under both the test server and FastCGI. However the system call is happening a long way away from Catalyst - I don't really want to hard code this with backticks just to get it working under FastCGI. There seems to be a few different things going on here - I'm not sure exactly where the problem lies or what might be a red herring - would be grateful if anyone can help point me in the right direction. Cheers, Ian Running FastCGI server on my desktop on port 3001: script/my_app_fastcgi.pl http://my_app_fastcgi.pl -l bsmlx53:3001 -n 3 -p my-app.pid -d Forwarding requests there from external facing server with the following config: VirtualHost *:80 ServerName test.foo.com http://test.foo.com DocumentRoot/home/ian/My-App/trunk/ ErrorLoglogs/test.foo.com-error_log FastCgiExternalServer /tmp/my-app.fcgi -host bsmlx53:3001 Alias /static /home/ian/My-App/trunk/root/static Alias / /tmp/my-app.fcgi/ /VirtualHost Modules: Catalyst::Runtime (5.80029) IPC::Run (0.89) FCGI (0.67) -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=7751128072.AE451 ___ 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] I18N
Thanks for the feedback. CatalystX::I18N looks like it is heading in the right direction, but it's testing status is pretty awful right now. I might well fix the worst of the issues, as this has Moosiness and other goodness. I looked at C::P::Localize::Simple and its big win is _MISSING_TERM_ . This is really what I need in C::P::I18N, but which I can't have because it uses Locale::Maketext::Simple, which forces the Auto mode lexicon behavior in an apparently non-overridable way, so missing values can never be detected. This sounds like a significant issue with Catalyst::Plugin::I18N, but which probably could be remedied by switching it to use Locale::Maketext::Lexicon. This would be a huge change, and I'd probably be the only beneficiary. However, I could be convinced to to fix it if this was considered worthwhile by others. C::P::I18N::PathPrefix looks cool, but it's a role that processes request paths, so it could in theory be combined with a variant on C::P::I18N that did the right thing. Unfortunately, the core C::P::I18N doesn't, quite. This isn't a URL/path issue. I know the debates, but we're dealing with an intranet system so clean URLs are preferred to international support. CatalystX::I18N does use Locale::Maketext::Lexicon, but may be hugely overcomplicated for what I actually need, and as I said, it's rarely passing tests -- although a look indicates this is mostly due to an erroneous internationalization in currency and a dependency on use parent which is not properly set in the dependencies on CPAN. I *think* what I need to do is either (a) fork C::P::I18N, or (b) fix CatalystX::I18N. However, given the Moose changes, I'm not sure which is a better approach. I'm guessing (b), but this is a guess. Stuart Watt ARM Product Developer Information Balance On 10/13/2010 6:35 PM, Kieren Diment wrote: On 14/10/2010, at 8:25 AM, Ekki Plicht (DF4OR) wrote: Am Dienstag 12 Oktober 2010, 22:04:23 schrieb Stuart Watt: Quick question: I'm currently using Catalyst::Plugin::I18N. Should I be planning to move to CatalystX::I18N? Any thoughts...? Stuart, I am in no way a Catalyst expert, just a mere beginner. And facing the same question :-) I played around with C::P::I18N, and it does perfectly what is says it does - l10n. But I want (need) more, like localized paths, for example. So I looked at C::P::I18N::Request which is perfect for that, but decides only on the browser header setting of accept-language, AFAICS. Which renders it useless for me. Then there is C::P::I18N::PathPrefix, which is a helpful and different approach. It comes in handy when path names are the same even for different languages, a situation which I have here in my current project. Localised paths can be done though configuration. See Chapter 7 of the Definitive Guide to Catalyst for details (p 187 - relevant snippet of code below, downloadable source for the book available from http://www.apress.com/book/view/1430223650) where I translated the uri paths into Indonesian: Controller People action get_ready PathPart nama /action /Controller Controller People::Info action get_info_ready PathPart siapa /action action create PathPart lagi /action action delete PathPart mengusir /action /Controller ___ 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/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=5077128085.81EFD ___ 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] I18N
Quick question: I'm currently using Catalyst::Plugin::I18N. Should I be planning to move to CatalystX::I18N? Any thoughts...? --S -- Stuart Watt ARM Product Developer Information Balance ___ 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] Displaying template files without adding new controller actions
If it's a TT file you need (i.e., not static), along with appropriate processing, you can make a variation on Ben's suggestion by using the $c-request-arguments, and putting the file name into $c-stash-{template} before handing off to the TT view, which is likely to be the default. This is a slight variation on ben's suggestion, which will only hit the file system when looking at the right part of the URI space. I've not tested this, but it'd just look something like: sub dynamic : Local { my ($self, $c) = @_; my $args = $c-request-arguments(); $c-stash-{template} = join('/', @$args); }; This omits the error handling (assumes TT will take care of that) but should only handle requests that begin /dynamic. The arguments() method returns additional stuff after /dynamic in the requesting URL. I do something similar in my code (it's not precisely the same, as I retrieve the file contents through a model) and it works pretty well for us. For security, you probably want to remove stuff like .., just to be safe. All the best Stuart On 2010-10-11, at 11:14 AM, Ben van Staveren wrote: The other way to do it (and this is hackish), would be something like this: ... This is, however, very non-optimal since you are hitting the filesystem for every request that wasn't satisfied by an existing action. Like I said, you can either let the webserver serve up static pages. If you are worried about how the URL looks in the browser, some mod_rewrite magic will fix that for you, but that's a subject for another list :) ... Anthony Gladdish wrote: I want to add quite a few .tt2 pages to the app, in various directories. I don't want to have to create a Controller action per added template page ( this is the only way I know of adding a web page to a Catalyst app ). Every time I add a new page I'll have to add a new action to represent that page then restart the server. There must be a way to add as many template pages as required, and have a single Controller action display the web page if it's corresponding template exists, otherwise 404. ... -- Ben van Staveren phone: +62 81 70777529 email: benvanstave...@gmail.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] Remote authN not getting username from remote_user()
On 9/22/2010 7:40 PM, Trevor Leffler wrote: Hi, I'm using: Catalyst::Runtime -- 5.80022 Catalyst::Plugin::Authentication -- 0.10016 I'm finding that C::Request-remote_user is not returning my username when I have authenticated under apache, whereas the deprecated C::R-user does. Are you using SSL? Looking at the code, this can affect the environment variables used to transmit the remote name. All the best Stuart -- Stuart Watt ARM Product Developer Information Balance ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] How to share a database connection across multiple Catalyst apps?
Sounds like a job for DBD::Proxy or DBD::Gofer, not that I've ever used them, and I have no idea whether they would play nice with DBIC -- the DBIC folks would have a better grasp on that question. That would leave the Catalyst parts unchanged apart from configuration, which would be a good thing architecturally. --S Stuart Watt ARM Product Developer Information Balance On 9/8/2010 10:54 AM, Simon Miner wrote: Thanks for the responses, Jason, I don't think reducing the number of database connections will hurt responsiveness. Even though there are 3 separate Catalyst apps, each HTTP request will only involve one of them (since they all run out of the same web server), so there should never be contention between the apps for the shared database connection. Does this make sense? Tom and Nicholas, I wish this was premature optimization, but my organization has experienced serious performance issues in the past related to multiple (Oracle) database connections per HTTP server process. Extra Oracle connections are expensive to maintain, particularly on the database server, and so we've tried to ensure that a single server process only has a single connection to a given database (since that's all it should need at any given time). I've attached a Devel::NYTProf screenshot for one of the server processes I profiled this morning. Looks like it confirms the multiple database connections. So back to initial question -- How do I update the models of my three Catalyst apps to share a single Oracle database connection? Thanks again. I really appreciate your feedback. Simon On Tue, Sep 7, 2010 at 11:40 PM, Nicholas Wehr catal...@bionikchickens.com mailto:catal...@bionikchickens.com wrote: I'm with Tom on this one. Unless you've narrowed all optimization efforts and this is all you have left - it could be worth a try.. but as Jason points out, you may not gain a thing. I'd recommend profiling your code and tracking down performance issues from that base level. Please post your results - I've very curious! -nw On Tue, Sep 7, 2010 at 7:21 PM, Tomas Doran bobtf...@bobtfish.net mailto:bobtf...@bobtfish.net wrote: On 7 Sep 2010, at 18:59, Simon Miner wrote: All three of these apps run under a single Apache 1.3.42/mod_perl 1.31 server. Wow, mod_perl 1 Ok then :) It appears that each server process creates a unique database connection variable for each of these apps. Although these database connections get reused from request to request, I would like to make things even more efficient by having a single database connection variable per server process which gets shared across all 3 Catalyst apps. Why do you think that this will help or affect anything? I.e. is this not premature optimisation? Cheers t0m ___ List: Catalyst@lists.scsys.co.uk mailto: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 mailto: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/ -- -- Simon -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=7897728072.B3B1D ___ 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] Confused: how to handle system-level errors with fallback pages
On 8/31/2010 6:03 AM, Eden Cardim wrote: Have you read Catalyst::Manual::Cookbook? Yes - that was the first place I looked. Obviously. As far as I can tell, from observed behaviour and from inspecting the code, an error in the prepare phase does not generate any response. I simply get an empty reply. I have checked this using curl as well as a browser. Errors later on seem to work fine. The Catalyst::Action dispatch method does use the execute wrapper. However, I can find no error protection for the prepare phase. Since this issue is caused by a plugin failing during that phase, I get no error display through the browser. Tried from curl, I get: C:\workspace\ARMcurl http://localhost:3000/index curl: (52) Empty reply from server I suggest this is a serious issue, but I cannot claim to have a strong enough grasp of the overall architecture to suggest how to resolve it successfully. --S Stuart Watt ARM Product Developer Information Balance On 8/31/2010 6:03 AM, Eden Cardim wrote: Stuart == Stuart Wattsw...@infobal.com writes: Stuart !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Stuart Transitional//EN I have a timing/configuration issue, and Stuart any pointers would be welcome. Stuart The problem: how to handle configuration/system errors Stuart by fallback to an error page. [snip] Stuart I could just be missing some documentation: maybe this Stuart is covered but I haven't been able to find it. ___ 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] Confused: how to handle system-level errors with fallback pages
Looks like I was wrong in where the error occurred, although the main issue is unchanged. The problem is in finalize rather than prepare. On 8/31/2010 10:08 AM, Bill Moseley wrote: Even the top-level handle_request is wrapped in an eval, but it tests $@ instead of the return value of eval like it should. Is it possible something is clearing the $@ var? It's pretty easy to edit Catalyst.pm to check. I hadn't seen the eval return value issue, although you're right. The error is reported on the console just fine. The problem is, that is the *only* place it is reported. The eval wrapper causes the finalize to be partially skipped. Here's the stack trace at point of failure (more or less): $ = ARM::Model::User::get_session_store_delegate(ref(ARM::Model::User), 'fbc69cb40a085cae169b26034f64832d12a9c305') called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Session/Store/Delegate.pm' line 56 $ = Catalyst::Plugin::Session::Store::Delegate::get_session_store_delegate(ref(ARM), 'fbc69cb40a085cae169b26034f64832d12a9c305') called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Session/Store/Delegate.pm' line 40 $ = Catalyst::Plugin::Session::Store::Delegate::session_store_delegate(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Session/Store/Delegate.pm' line 94 . = Catalyst::Plugin::Session::Store::Delegate::store_session_data(ref(ARM), 'expires:fbc69cb40a085cae169b26034f64832d12a9c305', 1283271921) called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Session.pm' line 148 . = Catalyst::Plugin::Session::_save_session_expires(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Session.pm' line 106 . = Catalyst::Plugin::Session::finalize_headers(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/Catalyst.pm' line 1762 $ = Catalyst::finalize(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Compress/Deflate.pm' line 16 [other plugins here] $ = Catalyst::Plugin::Session::PerUser::finalize(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/MSWin32-x86-perlio/Class/MOP/Method/Wrapped.pm' line 48 ... $ = ARM::finalize(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/Catalyst.pm' line 1927 So, the issue is: because I use Catalyst::Plugin::Session::Store::Delegate, my model methods are called in the finalize. These methods (based on my DBIC model class) die, and this drops all feedback, as finalize_headers is never completed and finalize_body never called. So I could overcome this by fixing my model to never fail - proxying off the DBIC class in some way to fake session handling on error. (Although I suspect this might be better part of Catalyst::Plugin::Session::Store::Delegate.) The problem is: finalize_headers is normally called after finalize_error, so even if I detect an error, there seems to be no way to go back and display that error. It seems to me that my model code ought to be able to fail in a reasonable way and get something displayed. --S Stuart Watt ARM Product Developer Information Balance -- Bill Moseley mose...@hank.org mailto:mose...@hank.org -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=BAC6E2807E.050DF ___ 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] Confused: how to handle system-level errors with fallback pages
Okay, I managed to rig up something that appears to work. All this goes in the main class. The intent is to call validate_components once, and use any error it generates as a value for $c-error() in all future requests. Any feedback or comments welcome. It could be a little cleaner, but any indication about whether the logic is sound would be very welcome. my $validated = 0; my $validation_error; sub validate_components { my ($c) = @_; return if ($validated); $validated = 1; # Now do the validation. Code that follows should croak if something is wrong. ... } around dispatch = sub { my ($orig, $c) = @_; my $result; my $error; my $eval_result; if (! $validation_error) { $eval_result = eval { $c-validate_components(); }; $error = $@; if ($eval_result || ! $error) { $result = $c-$orig(@_); } } if ($validation_error || (! $eval_result $error)) { $c-error($validation_error //= $error); } return $result; }; Stuart Watt ARM Product Developer Information Balance On 8/31/2010 10:50 AM, Stuart Watt wrote: Looks like I was wrong in where the error occurred, although the main issue is unchanged. The problem is in finalize rather than prepare. On 8/31/2010 10:08 AM, Bill Moseley wrote: Even the top-level handle_request is wrapped in an eval, but it tests $@ instead of the return value of eval like it should. Is it possible something is clearing the $@ var? It's pretty easy to edit Catalyst.pm to check. I hadn't seen the eval return value issue, although you're right. The error is reported on the console just fine. The problem is, that is the *only* place it is reported. The eval wrapper causes the finalize to be partially skipped. Here's the stack trace at point of failure (more or less): $ = ARM::Model::User::get_session_store_delegate(ref(ARM::Model::User), 'fbc69cb40a085cae169b26034f64832d12a9c305') called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Session/Store/Delegate.pm' line 56 $ = Catalyst::Plugin::Session::Store::Delegate::get_session_store_delegate(ref(ARM), 'fbc69cb40a085cae169b26034f64832d12a9c305') called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Session/Store/Delegate.pm' line 40 $ = Catalyst::Plugin::Session::Store::Delegate::session_store_delegate(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Session/Store/Delegate.pm' line 94 . = Catalyst::Plugin::Session::Store::Delegate::store_session_data(ref(ARM), 'expires:fbc69cb40a085cae169b26034f64832d12a9c305', 1283271921) called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Session.pm' line 148 . = Catalyst::Plugin::Session::_save_session_expires(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Session.pm' line 106 . = Catalyst::Plugin::Session::finalize_headers(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/Catalyst.pm' line 1762 $ = Catalyst::finalize(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/Catalyst/Plugin/Compress/Deflate.pm' line 16 [other plugins here] $ = Catalyst::Plugin::Session::PerUser::finalize(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/MSWin32-x86-perlio/Class/MOP/Method/Wrapped.pm' line 48 ... $ = ARM::finalize(ref(ARM)) called from file `C:/perl/site/5.10.1/lib/Catalyst.pm' line 1927 So, the issue is: because I use Catalyst::Plugin::Session::Store::Delegate, my model methods are called in the finalize. These methods (based on my DBIC model class) die, and this drops all feedback, as finalize_headers is never completed and finalize_body never called. So I could overcome this by fixing my model to never fail - proxying off the DBIC class in some way to fake session handling on error. (Although I suspect this might be better part of Catalyst::Plugin::Session::Store::Delegate.) The problem is: finalize_headers is normally called after finalize_error, so even if I detect an error, there seems to be no way to go back and display that error. It seems to me that my model code ought to be able to fail in a reasonable way and get something displayed. --S Stuart Watt ARM Product Developer Information Balance -- Bill Moseley mose...@hank.org mailto:mose...@hank.org -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=BAC6E2807E.050DF ___ 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/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=339762807E.4BF34 ___ List: Catalyst@lists.scsys.co.uk
[Catalyst] Confused: how to handle system-level errors with fallback pages
I have a timing/configuration issue, and any pointers would be welcome. The problem: how to handle configuration/system errors by fallback to an error page. * I am using Catalyst authentication, but sometimes the database used for session storage cannot be connected. Under these circumstances, I want an error page which can be used to display an error suitable for a system administrator * The application starts fine, because it does not attempt to connect initially * When a request starts, the session system fails during the prepare stage - calling stuff in Catalyst::Plugin::Session::Store::Delegate, and usually get_session_data * The application never gets to finalize, so nothing is ever sent to the engine - this is the logic in handle_request Where and how is it best to handle this? I could do some of this before the first request, and I considered hacking which controllers were active since I can do that during the setup stage, but this is probably too late, since by then all the plugins are set up, and this is where the session management is set. Alternatively, I could do some work during the request cycle, but it is not obvious where in the cycle you got to, which makes it hard to decide whether you can generate an error. I could just be missing some documentation: maybe this is covered but I haven't been able to find it. --S -- Stuart Watt ARM Product Developer Information Balance ___ 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] [Beginner] Understanding actions and controllers - not!
I've tended to use: link rel=stylesheet type=text/css href=[% c.uri_for('/static/css/main.css') %]/ I guess it depends on how it's being hosted, but I couldn't assume the top level URL space, so a straight absolute URL seemed a risk. All the best Stuart -- Stuart Watt ARM Product Developer Information Balance On 8/23/2010 5:17 PM, Ben van Staveren wrote: try using /static/css/main.css ;) ___ 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] rich ajax UI component libraries for Catalyst?
Dojo docs are still a bit weak as they completely changed to a different system, and more or less started documenting from scratch. The good news is that the test cases are *very* exhaustive and readable, so there is a lot to build on. The community is OK, but a little brusque from time to time. We also like the ability to roll your own Dojo and build smaller compressed systems containing the components you need. All the best Stuart Stuart Watt ARM Product Developer Information Balance On 7/26/2010 11:54 AM, Alexander Hartmaier wrote: I'm one of the guys using ExtJS with DBIC::API. I tried Dojo about two years ago and docs didn't exist for it, don't know if that has changed. jQuery UI is lacking a *lot* of widgets compared to ExtJS which is really awesome when it comes to subclassing components to build your own. -- Best regards, Alex ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Paging thru a complex POSTed search -- HOWTO?
We do a redirect code 303 from the POST request handler to a GET handler and page through it instead. This appears to be the HTTP 1.1 norm, and anything else is risky, as POST is expected to change stuff in the database. Paging through a POST result will (might) cause multiple changes. This way caching is supposed to be handled right. --S Stuart Watt ARM Product Developer Information Balance On 6/2/2010 1:56 PM, w...@serensoft.com wrote: Short version: Using [% c.req.uri_with({ page = pager.next_page }) %] is fine for a simple single-field search (where the form uses GET instead of POST)... but how do we PAGE through (and/or cache) a multi-field form search that uses POST? ___ 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] Paging thru a complex POSTed search -- HOWTO?
Actually, I'll elaborate our more detailed solution. 1. We don't actually use POST requests for search, but our GET requests have many fields and strange Dojo magic 2. We serialize the query with its many fields, using a bit of compression on the URI query string, and base 64 encoding, into a relatively opaque and relatively short token 3. This string is used by our search request handler, which unpacks the string and allows a pageable search by merging in a few additional fields (_page and _page_size) which are not serialized (that was underscore magic). Because the serialized/compressed search query token is opaque and you can't have two searches with the same query token, we use this as a cache key extensively for performance. We find this works well. Also, since we have a model object for the search (with serialize/deserialize) we can create views on it which allows us to generate nice textual descriptions of the search -- very handy for user feedback. And our users like to keep a history using these descriptions, so they can go back and look/run previous searches. The only problem would appear to be when the URLs become excessive for a GET request. When this happens, the POST can handle the form, generate the serialized/compressed search query bundle, and then hand off to the GET request with that instead. One caveat we hit was Microsoft's IIS rejected path elements in URLs which were more than 240 characters (bytes?) even the URL was sound. It probably thought they might be files. So we did pass stuff as query elements, as this seems to be more viable on Microsoft servers anyway. --S Stuart Watt ARM Product Developer Information Balance On 6/2/2010 1:56 PM, w...@serensoft.com wrote: Short version: Using [% c.req.uri_with({ page = pager.next_page }) %] is fine for a simple single-field search (where the form uses GET instead of POST)... but how do we PAGE through (and/or cache) a multi-field form search that uses POST? ___ 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] Alternatives to Catalyst ?
I was kind of hoping this thread would get to more helpful issues. It did, and thanks. It's hard for us to profile a running application, for several reasons. (1) there is a web server in the way, and (2) the storage requirements (and to some extent performance) are a hit. Also, a management requirement was obfuscation that turns off debugging hooks needed for NYTProf, so our production code cannot really be profiled. However, we do audit mean response times for each view, and I have a few bits of charting code in R that allow us to report on it. We actually run a test script that models a proper workflow. This happened because my colleagues require an old Perl tool webinject for QA. I ripped the back off webinject,. stuck Catalyst::Test in its place, and then run NYTProf on the whole thing. That way we have files that script a fairly realistic set of requests, and we can profile the whole bunch. Our requests vary a lot, with many simple ones and a few *really* complex ones, so I've used scales on charts that handle the long tail. As a side note, the Perl in webinject was somewhat hacky non-modern - I'd love a tool as good as JMeter. Thinking about it, if you can live with the Java interface, JMeter rocks. It is great at modelling large sets of users with randomised request times, and displaying how number of users affects response latency. For performance, I don't know of anything in the Perl world to touch it, but I'd love it if something did. This actually evolved as we work on a problem that is distinctive to our app under VMware ESX. We use using it to benchmark against VMware Server, which runs 3-4 times as fast as VMware ESX at the application level. There are *many* small differences between the two, although the big hit seems to be MySQL memory access (of all things). Some kind of DB issue showed up well in NYTProf, but other testing was needed to go further. Even a tool like NYTProf will not guarantee you can find the problem, because it may not be in Perl, let alone your app. --S -- Stuart Watt ARM Product Developer Information Balance Matija Grabnar wrote: Carl Johnstone wrote: NYTProf profile or it didn't happen :-) Is there any best practices or hints page on how to use Catalyst and NYTprof? I haven't used it before and I wonder if people include it into a running catalyst application (and then periodically review results in some way) or if they include it only into a just-for-profiling server which then runs a synthetic load? Or something in between? I've had some problems with a catalyst application lately, but it turned out that it was caused by the FCGI servers being swapped out: no ammount of tweaking my code would have solved it, all it took was an extra $10/month for another 256M RAM. ___ 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/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=43BA02807E.D8421 ___ 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] Alternatives to Catalyst ?
Part of the point, surely, is that we don't (want to) know what is inside $c/$c-request (or any other Catalyst structure). The direct hash could easily be a tied something-or-other inside, as is the case with CGI when you use the Vars accessor. So just because it looks like a direct hash, you can't from the outside assume it is more efficient. In CGI, for example, the tied hash accessors (if you use Vars) are defined in terms of the param method, so this mechanism is actually less efficient than using param calls directly. The point is: we can't/I wouldn't make assumptions about efficiency based on the appearance of code, at least not in a language like Perl where there can be so much magic behind the calling conventions. If there is a recommended way of doing this, I'd certainly want to know it. And it would probably help if that was efficient, but so long as it doesn't leak or expose internal hackery, it shouldn't really matter. And if it does, then it should probably be deprecated or documented so we can avoid problems. Perhaps it would have been better if the internal hash keys had been the usual private-style _parameters, etc., as that way everyone would know direct access as a no-no, because the accessors would work but not the direct access. --S -- Stuart Watt ARM Product Developer Information Balance ___ 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] Interaction between C::V::TT and C::P::Compress:Gzip?
Just come across an interesting possible interaction between Catalyst::View::TT and Catalyst::Plugin::Compress:Gzip. The finalize method in Catalyst::Plugin::Compress:Gzip is failing as the installed body reference is actually a Template::Exception. The result is a failure to display error messages if you use compression. This could be somewhere deep in my code as I know almost nothing about this stuff. Has anybody seen this one? If I get a chance to write a test for it, I will. All the best Stuart ___ 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] Interaction between C::V::TT and C::P::Compress:Gzip?
Tobias Kremer wrote: I've been seeing the same problem since we started using C::P::Compress::Gzip. Haven't had time to dig into it though... I am relieved it is not just me (or my new Perl 5.12 build). However, I can confirm that the problem does not exist with C::V::TT 0.31, TT 2.22, and C::P::Compress::Zlib 0.04. There are changes logged in C::V::TT in this area, so I guess that's where to look next. --S -- Stuart Watt ARM Product Developer Information Balance ___ 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] Global behaviour modification
We have a maintenance mode in our app which is kind of similar. We do this before calling the authenticate method, and our entire app is covered by authentication, so it isn't quite the same. But this does the conditional global redirect. I guess you could check the action more imaginatively - I do this just to avoid looping/recursion. All the best Stuart sub begin : Private { my ( $self, $c ) = @_; ... if ($c-action()-name() ne 'maintenance') { my $maintenance = $c-config()-{maintenance} || 0; if ($maintenance == 1) { $c-go('maintenance'); } } ... } On 2010-03-27, at 5:25 AM, Ovid wrote: --- On Sat, 27/3/10, Ovid publiustemp-catal...@yahoo.com wrote: From: Ovid publiustemp-catal...@yahoo.com I'm working on an app where users must authenticate (via CatalystX::SimpleLogin and a custom ActionRole). At times, users may engage in activity which temporarily makes it impossible to take any other action. Hypothetical example: users kick off a job which takes 5 minutes to run, so we restrict their ability to do *anything* else for that 5 minutes. Thus, it would be nice if I could globally redirect any authenticated user to something like /user/waiting/ or something like that. Er, actually that would be disallow any actions requiring authentication. Some portions of the (FAQs, for example) don't require authentication. Thus, if before execute was the way to go, I'd need to know whether or not the user is taking an action requiring authentication. Cheers, Ovid -- Buy the book - http://www.oreilly.com/catalog/perlhks/ Tech blog- http://blogs.perl.org/users/ovid/ Twitter - http://twitter.com/OvidPerl Official Perl 6 Wiki - http://www.perlfoundation.org/perl6 ___ 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 and wordpress
In what way is the under Catalyst? Is there any integration needed? If not, this sounds like all you need to do is configure your web server so that /blog = wordpress. Then your web server will simply peek the URLs and send all requests that begin /blog... to your PHP area, while everything else can fall through to Catalyst or whatever else you have installed. In this sense, /blog... is not under Catalyst control, but to the user they will look sort of integrated. The static files are not processed, just transmitted as is. So no PHP will get run on anything there. Although it might be possible to process them with PHP by running PHP from Catalyst, I am pretty sure you would not want to go there. All the best Stuart -- Stuart Watt ARM Product Developer Information Balance Charles wrote: I don't want to implement code for a blog. What's the easiest way to incorporate wordpress on my site under my single catalyst instance . I'm going to download the wordpress code and not have it hosted elsewhere. I'd like to have the blog like mydomainname.com/blog . I've got a root/static/images dir currently where my images live and the mydomainname.com/static/images/foo.jpg is all visible . I would think that the blog code could go in the static dir but doesn't seem to just work out of the box. Any hlp apprec as always. I'm running catalyst-runtime 5.7014 . -C ___ 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/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=184C62806D.6DEAF ___ 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] Scripts and @INC
Does anybody know if there any very good reason why the fastcgi.pl (and other) scripts move the application's lib folder to the front of @INC even if it is already in @INC but not at the front? I've just noticed that my carefully constructed path is being trampled. I depend on occasionally overriding the main application's lib folder with site-specific stuff, and I cannot do that with the current scripts. This is a workaround until we get certain old parts of the app ported to Moose, but would it not be more appropriate to only add the library on @INC if it is not there already. The line concerned seems to be in ScriptRunner.pm lib-import(File::Spec-catdir($FindBin::Bin, '..', 'lib')); Would this be better along the lines of: my $path = File::Spec-catdir($FindBin::Bin, '..', 'lib'); unless (grep { $path eq File::Spec-rel2abs($_) } @INC) { lib-import($path); } This is not tested, but seems the kind of intent needed. Any thoughts, feedback, alternative solutions welcome. --S -- Stuart Watt ARM Product Developer Information Balance ___ 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] datetime formatting ...
On 2010-02-13, at 4:51 PM, Octavian Rasnita wrote: Don't know how to get the time zone of the user from browser, but I think it is not possible. You might need to get the visitor's IP and use a service that can tell you his/her country or even city, and maybe there is a module that can translate that into DateTime time_zone rformat... We did this using JavaScript. Just create a Date object and call getTimezoneOffset on it. We actually do that twice, one for a summer date and one for a winter date. Then we look at both offsets and use that to guess a location (rather than just the current time offset). I can send the code if needed. The technique works pretty well, and gets the timezone pretty well. All the best Stuart ___ 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] Mocking for Catalyst testing
On 2010-01-16, at 10:31 PM, Tomas Doran wrote: I tend to just use Moose directly to construct mock classes for me: Things are improving, t0m. I tried use Class::MOP; use Class::MOP::Class; my $meta_refreshes = Class::MOP::Class-create('ARMAdmin::Model::Refreshes'); $meta_refreshes-add_method('get_profiles' = sub { die(Failed to get profiles); }); Then I start the app in the test framework. I'm just after getting the get_profiles mocked method called here, later I want it to return values I can test in the generated page. However, Catalyst then calls: Catalyst::Utils::ensure_class_loaded( $component, { ignore_loaded = 1 } ); The ignore_loaded seems to bypass everything and overwrite my newly mocked class just when I need it. I get the method redefined, and a warning about it. The comment in the code here says this is needed for some Schema::Loader functionality dependent on loading even when the class exists. Doesn't this make mocking impossible? The ignore_loaded = 1 setting seems a somewhat heavy assumption to make for all components. Can anyone offer a way around this that doesn't involve too much patching? All the best Stuart ___ 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] Mocking for Catalyst testing
Excellent!!! Just what I'd needed and never found - dunno why. I kind of improvised part of this (I used remote and local versions of a model elsewhere), but this work work just fine for me, and I can use it to simplify the other usages as well. I can then fake everything I need through configuration. All the best Stuart On 2010-01-17, at 8:56 PM, Tomas Doran wrote: On 17 Jan 2010, at 22:07, Stuart Watt wrote What I wanted to be able to do was mock out the remote job queue web service, so at least I could check out that the front end render stuff without to put an entire web server temporarily in place. Basically, I'd hoped to replace the model that implements the web service and check that the right stuff goes in and out. Right - and _THIS_ is why you implement your model classes outside of Catalyst, and bind them in. If you are using Catalyst::Model::Adaptor to bind an external class, then changing the implementation of the model class to a mock class in your test suite is a simple case of providing some config to change the name of the class which is adapted... Cheers t0m ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam.http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=358052807F.E175C ___ 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] Mocking for Catalyst testing
OK, so it's not solely a Catalyst question, but I'd be keen for any pointers on good tools for mocking when testing Catalyst applications. I'm not especially needing mocking databases, i.e., I've seen DBD::Mock, but I want to test using mocks of some other model components. The one that causes most grief is a web service client component. I have tests for this independently, and wanted to be able to test the Catalyst application using a mock for this, but having tried Test::MockClass and Test::Mock::Class neither seemed easy to get to work as a mock. Does anyone have a good recipe for mocking Catalyst components? Any suggestions for good tools/modules to use? All the best Stuart ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Model configuration through .yml
It certainly is possible. We do it that way, with two YAML config files. One has the schema_class (this is the one in the home area) and the second has the connect_info (I guess the typed connect_into is just a typo), which we put in a separate file in the site's directory, so we can run several sites, only changing the db connection info. I can't see an obvious explanation from these snippets, but it looks more like the module loading is the problem, not the configuration. Maybe check the modules load from a debugged Perl starting your app and then a manual use Schema::MyApp;? I've kind of gone off YAML for configuration, but since it took me 2 years to get my colleagues to edit them rather than raw Perl code, can't change now. --Stuart Emmanuel Quevillon wrote: Hi, I'd like to know something, probably a basic problem but just to be sure. Is it possible to configure Application db connection into .yml configuration file like : Model::MyAppDB schema_class: Schema::MyApp connect_into: - dbi:Pg:dbname=myapp - user - password - options Actually i tried this way but I cannot connect to the database, neither start my application, perl is not able to locate my schema class...!! Here is the error: Couldn't load class (Schema::MyApp) because: Couldn't instantiate component BiblioList::Model::MyAppDB, Can't locate Schema/MyApp.pm in @INC I can make it working if I add into Model::MyApp this : __PACKAGE__-config( ... ); I first did it, just adding 'schema_class' infos and leaving connect_info into config file and it works like a charm. However, the strange thing is that, other db connection I configured for other databases can connect correctly even if I use another Schema module like Schema::FooBarDB located under the same directory as Schema::MyApp For example in another confg file I load using C::Plugin::ConfigLoader::Multi I can define this Model::RemoteDB::AnotherDB: schema_class: Schema::FooBarDB connect_info: - .. and it connect correctly to my foobardb without throwing errors above. Is this normal behavior from Catalyst or is there something I am doing wrong or just a bug? Thanks for any hint. Regards Emmanuel ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=EDF782807B.A15EF ___ 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] Running Catalyst App from Command Line (or via Cron)
I always liked the solution used by Drupal of simply making cron use curl/wget/... to request a special URL. Then it becomes an action and is easy to code and configure almost on any platform. Long-running tasks (beyond that of an HTTP request) are a different matter. At present, we do this with our own task manager, which is basically nothing to do with Catalyst -- although it shares the code under the Catalyst model components. This creates the data needed by the app. This can take as long as it likes. We then have a quick switch, which updates the config and prods the web server to recycle its worker processes. It probably depends if you are adding data more or less monotonically to the current app, or more radically changing it. If it is a radical change to the data, I'd guess you'd need to close everything down cleanly and restart. All the best Stuart Christoph Friedrich wrote: Hello there, I need to build a script for my catalyst application that reads some data and put it into the database. This script needs to run as a daily cron job. My first idea was to create a controller which handles this for me and use some of the other engines for catalyst (like Catalyst::Engine::Embeddable or Catalyst::Engine::JobQueue::POE) but I'm not sure if this is a good way. Does someone of you have an idea how to make such a script? Maybe some Best Practices? Greets Christoph -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=327432806D.62AD5 ___ 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] Apache + mod_perl + Digest-SHA fails
You don't need FCGI::ProcManager under Windows. FCGI is enough, and it should install OK. FCGI::ProcManager is only used when you pass --listen as it runs FastCGI through TCP connections -- IIS uses named pipes so you don't want to pass any TCP-related stuff. I've run the latest Catalyst fine under Windows IIS with *only* the --keeperr passed (IIS can be funny about standard error, although there are more options relating to this in the 1.5 update to the IIS FastCGI component). IIS does the process management for you and allows control through the settings in the fcgiext.ini file. All the best Stuart On 2009-12-25, at 8:46 AM, Octavian Râsnita wrote: From: Tomas Doran bobtf...@bobtfish.net On 16 Dec 2009, at 22:16, Octavian Râsnita wrote: Using fastcgi under Windows is harder, and I don't even know if it can run as an ExternalServer. Yes, it totally can, however not on a local socket tcp-ip only. I thought I need to install FCGI::ProcManager in order to use fastcgi. I wasn't able to install this module under Windows, although I tried with both ActivePerl and Strawberry Perl. Octavian ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=2C57A2807C.22BB9 ___ 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] FastCGI fails with file extension mapped configuration for IIS
I've used an IIS hack engine for a good while, and finally got around to switching to the main C::E::FastCGI with a few issues. 1. It works fine, apparently on IIS5 2. It does not work, at least not the way I have it configured, on IIS6 The issue revolves around the IIS handling of some request parameters; I get: PATH_INFO: /m3analyst/arm.fcgi/index PATH_TRANSLATED: C:\Sites\ARM\arm.fcgi\index SCRIPT_NAME: /m3analyst/arm.fcgi Problem #1 - the condition is: ( $env-{SERVER_SOFTWARE} =~ /IIS\/[6-9]\.[0-9]/ ) This seems to explain why IIS5 is not affected in the same way. The FastCGI component works just fine on IIS5, so I guess this ought to be included/processed. Problem #2 - FastCGI engine cannot handle IIS with file extension mapped configuration for FastCGI Obviously, IIS is broken with respect to some request parameters. The algorthm for fixing IIS appears to be to pop items off a split PATH_INFO and a split PATH_TRANSLATED as long as they are the same, unshifting (!) the consistent items into a new value for PATH_INFO. Whatever was left on the old PATH_INFO is put into SCRIPT_NAME. The result of my request above, therefore, is: PATH_INFO = /arm.fcgi/index SCRIPT_NAME = /m3analyst Since this is incorrect against the namespacing, Catalyst hits the default action for everything. This ought to be: PATH_INFO = /index SCRIPT_NAME = /m3analyst/arm.fcgi My hacky IIS engine did a rather simpler: my $path = $env{PATH_INFO}; my $script = $env{SCRIPT_NAME}; my $length = length($script); if (substr($path, 0, $length) eq $script) { $env{PATH_INFO} = substr($path, $length); } i.e., I left SCRIPT_NAME alone, but removed it from the front of PATH_INFO when it matched exactly. The documentation implies that a wildcard mapping is recommended (although this is not supported by IIS5). I suspect the algorithm is completely correct on IIS6/7 with a wildcard mapping. Is this likely to require a patch to allow FastCGI to work with file extension mapping? Shall I write one? All the best Stuart -- Stuart Watt ARM Product Developer Information Balance ___ 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] Multiple deployments sharing code, data, and configuration
In our application, we have two parts - an indexing system that builds a set of databases, and a front end based on Catalyst. The issue we are facing is that each generated deployment runs almost exactly the same code, apart from needing different database references, and maybe a little additional Template-Toolkit stuff to provide custom logos, search configuration data, etc. What we ended up doing was using a new environment variable, *_SITE_ROOT, which points to an individual site's deployment base; this is effectively combined with *_HOME in a search path for TT files and for configuration files. On a few rare occasions we also add a local deployment lib directory @INC. This means we can maintain all the deployments in parallel, even when they contain different data. The only substantive change we needed was in our subclass of Catalyst::Plugin::ConfigLoader, which overrides find_files to try the SITE_ROOT directory first, then HOME, for each file previously identified - these are generally the config file with and without the local suffix. It's the only way we found of achieving a directory level separation between the local deployment and the shared code base. My question: is there an easier/better way to do this? If not, I'd be keen to turn this into a patch, and rename stuff where I get better suggestions. All the best Stuart -- Stuart Watt ARM Product Developer Information Balance ___ 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] Apache + mod_perl + Digest-SHA fails
Free to wrong pool is usually an issue with XS and threading. Digest::SHA is an XS module. Which Perl are you using? And how is it integrated into Apache? I've generally found FastCGI to be safer on Windows, simply because it doesn't require the tight integration of Perl into Apache under Windows. --S -- Stuart Watt ARM Product Developer Information Balance Ascii King wrote: I have an Apache 2.2.14 server with mod-perl 2.0.4 and Catalyst 5.80015 on a Windows XP machine. My system runs fine from the built-in Catalyst web server. When I run it through my Apache server, however it fails with the folowing error: [info] NPC powered by Catalyst 5.80015 Free to wrong pool 760e18 not 26fe70 at C:/Perl/lib/Digest/SHA.pm line 63 during global destruction. [Wed Dec 16 12:22:34 2009] [crit] (OS 6)The handle is invalid. : master_main: create child process failed. Exiting. The Digest::SHA is used to handle the login, of course. I have used the example from the tutorial. Any ideas why this is occurring? If I remove the call from the Schema/Result/Account.pm, it will run. __PACKAGE__-add_columns( 'password' = { data_type = TEXT, size= undef, encode_column = 1, encode_class= 'Digest', encode_args = {salt_length = 10}, encode_check_method = 'check_password', }, }; I was going to switch to blowfish, but I keep getting a 'bad bcrypt settings' error. I read that it is for Unix only though, so I guess I should have expected that. ___ 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/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=CF5252806D.4D760 ___ 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] Apache + mod_perl + Digest-SHA fails
Threading is possibly even worse on Windows. Any forking on Windows is really Perl threading as Windows doesn't have fork() as its process model. Are you using Randy Kobes' mod_perl for ActivePerl? I have not done that configuration for a while, but I did get it working once. Your other option is to compile your own Apache+mod_perl -- a bit of a challenge but certainly possible, and quite likely to resolve the problem. The problems arise because mod_perl has to plug the whole of Perl into Apache. This requires Apache and Perl to be compiled in ways that are partly compatible. mod_perl has some flexibility in this, but I always found it pretty troublesome, and in any event, the Perl threads on Windows will be within Apache processes. FastCGI allows you to move Perl processes outside Apache, so they are wholly independent of each other, and no longer require any binary compatibility. The downside is that you don't memory sharing, which you get with prefork, especially on platforms that have a proper process fork(). Unfortunately, Windows doesn't have that true fork(), so the memory sharing is only working because you are working in a single (Windows) process. Our Perl processes on Windows are not that big (they commonly start at VM sizes of 50-60Mb, and only get larger when we start the high-powered search systems we use). A decent server can easily accommodate 40 or so of these. Personally, on Windows, I'd stick with FastCGI. We've been using it for a year or more and it has survived some fairly large scale stress testing. --S -- Stuart Watt ARM Product Developer Information Balance Ascii King wrote: Stuart Watt wrote: Free to wrong pool is usually an issue with XS and threading. Digest::SHA is an XS module. Which Perl are you using? And how is it integrated into Apache? I've generally found FastCGI to be safer on Windows, simply because it doesn't require the tight integration of Perl into Apache under Windows. --S -- Stuart Watt ARM Product Developer Information Balance I have Perl v5.8.9 I suspected it was something to do with threads only because I couldn't figure out how threading or the pre-fork stuff was supposed to be set up on Windows. I thought I read though, that the threading issue didn't matter on Windows. I did have FastCGI working. I switched because the Catalyst Cookbook recommended mod_perl. I'll try that again. ___ 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/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=0E7092806D.D7113 ___ 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] Apache + mod_perl + Digest-SHA fails
Tomas Doran wrote: Er, no - your fcgi process manager loads the app and calls fork() for you, so you get memory sharing. Sorry, you're right - we're using a very limited process manager and it doesn't fork. We use some nasty nonthreadsafe legacy C code. Since on Windows both types of fork are emulated in Perl, whether in mod_perl or in the FCGI process manager, I guess the performance is almost equivalent. (Is this true? -- anybody benchmarked the two??) That just leaves the pain of setting up mod_perl. I used to do that, but I never really enjoyed it. --S Stuart Watt ARM Product Developer Information Balance ___ 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] Apache + mod_perl + Digest-SHA fails
Octavian Râsnita wrote: If you use ActivePerl under Windows, mod_perl can be installed from the TheoryX ppm repository and it doesn't require too much configuration. Using fastcgi under Windows is harder, and I don't even know if it can run as an ExternalServer. For Apache possibly. The mod_perl clone for IIS (ActiveState's PerlEx) is virtually unsupported and has (had?) low-level bugs; because it is closed source there is almost nothing you do can about them. We were therefore effectively forced into using FastCGI, which has certainly proven portable, scalable, and with acceptable performance even under IIS. (IIS, need I say it, was not our choice). IIS FastCGI support is now pretty good because of the Zend/Microsoft collaboration, although PHP is the principal beneficiary. Don't get me wrong - I was a big fan of Apache and mod_perl on Windows, I was compiling it for mission-critical applications in 2001 - applications which were still in use and running stable on the same server 8 years later!!! All the best Stuart -- Stuart Watt ARM Product Developer Information Balance ___ 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 benchmark 5.7 VS 5.8
Toby Corkindale wrote: (CentOS 5 was one of the operating systems that came with the badly-patched Perl with the slow bless performance.. although I'm sure it's been patched by now? ie. http://blog.vipul.net/2008/08/24/redhat-perl-what-a-tragedy/ ) This issue is still listed as open for Centos; http://bugs.centos.org/view.php?id=2357 I was surprised at this, but I had checked a couple of months back and no progress. I gave up on Centos in 1997 because of this, and am surprised how long this is taking. All the best Stuart -- Stuart Watt ARM Product Developer Information Balance ___ 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] Creating Catalyst Models from MSSQL
Amiri Barksdale wrote: I also seem to remember reading or hearing that DBD::ODBC may be a better solution for MSSQL, but don't quote me on that We use DBD::ODBC for MSSQL with little problem. The main issue was to get quoting right. We enabled portability by getting MySQL to use ANSI quotes, and using the following (we use YAML) configuration when talking to MSSQL: connect_info: - 'dbi:ODBC(dbi_connect_method=connect_cached):Driver={SQL Server};Server=localhost;database=armdb' - 'username' - 'password' - AutoCommit: 1 - quote_char: '' name_sep: '.' The additional quote_char and name_sep args were required to get DBIC to do the right thing. All the best Stuart -- Stuart Watt ARM Product Developer Information Balance ___ 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] address mismatch warnings?
This does happen, most commonly when a site uses a load-balancing proxy setup. According to the docs, this should not be happening by default, but is enabled through the verify_address key for the session configuration. On larger sites I've worked with, I ended up turning off IP address verification as it was causing more problems than it was worth (repeated login prompts). See the Caveats in the perldoc for Catalyst::Plugin::Session. All the best Stuart Phil Mitchell wrote: I am getting a surprising number of these warnings in the error logs: Deleting session b00b8b9d82da06a738cd7fe4d57760d8a8d69cd5 due to address mismatch (146.229.203.46 != 64.255.180.21) Is this something I should be concerned about? I've never really known how this is possible (client IP changes? user is roaming?) -- Stuart Watt ARM Product Developer Information Balance ___ 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] Database-backed sessions: Session::Store::DBI/DBIC and MSSQL
On 18-Jun-09, at 4:01 AM, Tomas Doran wrote: Any session data at all? Can you be more specific - I'd guess that this should only hit you if the length is small, or if your sessions get large. No, the sessions were tiny, more or less all they held was the id for which project the user was working on. The field allocated was text type, and it looks like MSSQL basically throws a truncation error for long type, no matter how much data was actually in there. DBI permits this. This was something of a surprise. If I'd declared the type as a VARCHAR of some kind, I'd have got away with it. Unfortunately, you can't get away from the need to make a separate connection as easily. Also, is there a different data type you can use without this behavior? (One that at least fails rather than silently truncating stuff would be good, for a start).. Yes, a VARCHAR(4000) or so would probably do fine for my purposes. Although my actual solution was C::P::Session::Store::Delegate with some additional logic to delegate to my existing user data model, which has a bunch of non-session stuff. This eventually worked well, when I finally figured the requirement for this to support any additional fields, and to keep user and session data separate. It even seemed to handle the overlapping query issues. DBIC saved the day (again!). The way the statements are set up (in a batch) makes it hard to set this for one statement independently, and supposedly it needs to be set before a statement is prepared. Why not just arrange for it to be set by all queries done by the session handling? If you already have a dedicated DB connection for session data, why not use it? :) That would have worked fine, but DBIC handles all this directly, so delegating to that solved all the issues. I guess my comments should really be read as in anyone is ever patching C::P::Session::Store::DBI, here are a some things that could probably be added. In its out of the box form, it would have needed an override or two to work. As it is, C::P::Session::Store::Delegate is working very smoothly, and running stable with MSSQL. Cheers t0m ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Database-backed sessions: Session::Store::DBI/DBIC and MSSQL
I don't know if anyone else has hit these problems, and I am working on them, but there appear to be a set of significant issues around the DBI and DBIC session stores using Microsoft SQL Server as the back-end. These are mostly related to the fact that MSSQL only allows one active statement at a time. Therefore, you get errors like: [error] Caught exception in engine DBIx::Class::Storage::DBI::__ANON__(): DBI Exception: DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver]Connection is busy with results for another hstmt (SQL-HY000) [for Statement UPDATE sessions SET expires = ? WHERE id = ? with ParamValues: 1=1245271741, 2='session:6b263f72b22e53043beca20c3746dee2baa3bf35'] at D:/perl510-20090611/site/lib/Catalyst/Plugin/Session/Store/DBI.pm line 52 Since I was using Session::Store::DBI rather than Session::Store::DBIC I thought that might be the problem, but I now suspect the session handling needs its own connections. (On a side note, I got all sorts of strange error messages trying to set up Session::Store::DBIC, and I am not worrying about them just yet.) Since Session::Store::DBI can be set to use its own connection, I thought that might resolve it. Not completely, unfortunately, and now the error is due to the recommended use of a text column for the data. It seems the DBI+DBD::ODBC likes to require LongTruncLen set to a rather larger value than is the default (apparently the default can even be zero!), so you get truncation errors when reading any session data. The way the statements are set up (in a batch) makes it hard to set this for one statement independently, and supposedly it needs to be set before a statement is prepared. I had thought the transition to MSSQL would be as easy for session handling as it had been for model data. Not so. And no, MSSQL was not my idea! All the best Stuart -- Stuart Watt ARM Product Developer Information Balance ___ 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] Applying external web server authentication: is there a better way?
I'm developing an app which uses IIS and FastCGI as its back end. Also, we are expected by the client to use Windows integrated authentication in the server -- this is an intranet app, so no login screen should be expected. Picking up the user id is fairly easy - it's set as the REMOTE_USER CGI header by IIS authentication, and the engine puts it into the deprecated $c-request-user. I was using this as the identity (bad, I know) and got burned by the fact that we couldn't properly test multiple users with Test::WWW::Mechanize::Catalyst. I wanted to switch to Catalyst::Plugin::Authentication. This seemed a little unusual when we aren't really doing any authentication, but trying to read the one already performed, so I put together a Catalyst::Authentication::Credential::Environment module, that simply reads (the still deprecated) $c-request-user. I didn't really want to do all the authentication with Catalyst::Plugin::Authentication, even though is seems possible. And testing was now easy, we got per-user sessions, and everything. Anyway, what I wrote as the main method was: sub authenticate { my ( $self, $c, $realm, $auth_info ) = @_; $c-log-debug(Using environment authentication); my $username = $c-request-user(); if ( defined( $username ) ( $username ne '' )) { my $user_obj = $realm-find_user( { username = $username }, $c ); if ( ref( $user_obj ) ) { $user_obj-id( $username ); return $user_obj; } } return; } Is there another simple but better way to achieve this? Ideally one which avoids the deprecated $c-request-user. I'm only starting to use Catalyst for authentication stuff. All the best Stuart -- Stuart Watt ARM Product Developer Information Balance ___ 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] Applying external web server authentication: is there a better way?
Many thanks, Tomas, just what I needed. Right now I'm still on 5.7 due to an immediate release, but next week I'll go to 5.8, and then I'll be happy to review and test a better solution. Credential::Remote looks like what I didn't find. When I started working with this authentication issue, I wouldn't even have understood Credential::Remote type code, but by Monday I'll be better placed and have time enough to give it a thorough test. All the best Stuart Tomas Doran wrote: Stuart Watt wrote: I'm developing an app which uses IIS and FastCGI as its back end. Also, we are expected by the client to use Windows integrated authentication in the server -- this is an intranet app, so no login screen should be expected. snip trying to read the one already performed, so I put together a Catalyst::Authentication::Credential::Environment module, that simply Doh, you appear to have duplicated a chunk of effort: http://dev.catalyst.perl.org/repos/Catalyst/branches/Catalyst-Plugin-Authentication/credential_remote/lib/Catalyst/Authentication/Credential/Remote.pm Is there another simple but better way to achieve this? Ideally one which avoids the deprecated $c-request-user. I'm only starting to use Catalyst for authentication stuff. Not at the moment / in a released state. The next Catalyst release will add $c-req-remote_user for this. There is currently a failing test (for a bug which has been in Catalyst forever) in trunk, and I'm hoping to get this fixed before we release 5.80005. I'm also going to be reviewing / merging this branch of Catalyst::Plugin::Authentication soonish (which I'm seriously late on already)! So to answer your actual question, yes, what you're doing is the right thing to do, and will be present in 'officially released' software within the next couple of weeks max hopefully. If you fancy reviewing the code I linked about, and trying it out to see if it works for you, and commenting on anything you think needs work (including documentation!), then that would be a great help :) Cheers t0m ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=8D20F27F14.90E6C -- Stuart Watt ARM Product Developer Information Balance ___ 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] Multiple instances of same app with 5.80 under mod_perl
Tomas Doran wrote: If you try to run multiple copies of the same application in the same perl process, it won't work like you expect - the setting will come from the first application loaded.. Your solution just makes it much easier to have multiple deployment environments with different configurations, but these environments still have to have a different perl interpreter each. True, we did need to keep each application using processes which are separate. This was an issue when we used PerlEx (the ActivePerl style mod_perl approach) but we now use FastCGI (clients use Windows, etc.) and IIS freely creates many processes, and makes it really easy to set environment variables for them from its configuration files. The IIS FastCGI mechanism was developed closely with Zend, and I guess PHP faced the same kind of issue, and this was their solution. I'll wikify the config trick for now; we're close to production deadlines right now, but I do want to get this out there! --S -- Stuart Watt ARM Product Developer Information Balance ___ 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] Multiple instances of same app with 5.80 under mod_perl
I did a simple tweak to the configuration file management so environment variables could be substituted into configuration files. All I added to MyApp.pm was: __PACKAGE__-config('Plugin::ConfigLoader' = {file = 'MyApp.yaml', substitutions = { ENV = sub { my ($c, $v) = @_; if (! defined($ENV{$v})) { die(Missing environment variable: $v); } else { return $ENV{$v}; } } } } ); Then, I could use YAML settings like: session: storage: '__ENV(TEMP)__/sessions' It was pretty easy for us to get web servers to set environment variables, so this trick allowed us to have multiple systems with different database and file directories set pretty straightforwardly. This may be one approach you could use, but there are likely better ones. Especially since I'm still stuck at 5.70 waiting for a good opportunity to upgrade without anyone (even my colleagues) noticing. This is a 5.70 solution, but should be OK in 5.80, I would guess. All the best Stuart Stephen Clouse wrote: Hello all, I am fairly new to Catalyst and am currently evaluating it for use on several projects, a couple of them being conversions of an existing system to use Catalyst instead of the hacked-together in-house framework currently in use. Those apps have the old per-customer/mass-blog-hosting model going -- the exact same app deployed with different database/filesystem path configurations (currently set using mod_perl configuration directives inside VirtualHost sections in Apache config), previously accomplished with Catalyst either with FastCGI deployment or ACCEPT_CONTEXT magic that I don't quite understand yet. I have seen hints dropped in places such as http://osdir.com/ml/lang.perl.modules.dbix-class/2006-08/msg00188.html that Catalyst 5.80 has gained more explicit support for such a deployment model under mod_perl, but so far I have come up empty on finding references or examples of how to actually do it. Some guidance would be greatly appreciated. -- Stephen Clouse stephenclo...@gmail.com mailto:stephenclo...@gmail.com -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=64AE2280C1.6F32B ___ 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/ -- Stuart Watt ARM Product Developer Information Balance ___ 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 - any good AJAX tutes?
I've had some very good results with Dojo and Catalyst for AJAX. A couple of components in our app show this exceptionally - a table of contents based on a folding tree, and a grid backed by an SQL query, using to display filtered search results in different sort orders, etc. The grid will automatically request rows as it needs to, through a JSON-writing TT file, based on the built-in Dojo QueryReadStore - most of Dojo can use data stores that are backed in this way, and these can draw from most any request. Sorting was also more or less built-in. The folding tree was harder, as we were stuck with a legacy XML format from the old Microsoft MSDN site. This was implemented by a view that generated JSON from the legacy XML. Both worked well for us, and allowed us to develop rich front-end behaviour while hiding all the awful parts that we wanted to abstract away from. Dojo is weak in documentation compared to some, but rapidly improving. However, the main documentation site is pretty full of examples. Neither of these parts of the system ended up taking more than a couple of days to develop. If you stick close to the out of box functionality, all is fairly easy - if you want to develop your own widgets or data stores, it can get harder. Certainly, Catalyst made developing AJAX functionality in Dojo simpler and quicker than I had expected. All the best Stuart Neo [GC] wrote: Hi, depends on the javascript-lib you are using for AJAX. Catalyst just builds a template, which is interpreted clientside by the AJAX-lib. This might be XML, JSON, plain HTML or $something. For the webserver / Catalyst, the requests look like any other normal HTTP-request. Greets, Thomas Weber kakim...@tpg.com.au schrieb: hello there, I would like to use AJAX in my catalyst app. Any good references/tutes to recommend? thanks. K. akimoto ___ 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/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=8026A27FE8.9BC7B -- Stuart Watt ARM Product Developer Information Balance ___ 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] RFC: The paradox of choice in web development
Cosimo Streppone wrote: It's _not_ that hard. Perl has been good in the Windows world for long. Strawberry has improved this a great deal. Actually, our experience has been pretty horrendous. The problem for us has not been Perl but deploying Catalyst apps under Windows. We've used IIS and FastCGI, which eventual hard-won success, and we now have a 60-page installation guide as a result. Strawberry for us had the same issues as ActiveState - a Perl distribution that worked fine, but neither was updated all that frequently, and both have no debugging support which makes memory leak tracing somewhere between very hard and impossible. In the end I built my own Perl, with MinGW, and found it only slightly harder than using Strawberry. This was because there had been a core bug in both distributions which broke DBI with a memory leak - since the indexing part of our app does tens of millions of SQL queries, we could never get it to run to completion under Windows. The time it took for the core patch to make it into the distribution was about four months. On Windows, for the most part, Perl is the easy bit. Getting it to talk to some parts of Windows is a bit harder. Getting it to run to a production standard with Microsoft technology is almost unbelievably complex. It would probably be much easier with Cygwin, Apache, etc., but then, the whole point of them is to hide Windows, so that isn't really a help. Some of our nasties included: * ActiveState's PerlEx induced memory errors in file access at a level below Perl -- these all went away under FastCGI * File locking under Windows is not always as sound as we'd like (we hit frequent deadlocks in KinoSearch, which depends on it) * CPAN installations depending on external libraries sometimes require help to find the right DLLs (e.g., SSL stuff, XML::LibXML, XML::LibXSLT) - this seems to be very non-standard across CPAN, with each module working entirely differently to find DLLs * Under MinGW, I have even had to manually edit export files to get DLLs working right * Windows permissions for FastCGI - let's not even go there! Have you any idea how many policy settings and permissions are involved in getting IIS and Perl FastCGI to work? OK, a lot of this is not actually Perl, but you need a very solid background in operating systems in general, networking, DLLs, makefiles, etc., if you want to get the whole of Catalyst up from a solid basis. I'd love to see a Strawberry-type distribution that included a solid Catalyst base and the bridge to FastCGI, preferably under both IIS and Apache, etc. Give it a proper installer, capable of handling enough about IIS/Apache configuration to get a base Catalyst application up and running, with decent performance under Windows. If we'd had this, we would have saved months of work, and this is not an exaggeration. All the best Stuart -- Stuart Watt ARM Product Developer Information Balance ___ 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] RFC: The paradox of choice in web development
A feeling of deja vu has grown. I used to be a Lisp developer, and remember a conference presentation by Richard Gabriel about the difference between languages emphasizing internal correctness and consistency, compared to those emphasizing something that works and integrates well. Since then, I found that Perl gave me all the bits I liked in Lisp (e.g., hashes, symbolic processing, higher-order functions and even closures) but also gave me access to the system (I gave up Lisp when I ended up having to build my own web server from socket functions up). There are some nice follow-ups to this at: http://www.dreamsongs.com/WorseIsBetter.html. Anyway, maybe this is a helpful tool in thinking through the issues for web frameworks. Certainly, PHP scores on getting 50% of functionality out there easily. Even if extending and maintaining it is a total pain. Although the message I'd take is that platforms are in an ecology rather than straight competition. i.e., why not just build outstanding Catalyst apps when it's the right tool for the job. --S -- Stuart Watt ARM Product Developer Information Balance ___ 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] RFC: The paradox of choice in web development
I've actually done the reverse switch. Although I was a Perl developer for a good while, I previously used Apache::ASP and real ASP on Windows, with raw DBI and a hand-crafted search engine for most of this time. I then had to pick up Java and Spring with Hibernate for a while, for a second project. Since I started on my current task, which involved a large legacy code base in Perl, taking up Catalyst with DBIx::Class has been a great experience, as I get all the concepts from Spring and Hibernate with the development simplicity and CPAN assistance of Perl. Also, many of my colleagues have basic Perl, mostly pre-OO scripty style. Some of it is truly awful code!! Even they are beginning to see the flexibility that Catalyst has started to add into the development. We're now trying to recruit additional staff, and as Catalyst is a rare (and pricey) skill, we're also looking at Java folks, ideally with some knowledge of Spring and Hibernate, as a good base to move into Catalyst. There are still a few things I miss from Spring - notably the flexibility of its dependency injection for configuration. Configuration in Catalyst was actually far the hardest issue for me, and I still find it a little awkward. We began with YAMLs, and I still regret this from time to time. But this was an area where the examples were less detailed than helped the transition for me. Also, we found some highly inexplicable errors -- largely where Module::Pluggable loads everything in @INC, even when it is not where you expected. (PERL5LIB had been set to an old site, and loaded old components with different names.) For me, configuration is an area where the multiple alternatives really is a problem for Catalyst. My colleagues (and our clients) struggle with YAMLs. I'd rather one strongly preferred syntax was clearly set (and documented with detailed examples), although with an API that allows code to be used, through which others can be used for legacy apps. All the best Stuart Dave Rolsky wrote: On Tue, 17 Feb 2009, bill hauck wrote: I'm trying to put together a project to rewrite a job tracking database currently running in FileMaker. The functionality and scope of the job tracking system has changed so instead of throwing more money in a proprietary, closed system that requires a costly application on each desktop I'm suggesting writing it as a web application with Perl Catalyst. The only problem is that I've been told we would have to use Java Struts since it's our corporate standard for web applications. Perl, ironically, is used in quite a few places in the company, mainly in utility scripts. However, since we don't have anyone whose job title is Perl developer we can't use it for web applications. This is hardly unreasonable. I've worked at a number of smaller shops where we were developing a Perl-based app. If a developer had decided that they wanted to throw together some important tool in Java (or Python or Haskell or Smalltalk or ...), that would have been problem. The investment in a language is bigger than just the programmers, even. You have build deployment tools, automated testing setups (you do, don't you? ;), sysadmin knowledge, packaging infrastructure, and so on. Some of that may be language-agnostic, but often a lot of it ties into the language and its tools. Once you've made that investment, it makes sense to stick with it. Just because Catalyst and Perl are great tools for webapps doesn't mean that they're the _right_ tool at your job. -dave /* http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) */ -- Stuart Watt ARM Product Developer Information Balance ___ 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: New Catalyst Book?
Most of my work is search in Catalyst. I'll help. We've now got a web-service remote search system, a database SQL search, and a local search using a highly tweaked KinoSearch, all working fine and more or less pluggably. I am so happy with Catalyst, and when we get through our production deliverable (Tuesday) I'll happily collaborate on a search wiki. --S Dwalu Z. Khasu wrote: On Fri, 6 Feb 2009, Jesse Sheidlower wrote: =On Fri, Feb 06, 2009 at 01:57:49PM +, Dermot wrote: = 2009/2/6 ?? ?. akovbov...@gmail.com: = It would be nice if the book tells us how to work with heavy loaded = projects. = = I recall a thread about what would you like in the new book. If it = was still possible I'd like info on implementing a search engine into = Catalyst to be included. :) = =Hmm. As someone who just incorporated an external search =engine into two different Cat apps, I would have loved to have =had such a chapter available = Any chance you'd consider a wiki entry or similar and post the url here :) -- Stuart Watt ARM Product Developer Information Balance ___ 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] Problems with session under IIS
koniczynek wrote: Could you please provide a link or some sort of howto on getting Catalyst to work with FastCGI? Is it possible to run Catalyst after user enters my URL, eg: http://example.org or is it impossible and you have to use http://example.org/script/MyApp_fastcgi.pl? I have a long drawn-out word file containing it along with a bunch of other stuff. I will extract the relevant bits and post - I'd like to get them into a wiki, but our clients needed the howto in a form they could pass to their outsourced admin people, which was over the top compared to what people even slightly familiar with web servers would need. However, I'll put this in process as a task when I get a chance. Tomas Doran wrote: What version of IIS are _you_ using? There was a patch applied to 5.80 trunk for FastCGI under IIS6. If you're already successfully using that combination then we'd appreciate it if you could test the patch to ensure that it doesn't break anything for you. http://dev.catalyst.perl.org/svnweb/Catalyst/revision?rev=9076 I've got stuff working fine with IIS5 and IIS6. We don't have IIS7, so I haven't been able to test that one. I'll check out the patch for 5.8 later today. However, in the end, Catalyst was the least of my problems with IIS. Mostly, I spent at least a week puzzling through permissions settings with process monitoring tools. If you can face the frustration, it is well worth it (assuming, like us, your clients insist on Windows). The reliability and performance are far better than we ever got through ActiveState and PerlEx. All the best Stuart -- Stuart Watt ARM Product Developer Information Balance ___ 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] Tracking down memory leaks
Bill Moseley wrote: What are some good methods for tracking down memory leaks? I used Devel::Cycle on $c in handle_request() to find one leak. But, I suspect I've got a circular reference elsewhere still by the size of my processes after a while. (Processes start out showing 70MB and end up at 140MB rss -- which includes shared memory, of course). Devel::Leak saved me several times over, but I did need to build a debugging Perl to see the contents. When I did that, most of the leaks I was responsible for were easy to find and fix. I just used NoteSV/CheckSV in the loop, to pick up anything left from a previous iteration. In the end I still found DBI and some DBDs were responsible for most of my missing memory, and upgrading them took away of lot of issues. All the best Stuart -- Stuart Watt ARM Product Developer Information Balance I'm also curious about seeing an increase in rss memory in a very simple Catalyst application. Could be my testing, or 5.10.0 on this machine. $ perl rssmem.pl Start Rss : 7444 After one request Rss : 9592 Request 1000: Rss: 9636 Request 2000: Rss: 9696 Request 3000: Rss: 9756 Request 4000: Rss: 9816 Request 5000: Rss: 9880 It's not that significant, and I think I restart my processes after 1000 requests. $ cat rssmem.pl use strict; use warnings; use HTTP::Request::AsCGI; use Catalyst::Utils; use Linux::Smaps; my $smap = Linux::Smaps-new( $$ ); App-setup; print 'Start Rss : ', $smap-rss, \n; my $r = make_request(); my $before = $smap-all; $smap-update; print 'After one request Rss : ', $smap-rss, \n; for ( 1 .. 5000 ) { make_request(); next if $_ % 1000; $smap-update; print Request $_: Rss: . $smap-rss,\n; } sub make_request { my $request = Catalyst::Utils::request( '/ping' ); my $cgi = HTTP::Request::AsCGI-new( $request, %ENV )-setup; # Uncomment and no gain in rss. #return; App-handle_request; return $cgi-restore-response; } package App; use strict; use warnings; use Catalyst; sub ping : Local { my ( $self, $c ) = @_; $c-res-body( 'ping' ); } ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] How to detect cancelled requests?
Thanks Peter, and I think the client actually attaches specific meanings to particular prefixes (e.g., J13* = 'batch'), which we may even factor into a separate field, so we can search on two fields, one exact on a category and the other as you suggest. At the very least, when indexed, this would avoid a complete table walk. In practice, I also used KinoSearch, and I have moved some of these searches into KinoSearch, using a phrase search on character tokens (!). Since these names are generally eight characters or less, this is not a huge overhead (compared to the other KinoSearch fields) and seems to have good performance, for filtering at least. Initially I did this because we were using this as a filter on other KinoSearch fields, and it was easier to handle everything in Kino rather than get Kino hits lists and then filter against an SQL query. So yes, there is definitely opportunity to optimize, and we are doing so wherever we can. On the SQL side, we do use some similar techniques, but we are hit by several issues at low levels in Perl/IIS. In particular, DBI calls to retrieve a row are blocking. alarm seems to be able to cancel a database request, at least for some drivers, so we are not too worried about this. The issue is that big searches may return thousands of hits which then need to be rendered. Because IIS loves buffering and won't tell us when it cancelled, IIS just seems to enjoy taking all the web server resources, possibly for minutes at a time. If these resources were being used to display information in a browser, we would be doing what the client expects. To do them anyway, when a user may have refined their search (as is typical) and re-executed it, is just an enormous waste of resources. Most of this is because IIS is a total pain to get working with FastCGI/Catalyst. I have been trying for days, and generally get Error Details: * The FastCGI process exited unexpectedly * Error Number: -2147467259 (0x80004005). * Error Description: Unspecified error more or less whatever I try. I am sure most of these are permissions issues, but without any real feedback from IIS, they are more or less impossible to find. I must admit I am kind of hoping against hope that FastCGI will allow us to pick up more from IIS than PerlEx does, and given the close support for PHP with Microsoft and Zend, it looks like a huge amount more resource is thrown at FastCGI rather than PerlEx. I love Catalyst (as a long-term Perl developer, who also used the Java Spring framework, it gives me just what I need, quickly and well. And if i could get IIS/FastCGI working I would happily write a nice howto on it, but I am nowhere close, and nor can I find that anyone else is, apart from the current documentation, which as far as I am aware is simply: It is possible to run Catalyst under IIS with FastCGI, but we do not yet have detailed instructions. All the best Stuart Peter Corlett wrote: On Wed, Oct 29, 2008 at 10:11:35AM -0400, Stuart Watt wrote: [...] To give context, the queries that are an issue are SQL queries against a database that contains millions of components, where users may construct wildcard queries of the form *A*, with additional filtering constraints. If that was a reasonably popular query, I would certainly consider building a table which contains substrings of that field, so that it becomes a much more optimisable LIKE 'A%' query. ___ 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/ -- This message was scanned by ESVA and is believed to be clean. Click here to report this message as spam. http://antispam.infobal.com/cgi-bin/learn-msg.cgi?id=ABB412806C.0DEDB ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] How to detect cancelled requests?
Thanks Wade, this is already very helpful, and it seems that a queue is a sensible solution to the problem. We know some of the problem is hard, what is frustrating is that so much of it is outside our control, and also that of Catalyst and even Perl. To give context, the queries that are an issue are SQL queries against a database that contains millions of components, where users may construct wildcard queries of the form *A*, with additional filtering constraints. The *A* pattern typically generates a full table-walk, and if the database engine doesn't do a good job optimising the query (we are working to add appropriate hints) the filter may remove all but a few. The effect of this is that SQL searches may involve either a few, or tens of thousands of hits, and these could take minutes to retrieve from the database system. We handle timeouts at this stage, so we don't burn up the database engine too badly. The problem is more at the boundary between the web server and Catalyst. Under IIS, we don't seem to get any kill signal at all, certainly when using ActivePerl/PerlEx. I had kind of hoped we might get SIGPIPE, but we don't. For this reason, the only option under ISAPI/IIS is to let the request run to completion and be ignored, which seems to be the IIS/ISAPI normal behaviour. All are queries are searches, so there is no problem letting them run to completion. Unfortunately, in a few cases, this can involve some fairly complex rendering of database results, which may itself take a good few minutes to generate. Our client has explicitly requested that some searches should return *all* elements, no matter how many there are. Most searches take 0.1 seconds, but a few can take minutes (this was expected and accepted by the client). If a few searches are extreme, and then allowed to progress to completion, they can clog up the queue (or even the server) to a point where the entire system is totally busy. It is hard (impossible?) to determine whether a query will be fast or slow in advance. Our ideal would be a non-buffered model, where results are displayed incrementally, and where user requests can cancel a query, at worst when the next hit is about to be displayed. Since we fetch hits and render them incrementally, this should just work. It seems likely that IIS is most of the problem. Personally, I have never been happy with it (especially with ISAPI/PerlEx), but we are required to use IIS at least, and with much of the documentation relating to Catalyst on IIS being slightly on the sketchy side, it is hard to know how to improve the position. Ideally, we could use the following: 1. Any advice on FastCGI/Catalyst/IIS -- I assume it does work, but I have yet to achieve it 2. Some system for detecting a request has been cancelled, even if it is as naive as polling - when using (1) above 3. Any experience with trying to get HTML passed to IIS in a non-buffered manner -- it all seems buffered right now All the best Stuart -- Stuart Watt [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Stuart Watt [EMAIL PROTECTED] wrote on 10/28/2008 12:22:07 PM: Hi all, Has anyone found a neat way of detecting and handling cancelled requests? We have a Catalyst app that dynamically generates SQL queries for part of its search, some of which are long and complex, and users are able to create queries that can take minutes to execute. This is OK, except that we need users to be able to cancel those requests through the browser. Hard(er) problem alert -- depending on how your app is structured. The only sane way I can think of to handle this is to submit the query to a queue outside of your cat app. this queue would then need logic to fork out the query and check periodically for the kill tag in the queue entry. upon completion the status and output can be left in a database or file for the cat app to recover. Maybe a POE based queue would work. This may also help you prioritize and limit such queries. Otherwise, if the query is not destructive and usage is low -- is there a reason why you can't just take the easy way out and let it finish and ignore the output? -Wade To add complexity to this, we are using IIS (client specification) as the front end, although we are trying to get a FastCGI rather than CGI (with ActiveState's PerlEx) engine in place. We're doing this because we had to use our own Perl, simply because we were getting too many DBI-based memory leaks in the ActivePerl and Strawberry for our indexing system to be able to function effectively. (Essentially, this is a large-scale IR type application). The Perl we use is not threaded, essentially a 5.10 with all the patches as of September 2008, although I'd be happy to make it threaded if that would help. As far as I can tell, alarm is just about capable of cancelling long-running database queries, and with polling, the database no longer seems to be the issue. However, rendering the results
[Catalyst] How to detect cancelled requests?
Hi all, Has anyone found a neat way of detecting and handling cancelled requests? We have a Catalyst app that dynamically generates SQL queries for part of its search, some of which are long and complex, and users are able to create queries that can take minutes to execute. This is OK, except that we need users to be able to cancel those requests through the browser. To add complexity to this, we are using IIS (client specification) as the front end, although we are trying to get a FastCGI rather than CGI (with ActiveState's PerlEx) engine in place. We're doing this because we had to use our own Perl, simply because we were getting too many DBI-based memory leaks in the ActivePerl and Strawberry for our indexing system to be able to function effectively. (Essentially, this is a large-scale IR type application). The Perl we use is not threaded, essentially a 5.10 with all the patches as of September 2008, although I'd be happy to make it threaded if that would help. As far as I can tell, alarm is just about capable of cancelling long-running database queries, and with polling, the database no longer seems to be the issue. However, rendering the results can take a while, and IIS seems to choose not to inform anyone (or us, at least) when the user cancels a request and the connection close is initiated. Does anyone have any experience or recommendations? All the best Stuart -- Stuart Watt [EMAIL PROTECTED] ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/