Re: [Catalyst] flash - Duplicate entries
Quoting Ian Docherty [EMAIL PROTECTED]: Did I not see something on here, or on DBIx-class list some time ago to the effect that in find_or_create there is a short window where having found that a record does not exist it then creates it. I presume that two threads could each detect that a record does not exist and then one of them would create this error. Hmm .. That would explain the other issue I'm facing: An update_or_create command that once in a while fails with a duplicate entry error. The two threads you're mentioning would have to come from the same user at the same time though to cause this problem assuming that no two users have identical session keys ... Reversing the order (try a create first, catch the error, then do a find if the create fails) was ISTR the proposed answer. But this may not help you if the problem is in the Session/Store/DBIC/Delegate plugin. Right :( Is this a problem that only affects the MySQL backend because the other storage types (memcached, mmap, etc) do not check the uniqueness of the session key? Has nobody else met this problem yet? --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] flash - Duplicate entries
After deploying our new Catalyst application I'm receiving this error quite often per day: DBIx::Class::ResultSet::find_or_create(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry 'flash:9b11b5354715b56c9395abdf21544e83db5b0814' for key 1 [...] at /usr/local/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/ Session/Store/DBIC/Delegate.pm line 52 I'm using MySQL and I'm quite sure that this is _NOT_ a locking issue (or MySQL's fault as somebody on the list recently suggested) because the session stuff without the flash works perfectly. Any ideas what could be wrong here? Thanks! --Tobias ___ _ _ (web) http://www.funkreich.de (last.fm) http://www.last.fm/user/soulchild77 ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] TT and UNICODE: Garbled special characters
Quoting Stefan Kühn [EMAIL PROTECTED]: I have a problem when outputting special characters with Template-Toolkit and C::P::Unicode. I passed a simple template parameter from the controller to the view. The parameter contains a special character and is being garbled in the output. * In controller test.pm added the following (note the German Umlaut) sub index : Private { my ( $self, $c ) = @_; $c-stash-{myname} = 'düc'; # -- **NOTE** the German Umlaut $c-stash-{template} = 'test.tt2'; } If you use special characters as string literals you have to use utf8 at the top of your controller. Other than that you should tell TT that your templates are UTF-8 encoded by passing it a configuration option in your View class: __PACKAGE__-config( { ... ENCODING= 'utf-8', ... } ); HTH, --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Catalyst + RHTMLO
Is anybody here using Catalyst + RHTMLO, especially Rose::HTML::Form, to handle forms? If yes, I'd like to know what your glue code (init forms from db, re-fill from $c-req-params etc.) looks like because RHTMLO has a somewhat different approach to handling things and I have the feeling that I'm doing things overly complicated. Other than that, I really like the way RHTMLO works and would love to see something like a Catalyst::Controller::RHTMLO module which works similar to the other form controllers out there. The existing C::C::Rose module is tied to RDBO and thus of no use for me because I very much prefer DBIC. Thanks for any hints! --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] (en) error screen translations
Quoting Felix Antonius Wilhelm Ostmann [EMAIL PROTECTED]: Why de and at dont use the correct spelling? (de) Bitte versuchen sie es später nocheinmal (at) Konnten's bitt'schön später nochmal reinschauen Don't know about (at) but (de) should be: Bitte versuchen Sie es später noch einmal Sie with a capital S and noch einmal should be two words. --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Storing $c leaks memory?
While hunting down some memory leaks in my application I found that it's generally a bad idea to store $c in a class as this never gets cleared up completely, is that correct? I'm also doing things like this which seem to cause major leaks: $foo-bar( coderef = sub { return $c-forward( '/someaction' ) } ); While I can imagine that a closure like that can cause trouble I don't see why the following is leaking memory, too: in a Controller: my $foo = Foo-new( $c ); in Foo.pm: sub new { my( $class, $c ) = @_; my $self = {}; $self-{ '_c' } = $c; bless $self, $class; } Maybe somebody can shed some light on this?! Is it possible (and sensible) to weaken $c before storing it? Thanks a lot! --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] A Perl Message Queue?
Has anyone seen stuff like a Messages Queue (I dont have other words for it) But a more generic implementation of a thing where you can put in messages and pick them out in some other part of the program. It would be nice when you have stuff that takes longer that people usually can wait for. Maybe TheSchwartz does what you want: http://search.cpan.org/dist/TheSchwartz/ --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] New website using Catalyst
Evaldas Imbrasas wrote: I would like to annouce the launch of a new website using Catalyst (along with DBIC and Template Toolkit): EVO: eco-friendly products, services, and information http://www.evo.com/ Please feel free to add our website to the growing list of websites using Catalyst at http://dev.catalyst.perl.org/ . Looks like a cool site. I added it to Yeah, I really like it, too! Nice work. http://dev.catalystframework.org/wiki/LiveApplications By the way: Why isn't vox.com included on the list? Would be a cool reference. Or is there an approval by SixApart needed? --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] FCGI automatic restart / memory leaks
I just deployed our quite large Catalyst app and I'm seeing a constant increase in memory usage. Here's a current snapshop from top: PID USER PR NI VIRT RES SHR S %CPU %MEMTIME+ COMMAND 29342 www 16 0 67156 60m 3180 S1 3.0 0:13.87 perl 29332 www 25 0 41052 34m 1204 S0 1.7 0:00.01 perl 29333 www 25 0 68424 60m 3172 S0 3.0 0:13.42 perl 29334 www 22 0 68944 60m 3308 S0 3.0 0:13.58 perl 29335 www 16 0 67428 60m 3168 S0 3.0 0:13.86 perl 29336 www 16 0 68736 60m 3192 S0 3.0 0:13.88 perl 29337 www 16 0 67392 59m 3172 S0 2.9 0:14.02 perl 29338 www 18 0 66404 59m 3180 S0 2.9 0:13.49 perl 29339 www 17 0 69216 62m 3172 S0 3.1 0:14.12 perl 29340 www 16 0 67992 60m 3188 S0 3.0 0:13.89 perl 29341 www 16 0 68812 60m 3180 S0 3.0 0:14.88 perl We're using lighttpd and handle the starting of the FCGI server manually. Is there a way to have the FCGI children restart once in a while without having to restart the whole FCGI process manager (and bringing down the application for a few seconds)? Something like Apache's MaxRequestsPerChild directive would be cool. Then it's time to go memory leak hunting :( Thanks a lot! --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] FCGI automatic restart / memory leaks
Quoting Bernhard Graf [EMAIL PROTECTED]: On Thursday 16 August 2007 10:40, Tobias Kremer wrote: We're using lighttpd and handle the starting of the FCGI server manually. Is there a way to have the FCGI children restart once in a while without having to restart the whole FCGI process manager (and bringing down the application for a few seconds)? Something like Apache's MaxRequestsPerChild directive would be cool. I use daemontools similar to http://www.catalystframework.org/calendar/2006/4 . Thanks! I'll take a look at it. For now I'm gonna try running two independent FastCGI process managers and restart them on different hours via a cronjob so that one of them will always be available to lighttpd. Other solutions are still welcome! :) --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] FCGI automatic restart / memory leaks
Quoting Bernhard Graf [EMAIL PROTECTED]: You should definitely do that. Not only for this case - daemontools (or similar like runit) are superior for nearly every server service on *ix OSes. Check out http://smarden.org/runit/runscripts.html and compare the scripts with typical System-V run scripts (not mentioning the supervision concept in general). I suppose that the whole fcgi-pm process will be restarted instead of individual fcgi processes, correct? That'd mean a downtime of about 5 seconds which would render it useless to me :( Why two FCGI process managers? To compensate FCGI downtimes? Did you find a way to tell lighttpd not to talk to an FCGI process that is down? I only get a 500 error in that case. I just _hope_ that lighttpd will do the right thing as the error log tells me this when a backend server goes down: connect failed: Connection refused on unix:/srv/webapp.socket backend died; we'll disable it for 5 seconds and send the request to another backend instead: reconnects: 0 load: 1 --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] FCGI automatic restart / memory leaks
Quoting Bernhard Graf [EMAIL PROTECTED]: On Thursday 16 August 2007 14:32, Tobias Kremer wrote: Quoting Bernhard Graf [EMAIL PROTECTED]: You should definitely do that. Not only for this case - daemontools (or similar like runit) are superior for nearly every server service on *ix OSes. Check out http://smarden.org/runit/runscripts.html and compare the scripts with typical System-V run scripts (not mentioning the supervision concept in general). I suppose that the whole fcgi-pm process will be restarted instead of individual fcgi processes, correct? That'd mean a downtime of about 5 seconds which would render it useless to me :( No. The softlimit applies to each of the processes forked by the master, so each process is terminated if it gets too fat. Cool! :) I just _hope_ that lighttpd will do the right thing as the error log tells me this when a backend server goes down: connect failed: Connection refused on unix:/srv/webapp.socket backend died; we'll disable it for 5 seconds and send the request to another backend instead: reconnects: 0 load: 1 Just by setting multiple socket entries in the lighttpd-conf? Yes, like so: $HTTP[host] =~ bla { fastcgi.server = ( = ( MyApp = ( socket = /srv/socket_1, check-local = disable ), ( socket = /srv/socket_2, check-local = disable ) ) ) } --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Catalyst Unicode woes ...
Following up on a conversion I started on the DateTime mailing-list I'd like to ask if it is really neccessary to use C::P::Unicode if a site uses utf8-encoding? I have the problem that up until now everything worked absolutely fine without C::P::Unicode, Template::Stash::ForceUTF8, Template::Provider::Encoding or any other unicode plugin because I believed that if everything is utf8 you don't really have to worry about it that much. Now I recently incorporated DateTime::Locale to get a list of localized month names. Spitting them out in my templates revealed a questionmark symbol instead of all german umlauts. I took a look at DateTime::Locale and everything seems to be correct (use utf8 at the top, etc) so this can't be the culprit. encode(utf8)-ing the month names makes them look correct. I asked about this on the DateTime mailing list and everybody suggested a truckload of plugins to incorporate in Catalyst which _ALL_ break everything else on my site except the month names which are displayed fine then. It looks like everything gets encoded twice when utilizing these plugins. So I must admit I'm stuck with this. What is the best-practice for dealing with Catalyst and utf8? Do I really need C::P::Unicode to make this work correctly? What about the various TT plugins? And why the heck is everything double utf8 encoded when using these plugins that everybody else seems to use? Thanks a lot for any input! --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst Unicode woes ...
Tobias, I tried jrock's advice of adding C::P::Unicode to the Cat app you sent me a couple days ago - and it does fix the encoding problem. I also did that but it only works in some cases. Try adding a block element to the FormFu YAML file (or a comment for the date element) that contains some Umlauts and they will get double-encoded even with Unicode loaded. Most of my site now works with the Unicode plugin loaded but still some pages with FormFu forms are double-encoded - not all of them though. --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst Unicode woes ...
Zitat von Tatsuhiko Miyagawa [EMAIL PROTECTED]: Similarly even if your templates are encoded in utf-8, Template-Toolkit doesn't know which encoding they are in, until you set BOM to your templates or use Template::Provider::Encoding to explicitly specify the encoding to decode the template. So you're saying that there's no sane way using TT without Template::Provider::Encoding (or something similar)? I admit I haven't really grasped this whole Unicode issue fully yet (and I don't seem to be the only one as it's causing trouble for lots of people) but this really should be more DWIM out of the box if possible ... Especially since utf8 is becoming the de-facto standard for encoding everything should just work. Yeah, I know, I'm naive :) Concatinating utf-8 flagged variables with utf-8 encoded byte string causes automatic SV upgrade, which causes double utf-8 encoded string. Hmmm. So my templates are utf8 _ENCODED_ and the strings coming in from other perl modules are just utf8 _FLAGGED_. When TT concats them together during process() the result is wrecked because of the automatic upgrade. Correct? You might want to look at the manpages of encoding::warnings and perlunitut. Just quickly tried out encoding::warnings which outputs nothing at all but I'll give it a closer look. I have a couple of hacks to workaround that, like Template::Stash::ForceUTF8 that you mentioned, and Encode::DoubleEncodedUTF8 is probably the most evil one, that fixes the double-encoded utf-8 strings back to what you mean. Too evil to use on production but would be still useful to catch bugs like that in testing. Hacks are not an option here :) And there must be a right way to do it. --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst Unicode woes ...
Zitat von Tatsuhiko Miyagawa [EMAIL PROTECTED]: Similarly even if your templates are encoded in utf-8, Template-Toolkit doesn't know which encoding they are in, until you set BOM to your templates or use Template::Provider::Encoding to explicitly specify the encoding to decode the template. I just found the (undocumented?) ENCODING configuration option in Template::Provider. Setting this to utf-8 makes the templates appear correctly with C::P::Unicode loaded. Is there still a need for Template::Provider::Encoding? --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst Unicode woes ...
View::TT ENCODING: UTF-8 Template provider will see you are running a modern Perl (UNICODE flag in provider) and then look for a Byte Order Mark. If not found it will then decode your content based on the ENCODING setting. No, you don't need Template::Provider::Encoding if you only have one encoding in your templates. Yes you need Unicode (or the older Unicode::Encoding) plugin so that input params are decoded and output is encoded back to utf8. Yes, it all starts to make sense :) Thanks for all the great clarifications. MyApp is working fine now with C::P::Unicode and the ENCODING setting. By the way, does anybody know why the ENCODING option is undocumented? IMHO, it really should be mentioned in the Catalyst::Manual alongside some best-practice for Unicode. Use C::P::Unicode and ENCODING: UTF-8 should be enough for most people ... --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] TT macro to avoid excessive $c-uri_for calls
I'm wondering if it has any bad side effects to have a TT macro which is set to $c-uri_for. If I'm remembering previous posts on this topic correctly, calling uri_for() repeatedly has quite a big impact on performance which really matters most for my current application. I have this in a global macros.tt2 file: [% base = Catalyst.req.base; static = Catalyst.config.hosts.static; images = Catalyst.config.hosts.images; site.url = { base= base static = static images = images } -%] That way I can easily change the location of my static files and images to another server or place using the Catalyst config file and generate links like this: img src=[% site.url.images %]logo.png / a href=[% site.url.base %]user/whateverbla/a etc. Any comments? Thanks! --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] Ajax
Zitat von Hartmaier Alexander [EMAIL PROTECTED]: Hi Octavian! They all have nothing to do with either the template language or the web framework. I started using Dojo for some nice fading effects and a date selector and imho the docs are ok. From the moment I started using jQuery I never looked back at the other JS libraries out there. I think perl people will feel right at home with its API and concepts and it never stopped to amaze me how easy and intuitively things can be done. For me, Dojo comes in second with Prototype + Scriptaculous definitely being the worst alternative although you'll get a lot of support as it became the de facto standard. Other than that it's a giant hack :) --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Multiple FastCGI app servers with Apache2
Tobias Kremer wrote: FastCgiExternalServer: redefinition of previously defined class /srv/myapp.fcgi. I'm using mod_fastcgi-SNAP-0404142202 with Apache 2.0.59 both compiled from source. Do you have each FastCgiExternalServer directive pointing to a different instance of the application. E.g. FastCgiExternalServer /path/myapp_fastcgi.pl -host 127.0.0.1:55900 FastCgiExternalServer /path2/myapp_fastcgi.pl -host 127.0.0.1:55901 Nope. What does your Alias directive look like for this? How do you specify the other app instance (path2/myapp_fastcgi.pl)? Or do you have a different approach that doesn't use Alias? Anyways, I just switched over to lighttpd on a dedicated machine and the load-balancing worked perfectly within a couple of minutes :) --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Multiple FastCGI app servers with Apache2
Does anyone know if it's possible to distribute requests to multiple external FastCGI servers with Apache2 + mod_fastcgi similar to the round-robin load-balancing approach lighttpd provides? I have this large legacy app running on mod_perl behind an apache2 reverse proxy where I'd like to plug in my new Catalyst app via FastCGI which eventually should run on more than one physical app server. If possible I'd like to stick with Apache2 as the reverse proxy for now ... Thanks! --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [BULK] - Re: [Catalyst] flash with DBIC session storage
Am 28.07.2007 um 10:12 schrieb Jonathan T. Rockway: On Sat, Jul 28, 2007 at 09:15:36AM +0200, Tobias Kremer wrote: I think you're right: The error is due to my poor-man's approach of load-testing. BTW, how are you invoking ab? I think each request should get its own cookie, which means the same id shouldn't be being inserted more than once. Yep, that was exactly what was causing trouble. I provided a cookie to give ab access to member-only content. --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] flash with DBIC session storage
While hammering my site with ab (Apache bench) I'm getting loads of the the following error message: Couldn't render template undef error - DBIx::Class::ResultSet::find_or_create(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry 'flash:4f1bddce6c7828c27b2e47265f614109d4c21f19' for key 1 [for Statement INSERT INTO sessions (id) VALUES (?) with ParamValues: 0='flash:4f1bddce6c7828c27b2e47265f614109d4c21f19'] at /usr/local/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/ Session/Store/DBIC/Delegate.pm line 52 Any ideas what's going on here and how to fix it? Thanks! --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] flash with DBIC session storage
Am 27.07.2007 um 20:14 schrieb J. Shirley: On 7/27/07, Tobias Kremer [EMAIL PROTECTED] wrote: While hammering my site with ab (Apache bench) I'm getting loads of the the following error message: Couldn't render template undef error - DBIx::Class::ResultSet::find_or_create(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry 'flash:4f1bddce6c7828c27b2e47265f614109d4c21f19' for key 1 [for Statement INSERT INTO sessions (id) VALUES (?) with ParamValues: 0='flash:4f1bddce6c7828c27b2e47265f614109d4c21f19'] at /usr/local/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/ Session/Store/DBIC/Delegate.pm line 52 What's your backend RDBMS? Not using MyISAM or something similarly silly, right? Indeed, I'm using MySQL + MyISAM but I've never come across this problem before. Is this some sort of locking issue and I've no choice but switch to InnoDB? --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] How to access current MyApp instance ?
Hi. I want to call -uri_for from my DBIC sources, but it is object method, so MyApp-uri_for doesn't work. How do I access current catalyst object ($c)? Why would you want to do that? Your schema/model shouldn't know about URIs. If you really need to, you could use the ACCEPT_CONTEXT workaround to make $c available to your model: http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/ Intro.pod#ACCEPT_CONTEXT There are quite a few threads on the list dealing with accessing $c from the model. The search is your friend. --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Catalyst::Request::Upload - uploadtmp
The manpage of Catalyst::Request::Upload suggests the following: --snip-- To specify where Catalyst should put the temporary files, set the 'uploadtmp' option in the Catalyst config. If unset, Catalyst will use the system temp dir. __PACKAGE__-config( uploadtmp = '/path/to/tmpdir' ); --snip-- Unfortunately this doesn't work for me (all file uploads are placed in the system default location, e.g. /tmp). Now, there's this in Catalyst::Engine: #321: $c-request-{_body}-{tmpdir} = $c-config-{uploadtmp} But HTTP::Body::MultiPart doesn't consider $self-{tmpdir} in its call to File::Temp. Looks like tmpdir isn't used at all and really should be added as an object method to avoid poking in the HTTP::Body object. Have I misunderstood the purpose of uploadtmp? If not, I'd be happy to provide patches for HTTP::Body::MultiPart and Catalyst::Engine. Thanks! --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Request::Upload - uploadtmp
On Jun 8, 2007, at 10:09 AM, Tobias Kremer wrote: The manpage of Catalyst::Request::Upload suggests the following: --snip-- To specify where Catalyst should put the temporary files, set the 'uploadtmp' option in the Catalyst config. If unset, Catalyst will use the system temp dir. __PACKAGE__-config( uploadtmp = '/path/to/tmpdir' ); --snip-- Unfortunately this doesn't work for me (all file uploads are placed in the system default location, e.g. /tmp). Now, there's this in Catalyst::Engine: #321: $c-request-{_body}-{tmpdir} = $c-config-{uploadtmp} But HTTP::Body::MultiPart doesn't consider $self-{tmpdir} in its call to File::Temp. Looks like tmpdir isn't used at all and really should be added as an object method to avoid poking in the HTTP::Body object. Have I misunderstood the purpose of uploadtmp? If not, I'd be happy to provide patches for HTTP::Body::MultiPart and Catalyst::Engine. This sounds like a bug in HTTP::Body, a patch would be great, thanks! -Andy Patch attached. Hope it's okay. --Tobias --- MultiPart.pm.orig 2007-06-08 17:16:12.0 +0200 +++ MultiPart.pm 2007-06-08 17:18:42.0 +0200 @@ -273,7 +273,7 @@ if ($filename) { -my $fh = File::Temp-new( UNLINK = 0 ); +my $fh = File::Temp-new( UNLINK = 0, DIR = $self-{tmpdir} ); $part-{fh} = $fh; $part-{tempname} = $fh-filename; ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Too greedy name-based Virtual Host
Am 16.05.2007 um 11:54 schrieb Xavier Robin: VirtualHost site2.domain.tld:80 ServerNamesite2.domain.tld:80 DocumentRoot /home/xrobin/MIAPE/root LogLevel debug ErrorLog /home/xrobin/catalyst_error_log Location / SetHandler modperl PerlResponseHandler MIAPE /Location /VirtualHost This works, and http://site2.domain.tld calls our Catalyst application, and it seems to work properly. But strangely enough, our application is now bound also on site1.domain.tld ! (so all the usual pages are not reachable anymore). Did you also set the NameVirtualHost directive? Otherwise name-based virtual hosts will not work the way you want it AFAIK: http://httpd.apache.org/docs/2.0/mod/core.html#namevirtualhost --Tobias ___/\ _ . . + web ::: http://www.funkreich.de + last.fm ::: http://www.last.fm/user/soulchild77 --- -- - - --Tobias ___/\ _ . . + web ::: http://www.funkreich.de + last.fm ::: http://www.last.fm/user/soulchild77 --- -- - - ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] C::P::StackTrace and HTML::FormFu
Following up on my post from yesterday to the HTML::FormFu mailing list I found out that using the Catalyst::Plugin::StackTrace plugin together with HTML::FormFu (and Catalyst::Controller::HTML::FormFu) results in an enormous slowdown when using lots of options for e.g. select elements. See one of my earlier posts here: http://lists.scsys.co.uk/pipermail/html-formfu/2007-May/11.html The culprit is the option respect_overload = 1 given to Devel::StackTrace on line 63 of C::P::StackTrace (0.06). After removing it performance of HTML::FormFu is fully restored. The option was not present in earlier versions of C::P::StackTrace (0.02), that's why it all ran well on only 1 out of 3 of my machines, which incidentally had the old version installed. Now, I'm not really sure what's the best way to fix this, so I thought maybe some of you may have an advice. For now, I just disabled the StackTrace plugin. Thanks! --Tobias ___ _ _ (web) http://www.funkreich.de (last.fm) http://www.last.fm/user/soulchild77 ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: Shoot out -- Catalyst / RoR / Other MVC apps --
But, this does raise another question I have. There is plethora of modules that are to help Perl be more OO like and stricter which is cool, but are there any good de-facto standard modules that are used by the majority of people wishing to be more OO compliant. That'd be Moose, I suppose - A complete modern object system for Perl 5: http://search.cpan.org/dist/Moose/ Haven't really looked into it yet but I always wanted to know if there are any plans on incorporating this into the Perl 5 core and/or any patches in bleadperl that boost Moose's performance (which, I suppose, is not up to par with plain Perl objects) like the Class::C3::XS patches we saw recently? --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] email
Zitat von Bogdan Lucaciu [EMAIL PROTECTED]: On Tuesday 08 May 2007 03:55:31 Kieren Diment wrote: Intermediate Perl the name is (now) Learning Perl Objects, References, and Modules http://www.oreilly.com/catalog/lrnperlorm/ I think it's the other way round. The name is NOW Intermediate Perl: This book has been updatedthe edition you're requesting is OUT OF PRINT. Please visit the catalog page of the latest edition. which links straight to Intermediate Perl. --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Shoot out -- Catalyst / RoR / Other MVC apps --
I seem to remember hearing sth a few months ago about a comp between various MVC apps comprising of various teams / tasks / time limits etc. Does anyone know what I'm talking about here?! If s.o does, what became of it and are there any links to be had to read up on what happened? You probably mean the plat_forms contest held in Nuernberg, Germany: http://www.plat-forms.org/2007 No results yet, but I'm looking forward to seeing them, too :) --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Shoot out -- Catalyst / RoR / Other MVC apps --
Hmmm, no, I don't think that is what I was talking about (though it might be) I thought the competition was made up of teams that were part of communities rather than companies. Oh, okay, nevermind then. Sounds interesting, though. Tell us if you find something out about it. Plus, I'm sure RoR had a representation in the comp I was thinking of. This comp is just PHP/Perl/Java. Ruby and Python didn't make it because there were too few teams. The interesting thing is that Perl was first left out of the competition and got included later on due to the Perl community's protest :) --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Static content with catalyst
Hi Dmitri, I have a) JavaScript files (*.js) and b) images, which I want to use with catalyst. Where should I put them in order to be able to use it? Take a look at the Static::Simple plugin which is enabled by default: http://search.cpan.org/dist/Catalyst-Plugin-Static-Simple/ By default, files under /root/static are served as static content but you may as well define certain file extensions (e.g. .js) to be served as static files AFAIK. HTH, --Tobias ___/\ _ . . + web ::: http://www.funkreich.de + last.fm ::: http://www.last.fm/user/soulchild77 --- -- - - ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: AW: [Catalyst] Session problems with IE and cookies
Zitat von Hartmaier Alexander [EMAIL PROTECTED]: Most of the users of my cat apps use IE6/7, some (and I) Firefox. Some times in the past IE users couldn't login, deleting the cookies solved the problem, but it occurred only 3-4 times so I didn't investigate further. And what should I do against browser bugs?! We have this problem since we started using Apache::Session + Apache::Cookie about 5 years ago. Never had the time to actually look into it. It happens only infrequently but often enough to have it included in our site FAQs. Said application is running under Apache 1.3.x + mod_perl + Mason + MySQL - no Catalyst involved! --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] New Catalyst site
Am 28.02.2007 um 12:12 schrieb Carl Johnstone: I would like to announce that www.manchestereveningnews.co.uk has just been relaunched using Catalyst and mod_perl. Nice one, Carl! How is the content managed? I'd like to know if you integrated your Catalyst application with an existing content management system and if so, how you pulled this off. Having to choose a CMS and framework for a similar site myself this really could help me make a decision. --Tobias --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Template::Provider::DBI and Catalyst
Following up on a recent post to the list concerning templates in the database I'm wondering what the current status of Template::Provider::DBI is and if anyone is using it in production within Catalyst? I just found out that it seems to be incompatible with Catalyst::View::TT::ForceUTF8, for example (ForceUTF8 seems to ignore LOAD_TEMPLATES. Haven't looked at its source code yet to tell what's going on). Looking at the source of Template::Provider::DBI I see that the database handle is stored within the object which AFAIK is created once during server start by my View class initialization. I was told that storing database handles in objects for subsequent queries should be avoided by any means. Of course it could just be me who got burnt doing this under mod_perl :) There's also an error message on every request: prepare_cached(SELECT date_modified FROM templates WHERE filename = ?) statement handle DBI::st=HASH(0x91eac08) still Active I assume this is because there is no $sth-finish() statement: http://search.cpan.org/~timb/DBI-1.53/DBI.pm#prepare_cached Thanks for any clarification! --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] C::C::FormBuilder question
I was just looking at this last week, as I was using the code as a basis for a new controller. I suspect that it's never been tested, because as far as I can tell, it incorrectly reads the config from the controller object, rather than the application object. Yeah, I stumbled across this the other day but was unsure if it was done on purpose (for a controller-specific configuration rather than a global config). Nevertheless I found it awkward and IMHO it should be changed. --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] getting the ID of the user
I have tried to get the id of the currently logged user, using: $c-user-id But it returned same thing as $c-user (the username and not its ID). Hi Octavian, Assuming you are using DBIC, try: $c-user-get_column('id') Or, alternatively, you could use $c-user-obj-id (I think). HTH, --Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] DateTime Timezone
My application stores all dates in a MySQL database in the UTC timezone. Because I'm doing further calculations with these dates after retrieving them via DBIx::Class I don't want them to get auto-inflated into the timezone of the current user. The DateTime POD recommends doing date calculations only with dates of the same timezone and having everything in UTC should make things work like they're supposed to work (I hope). I think the DateTime objects should only be converted for displaying purposes (i.e. when they're going to be displayed in a TT template). Is that correct? If so, what's the best way (and where's the best place) to achieve this conversion? Thanks! -- Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] DateTime Timezone
Zitat von Chisel Wright [EMAIL PROTECTED]: I tend to use the following in my schema classes to deal with timestamps in my app(s): Yes, that's also what the DBIx::Class::InflateColumn::DateTime component which I'm using for this purpose does: http://search.cpan.org/~bricas/DBIx-Class-0.07003/lib/DBIx/Class/InflateColumn/DateTime.pm Unfortunately I just found out that DateTime::Format::MySQL::parse_datetime returns dates in the floating timezone (not UTC). Thus I'll now have to revert to manual inflation to set_time_zone( 'UTC' ) on the date objects or subclass D::F::MySQL :( Hmm ... There must be a better way of dealing with DateTime, timezones and MySQL ... Ideas are very welcome :) -- Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Last Chance / Last Day: Web developmentplatformcontestand Perl / Catalyst
Having only one team for Perl is quite bad, especially since one of the organizers happens to be the iX magazine (http://www.heise.de/ix/), which has a big influence in the german speaking world. :/ Today I was in a meeting with one of Germany's top twenty internet agencies to speak about the future of our (home-brewed Perl-based) community app. I spoke to the person in charge of technology who of course tried to persuade me that Java and .Net/C# is the way to go. Even worse, he was convinced that Perl has no object- orientation features at all! He was surprised when I told him about the CPAN and Perl's flexible object capabilities. Unfortunately this is not an isolated case. One of Germany's most successful web portals serving several hundred million page impressions per month with Perl recently started hiring Java developers. I hate to say this, but Perl is really lacking some sort of marketing. To my mind Catalyst could be the new killer-app that has the potential to resurrect our favorite language. But not if we can't get the word out. This is really frustrating. Catalyst's website is one big mess. Go to the wiki section and you get gazillions of links on one page. Click on documentation and you receive ugly POD pages. This is just not up to standards set by other frameworks. Don't get me wrong: The content and documentation is better than most other frameworks but the presentation just sucks. I recently met another fellow perl dude and we're currently brainstorming what has to change to make Perl and the Catalyst project more appealing to the average CTO, technical lead, dude-who-is-in-charge- but-thinks-perl-is-dead :) Sorry, had to get this off of my mind ... -- Tobias P.S. I read that the upcoming issue of the iX magazine will feature an article about web development with Catalyst ... ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst Bricolage Integration
We do something similar with the Krang CMS publishing content served by CGI::Application. We have it write out templates and metadata for each application (story in Krang terminology) in separate directories [...] To do this kind of thing with Catalyst, you might want to just publish little data files (XML or whatever) with your templates and set up your web server to pass those to Catalyst. To get the same sort of setup This sounds like a cool idea. However, I must admit that I don't fully understand it. Can you give an example of what your metadata files contain? I suppose your stub scripts contain perl code which are eval'd by the CGI::Application backend? I don't see a possibility to get Bricolage to publish a template AND some sort of metadata file at once. Is Krang capable of doing this (publish little data files WITH the templates that are then read by the backend application) or am I misunderstanding things here? I now have a setup which allows me to publish stories from Bricolage into my Catalyst template space. This is not sufficient because Catalyst is not able to tell which story (i.e. id of story) it is dealing with to display dynamic stuff like user feedbacks to an article for example. That's where your metadata files come in, I suppose? Thanks a lot! -- Tobias ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [OT] building perl with threads
Daniel McBrearty schrieb: now I have the hang of building apache/perl from source ... what's the rationale behind the perl is normally built with thread support OFF in a production environment? is that what is recommended for cat under mod_perl / fastcgi? AFAIK, if you don't really need threads you should not enable them because this could have an impact on the overall performance of your webapp. So to answer your questions: Yes, it's recommended to compile perl without any kind of thread-support for best Catalyst performance. --Toby ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Special characters and MySQL issue
I have my content-type header set to ISO-8859-1 because I'm dealing with legacy data from a latin1 encoded MySQL database (otherwise data from the database is not displayed correctly in the browser). There's a form on my site for searching users by attribute. Now here's the problem: Doing a search where, for instance, firstname = Müriam (note the German umlaut) the search result contains users with a firstname of Myriam (note the y instead of the german umlaut). I tried to trace down the problem but was unable to really figure out what is going wrong. The data from the form is URL-escaped correctly to M%FCriam. I tried putting the following in the controller handling the request: $c-log-warn( $c-request-param( 'value' ) ); and it spits out: [warn] M (note that everything after the german umlaut is missing - maybe just a console problem?) I access the model like this: my $rs = $model-search_like( { $c-request-param( 'attribute' ) = $c-request-param( 'value' ) } ); The mysql query log shows the search string as: SELECT [...] WHERE [...] LIKE 'M\xfcriam' Entering a query with this search string manually into the mysql console client yields no results - as expected because there is no user with a firstname of Müriam. Any ideas on what's going on here? :) Thanks in advance for any help! Toby ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Bypass TT wrapper
Hi list, I have set up a site which utilizes the TTSite defaults for providing a common header/footer using TTs wrapper mechanism. What if I want to bypass the header/footer for certain URLs (specifically, I've forms which are injected into DIVs via AJAX and those forms are not supposed to have the common header/footer around 'em)? Is that possible? Something like Mason's %flags inherit = undef /%flags would be cool! Thanks a lot for your help! -- Tobias Kremer Web Architect ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] catalyst/perl and resources
Zitat von Jurgen Pletinckx [EMAIL PROTECTED]: hang on. There _is_ a perl job market in Belgium? That's good to know I didn't find one last time I looked. (But then, that was long ago, and I didn't look very hard.) Which raises my all-time favourite question: Why is Perl still going strong in the US and UK whereas good-old Europe seems to has already abandoned it completely? I can only speak for Germany though but I have the feeling that the people here always have to do a thing the most academic way possible (think Java). On the other hand, people in the US just want to get a particular job done - which is what perl was made for. This really frustrates me! I have had an eye on the jobs.perl.org site and various other job-sites for a couple of months now and judging from this I should have emigrated to the US a long time ago :) Toby ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/