Re: [Catalyst] Forcing scalar context in TT?
Use Template::Alloy and do [% $(row.objects).count %] Am 23.12.2010 um 16:53 schrieb Alex Povolotsky: Hello! I'm writing an application that needs to count some related objects [% row.objects.count %] results in select * from objects [% row.objects.scalar.count %] yields an error [% row.search_related_rs('objects').count %] is UGLY Do I have any better solution? 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/ ___ 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] Trouble using Catalyst::Controller::FormBuilder
Hi, my guess is that you added __PACKAGE__-meta-make_immutable to your controller class GLR::Controller::Payment. Try to remove it and add 1; instead. cheers, mo Am 10.11.2010 um 15:11 schrieb David Schmidt: On Wed, Nov 10, 2010 at 2:37 PM, Eric Berg eb...@bergbrains.com wrote: I'm trying to get Catalyst::Controller::FormBuilder to work, but am running into some problems. Per the docs, the config should be like this: use base 'Catalyst::Controller::FormBuilder'; But my class is from a brand-new Catalyst install, so it's using extends like this: BEGIN {extends 'Catalyst::Controller'; } So I changed it to this: BEGIN {extends 'Catalyst::Controller::FormBuilder'; } And now I'm seeing this error: Couldn't load class (GLR) because: Couldn't instantiate component GLR::Controller::Payment, The 'add_attribute' method cannot be called on an immutable instance at /usr/local/lib/perl/5.10.1/Class/MOP/Class/Immutable/Trait.pm line 32 Can anyone steer me in the right direction to get this working? BTW, I'm a long-time Perl guy, but this is my first Catalyst app. Thanks! Eric ___ 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/ People seem to move towards HTML::FormHandler these days. http://search.cpan.org/~gshank/HTML-FormHandler-0.32005/ ___ 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] Trouble using Catalyst::Controller::FormBuilder
Hi, this is a Moose thing. It inlines things like the constructor of the Controller object. But since the controller is only instantiated once (anyone correct me if I'm wrong) this won't give you a lot of a speed improvement. Just remove the line and be happy :-) Further reading http://search.cpan.org/~drolsky/Moose-1.19/lib/Moose/Cookbook/Basics/Recipe7.pod Cheers, mo Am 10.11.2010 um 17:06 schrieb Eric Berg: That is there, but it was added by Catalyst when I created the controller. I was just starting to look into what that does, but didn't get very far at this point. Can anyone give me a brief explanation? Eric On 11/10/10 10:58 AM, Moritz Onken wrote: Hi, my guess is that you added __PACKAGE__-meta-make_immutable to your controller class GLR::Controller::Payment. Try to remove it and add 1; instead. cheers, mo Am 10.11.2010 um 15:11 schrieb David Schmidt: On Wed, Nov 10, 2010 at 2:37 PM, Eric Bergeb...@bergbrains.com wrote: I'm trying to get Catalyst::Controller::FormBuilder to work, but am running into some problems. Per the docs, the config should be like this: use base 'Catalyst::Controller::FormBuilder'; But my class is from a brand-new Catalyst install, so it's using extends like this: BEGIN {extends 'Catalyst::Controller'; } So I changed it to this: BEGIN {extends 'Catalyst::Controller::FormBuilder'; } And now I'm seeing this error: Couldn't load class (GLR) because: Couldn't instantiate component GLR::Controller::Payment, The 'add_attribute' method cannot be called on an immutable instance at /usr/local/lib/perl/5.10.1/Class/MOP/Class/Immutable/Trait.pm line 32 Can anyone steer me in the right direction to get this working? BTW, I'm a long-time Perl guy, but this is my first Catalyst app. Thanks! Eric ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst and FormBuilder vs. IExplorer 8
Sounds like a trailing comma in the javascript somewhere. Am 06.10.2010 um 15:27 schrieb will trillich: The FormBuilder/Catalyst -generated HTML works just fine in Chrome and in Firefox, so debugging there isn't useful. It also works fine in older Internet Explorers. :( I was hoping someone has already run into this FormBuilder-snag-with-IE8 and found an elegant fix... And the return validate_incident(this) code is generated via FormBuilder, that's why I was asking the list, hoping someone else here has run into this and found a workaround. We do have other DHTML javascript on the page (e.g. click to dynamically add another upload-field) so Javascript and JQuery are working. IE8 has apparently been tweaked enough that it doesn't recognize the object in that context...? Any ideas? On Wed, Oct 6, 2010 at 1:13 AM, Toby Corkindale toby.corkind...@strategicdata.com.au wrote: On 06/10/10 14:00, will trillich wrote: Short version: Catalyst/Formbuilder uploads work fine in firefox and chrome, works fine in IE 6... but not IE 8, where it throws an object expected error. Ugh, I hit this a little while ago, but have forgotten the details already. I think you are looking in the right direction with the this though; try validating it in your function to ensure it contains what you're expecting perhaps? Also, can you verify that jquery is actually getting loaded OK? ie. In your document, put something like: $(function() { alert(jquery has loaded!); }); and check to see that you get an alert box when you load the page. If not, fire up Chrome's developer tools, or Firefox's Firebug, and see they mention any warnings or errors. -Toby ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] REST Controller + ajax(jquery) with file upload
Am 18.05.2010 um 17:47 schrieb David Schmidt: ps: I want my websites to be able to work with and without js. How can I achieve this without increasing the complexity of my code too much. (I vaguely remember this was really easy in RoR) Your approach seems perfectly reasonable. To make your REST interface work with browser have a look at http://search.cpan.org/perldoc?Catalyst::TraitFor::Request::REST::ForBrowsers Simply add a hidden form element with the name x-tunneled-method and the http method as value to tunnel the request as the desired http method. cheers, mo ___ 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] Oddness with Catalyst::Plugin::Session::Store::DBIC
Right after ConfigLoader ... shouldn't do that. Honestly, the session shouldn't be UPDATEd at all in that case. Like I said though, for me it's not a big deal that this happens, now that I know what causes it, I'm not worried about this showing up on my app_server.pl output during development. For production DBIC_TRACE is forced off and Static::Simple is never loaded :) Which is great. But a lot of users leave Static::Simple loaded, so while it's not going to bother you it -will- bother them. So, in the name of paying karma forwards, any chance I could have the versions anyway please? I updated all Plugins to the latest version using cpan upgrade /^Catalyst/ Still the same behaviour. cheers, mo ___ 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] Oddness with Catalyst::Plugin::Session::Store::DBIC
Right after ConfigLoader ... shouldn't do that. Honestly, the session shouldn't be UPDATEd at all in that case. Like I said though, for me it's not a big deal that this happens, now that I know what causes it, I'm not worried about this showing up on my app_server.pl output during development. For production DBIC_TRACE is forced off and Static::Simple is never loaded :) Which is great. But a lot of users leave Static::Simple loaded, so while it's not going to bother you it -will- bother them. So, in the name of paying karma forwards, any chance I could have the versions anyway please? I updated all Plugins to the latest version using cpan upgrade /^Catalyst/ Still the same behaviour. cheers, mo ___ 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] Oddness with Catalyst::Plugin::Session::Store::DBIC
I had the same problem. I boiled it down to Static::Simple. Each request to a static resource issued a session update. In a recent release of cat the handling of requests seemed to have changed. Try downgrading to 5.80018 which fixed it for me (which is not a good solution, but I have no time right know to fix it in catalyst or write a test). On Tue, 27 Apr 2010 15:42:21 +0700, Ben van Staveren benvanstave...@gmail.com wrote: Hi folks, Recently after upgrading all of Catalyst, I'm witnessing some weird behaviour in some apps. I'm using Catalyst::Plugin::Session::Store::DBIC to store my sessions, and when I have DBIC_TRACE going, I see this: BEGIN WORK SELECT me.id, me.session_data, me.expires FROM session me WHERE ( me.id = ? ): 'session:fe3baeddb6ec2d3a14b07651a8792c7b85df9722' COMMIT UPDATE session SET expires = ? WHERE ( id = ? ): '1272443848', 'session:fe3baeddb6ec2d3a14b07651a8792c7b85df9722 Not once per request, but up to 50 times in a single request. Is this something wrong in my code or is C::P::S::S::DBIC going nuts? ___ 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: Security issue with hashed passwords in C:P:A:Password
Crypt::SaltHash makes the salt a function of the username, I haven't looked too much into the implementation but it certainly isn't the normal method of salting -- though it most probably helps some level. It's not. Crypt::SaltedHash doesn't know about the username. cheers, mo ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] uri_for and unicode
Am 09.03.2010 um 21:30 schrieb Alex Povolotsky: On 03/09/10 13:47, Bernhard Graf wrote: Am 09.03.2010 11:26, schrieb Alex Povolotsky: uri_for seems to have some troubles with unicode. Use of uninitialized value within %URI::Escape::escapes in substitution iterator at /usr/local/lib/perl5/site_perl/5.10.1/Catalyst.pm line 1268. I remember, that there was quite a few progress in Cat's Unicode area recently. Are you using the most recent releases of Catalyst and Catalyst::Plugin::Unicode::Encoding? After adding Catalyst::Plugin::Unicode::Encoding, it became MUCH worse. What was readable, became unreadable. What was unreadable, remained so. Replacing C::P::Unicode by C::P::Unicode::Encoding did not yield any difference. At least it's consistent now :-) ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] generating and redirecting to pdfs
Am 21.10.2009 um 00:25 schrieb Steve Rippl: Hi, I'm using TT for my View templates, and I'm experimenting with Template::Plugin::Latex for generating pdf reports. Now I'm generating pdfs (which is nice!) but not redirecting to them at the end, so I suspect I'm using the wrong approach. I'm doing the exact same thing, but without creating a temporary file: my $template = [% TT LATEX STUFF %]; my $t = Template::Alloy-new; my $out; $t-process(\$template, {stash = 'bar'}, \$out) || die $@; my $output = IO::String-new($out); my $string = $output-string_ref; $c-response-content_type('application/pdf'); $c-response-content_length( length $$string ); $c-res-body($$string); You can probably skip the IO::String object... That's about it. cheers, moritz ___ 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] Per request DBIX Class Schema Connections
Am 05.10.2009 um 08:35 schrieb Chris Grafham: Thanks for the suggestion, however I am limited to using a pure DBIx::Class solution in the production environment. I have an existing setup that is kind of working, but not always (FETCH's failing on prepared statements). The setup is as follows: 1. Determine write master or read slave connection based on URL. 2. Set connect_info on DBIx catalyst model. 3. Do queries. 4. Disconnect from DBI storage handle. Will this result in clean connections and disconnects at the start and end of the request? Or will catalyst cache connections or not reset the schema object correctly for a new connection, especially then switching between the master and slave (note: I am not using DBI::Apache). Do I need to do an explicit re-connect to the schema for each connection? Did you have a look at DBIx::Class::Storage::DBI::Replicated? It has some features that allow you to force the communication to the master server. Just have a look at the pod. moritz ___ 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] Why no extra attributes on Private actions?
__PACKAGE__-config( actions = { foo = { Path = 'bar' } } ); sub foo {} This has been introduced in 5.80006. The Catalyst-Manual just didn't catch up with the changes. cheers, moritz ___ 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] Why no extra attributes on Private actions?
Am 17.08.2009 um 23:19 schrieb Tomas Doran: On 17 Aug 2009, at 09:47, Moritz Onken wrote: __PACKAGE__-config( actions = { foo = { Path = 'bar' } } ); sub foo {} This has been introduced in 5.80006. The Catalyst-Manual just didn't catch up with the changes. No, it was not. What gave you that impression? http://www.catalystframework.org/calendar/2008/11 Cat 5.7015 was the current version at the time of writing, and I think that worked for most (if not all) of the 5.70XX series. Cheers t0m Until then it was necessary to add at least one attribute to the method. The calendar uses :Local as attribute. moritz ___ 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: no make install on catalyst apps
Am 28.07.2009 um 09:46 schrieb Devin Austin: Hi gang, There's been some discord as to whether or not Catalyst applications should/should not have the option of make install. Personally, I'm not really partial either way. Especially with the advent of tools like Dist::Zilla that allow you to keep track of the modules you need and build a distribution to release. Either way, I think it's time we come to a consensus. Multiple times there have been emails like this asking about it, so let's squash it once and for all and get an answer. There are cases where you want to make install an app and there are cases where you won't. So why do we need a consensus about that? It gives you great flexibility and there are cat apps on cpan which are meant to be installed. moritz ___ 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] add_columns()
Am 19.07.2009 um 13:21 schrieb Octavian Râşniţă: Hi, In DBIx::Class::ResultSource.pm's POD documentation I read: add_columns ... Adds columns to the result source. If supplied key = hashref pairs, uses the hashref as the column_info for that column. Repeated calls of this method will add more columns, not replace them. But in Catalyst::Manual::Tutorial::04_BasicCRUD.pod I read: __PACKAGE__-add_columns( created, { data_type = 'datetime', set_on_create = 1 }, updated, { data_type = 'datetime', set_on_create = 1, set_on_update = 1 }, ); This will override the definition for these fields that Schema::Loader placed at the top of the file. What's the truth? Repeating calls of this method adds more columns and not replace them, or the columns are overriden? They are replaced if the name you supply matches a previously setup column. So both is true :-) cheers ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] User timezones
Am 25.06.2009 um 09:54 schrieb Christian Lackas: * Devin Austin devin.aus...@gmail.com [090625 09:43]: Hi Devin, I would approach it so that when the user registers, they choose their time zone. When they login, this information is stored into their session, and retrieved whenever. agreed. I would store it in the session in the form you want it to be presented, which would save you whatever time it would take to be inflating it. Now the problem begins: I have tables for studies, series and images (and many more), each of them has multiple timestamps (e.g. when the study was created, the series acquired, the image processed, and when everything was created and deleted). So when I access all these times, I would have to convert all of them, e.g. in a template [% study.time.convertTZ(c.user) %] [% series.time.convertTZ(c.user) %] rather than just use (after Catalyst knows about the users timezone, somehow). [% study.time %] [% series.time %] and I must not miss a single value. And things get even more complicated when I filter for times (e.g. show images created in the last 3 hours), or if I want to show only datasets whose deletion date is in the past (could have be deleted in Europe and should also be gone in the US). Hi Christian, I don't quite get the above paragraph. If you search for db entries which have been created in the last 3 hours and you have a column created_on which stores the time of creation incl. time zone (of your server) you won't face any problems because you can simply search for them. The problem occurs only if you store the current time of the user without time zone in the created_on column. To the original question: I'd say that the conversion between time zones belongs in the View. As you are doing it already with [% study.time.convertTZ(c.user) %]. I see that this means you have to type more but neither the controller nor the model should do this conversion. moritz ___ 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: Lighttpd and mod_perlite
what questions do you have? All I can think to say right now is look at Catalyst::Engine::HTTP::Prefork and work from there… I'm curious if anyone's implemented a zero downtime restart system (the likes of which FastCGI gives you for free) or if it already exists somehow. Currently we just ^C and restart, which I guess is a bit lame. The restart_graceful and pidfile options would go most of the way, presumably? Paul I wrote an init.d script for debian based systems which heavily based on the init script for fastcgi. Check it out at http://dev.catalystframework.org/wiki/deployment/init-http-prefork . Cheers moritz ___ 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] ajax character encoding issue solved, but WHY?
Am 19.06.2009 um 06:23 schrieb seasproc...@gmail.com: I had a character encoding issue that I finally solved, but I don't understand why the fix works. I'm hoping someone can explain this to me! The issue was that non-ascii chars were appearing as junk BUT only when retrieved via ajax calls. Otherwise, they displayed fine. The junk display was due to them being interpreted as ISO-8859-1, but I could not figure out why the browser was interpreting that way. All my data is handled as UTF-8. The problem was fixed by calling utf8::decode on the data prior to sending back via ajax. BUT WHY? I am using the JSON view to render ajax responses, and it sets the charset header correctly to UTF-8. Of course, even when you decode, perl still represents as internal utf8. But why should this be necessary? Thanks! What is the encoding of the web page that issues that ajax request? Does this occur on different browser as well? I had similar problems and solved it by making sure that every page has the utf8 encoding header set. IMHO using utf8::decode is a hack and should be avoided if possible. moritz ___ 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] Potential query string pollution vulnerability?
Am 16.06.2009 um 11:11 schrieb Tobias Kremer: Hi all, I just experienced a nasty case of query string pollution vulnerability in one of my Catalyst/DBIC apps. I think that the circumstances under which this applies are not _that_ rare, so I figured it'd be best to inform the world. Imagine the following code in one of your actions: sub crashme :Local { my( $self, $c ) = @_; my $result = [ $c-model( 'Foo' )-search( { -or = [ name = $c-req-param( 'name' ) ], } ) ]; } To me, this never looked like a potential security threat because $c-req-param('name') is correctly inserted/quoted via bind parameters, right? Well, let's see what happens, if we pollute the query string a bit: /crashme?name=Fooname=Bar This results in the following SQL: SELECT ... FROM ... me WHERE ( ( name = ? OR Bar IS NULL ) ) Oh oh! :( 'Bar' is used as a column name here because Catalyst::Request::param returns an Array if the caller desires it (wantarray). Solving this problem is easy: Either force scalar context, or force array context and take only the first element. I'm not sure if it makes sense or is even possible to fix this within DBIC and/or Catalyst. By the way, I'm using DBIC 0.08107 and Catalyst 5.71. What do you think? You are not validating your input. That's all there is to say... moritz ___ 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] FormFu edit form problem
Am 29.05.2009 um 07:43 schrieb Toby Corkindale: Moritz Onken wrote: Do you run the latest version of DBIC? I was running on 0.08012, however I have updated to 0.08103 and still have the same problem. -Toby The problem is that there is no good way to decide whether a given relationship is a has_one or belongs_to relationship. at least this is what DBIC people say. SO if you set is_foreign_key_constraint to 0, FormFu assumes that it is a has_one relationship and not a belongs_to relationship. Right now I have no idea how to fix it! moritz ___ 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] FormFu edit form problem
Do you run the latest version of DBIC? Hi Carl, The patched version of 0.04004 seemed to work fine, however the released 0.05000 only works on some, but not all, of my tables. I tracked the issue down to part of HTML::FormFu::Model::DBIC around line 534, where you do: --- if ( exists $info-{attrs}{is_foreign_key_constraint} ) { $fk_constraint = $info-{attrs}{is_foreign_key_constraint}; } ... else { $fk_constraint = not $dbic-result_source- compare_relationship_keys( \...@keys, \...@fpkey ); } next if($fk_constraint); ... croak 'The primary key and the foreign key may not be the same column in class '.$fclass if $fpkey eq $fkey; --- The tables that break FormFu have relationships defined where the is_foreign_key_constraint attribute is set to false. If I change it to true, everything seems to work fine. Eg. __PACKAGE__-belongs_to( gp = 'My::Schema::Result::GP', { id = 'gp' }, { is_foreign_key_constraint = 0 } ); I didn't write the DB schema so I'm not sure why they indicated these weren't foreign keys, when they are, but I still don't think FormFu should barf on them. What do you think? Thanks, Toby ___ 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] FormFu edit form problem
Am 20.05.2009 um 00:37 schrieb Greg Coates: I'm using HTML::FormFu::Model::DBIC version 0.04002, and this problem is still there. Do we know when a patch might be available? Greg Hi Greg, which problem are you referring to? Can you provide some code? moritz ___ 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] FormFu edit form problem
Am 13.05.2009 um 18:57 schrieb Steve Rippl: Thanks for the pointer. I had defined the foreign key relationships within MySQL and relied on wsdsis_create.pl model DB DBIC::Schema etc etc to build the model and define these relations, but it seems that can't be quite be trusted! Anyway, I'm taking them out of the db and manually putting them into the respective models and it's working now. Thanks again! Steve There is a bug in the current version of HTML::FormFu::Model::DBIC which might have caused that error message. You might want to try to install version 0.04002 or wait until the patched version is avaiable. moritz ___ 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] FormFu edit form problem
Am 11.05.2009 um 23:43 schrieb Steve Rippl: __PACKAGE__-belongs_to( locationid, WsdSis::Schema::Result::Location, { locationid = locationid }, ); should be __PACKAGE__-belongs_to( locationid, WsdSis::Schema::Result::Location, ); or __PACKAGE__-belongs_to( locationid, WsdSis::Schema::Result::Location, { 'foreign.locationid' = self.locationid }, ); ___ 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 reuse Catalyst Schema for non-web purposes?
So it's the model I put the business logic in? That sounds ok, for now. But what about this: * Input from the web has to be validated. May be I use Data::FormValidator, may be FormFu. However, I may have to validate the params I get from the script (eg. data import from ERP systems), too. Do I have to implement the validation again? And maybe normalization/converting, too? Or where would you place these functionality? Extra modules? You are not limited by the number of models. You can write a model which does the form/data validation and which calls the dbic model to insert the data. Just place an extra layer between your controller and your dbic model. * What about business logic that is in not only bound to a specific schema but has an overall logic that fetches data from different tables, adds some somewhere and produces results? How would you implement such a logic? Any examples? I would write an extra model for this or you create a resultset class which can handle that. This very much depends on the data which is needed. * An example for using data and logic outside of the web app would be generating invoices by night. That process would bring out some PDFs which will be printed or sent by mail through another script. Shouldn't a view be involved in this process that builds the PDFs from templates? Is it possible to build this example upon a Catalyst web app? Examples? I use Template::Plugin::Latex to create a TeX document which is then converted to a pdf. But this is totally independent from catalyst. It is a script which is run once a day and generates the invoices. No need to follow the MVC scheme here. If you plan to run those jobs with catalyst I'll suggest you have a look a job queue which can help you with that (e.g. TheSchwartz). moritz ___ 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] Having trouble even perldoc-ing Catalyst::Authentication::Store::DBIx::Class :(
Am 23.04.2009 um 17:49 schrieb kakim...@tpg.com.au: Catalyst/Plugin/Authentication/Store/DBIx/Class.pm You installed Catalyst/Authentication/Store/DBIx/Class.pm ___ 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::Engine::HTTP::Prefork not used? (solved)
Am 14.04.2009 um 14:48 schrieb Neo [GC]: J. Shirley schrieb: On Tue, Apr 14, 2009 at 8:25 PM, Neo [GC] n...@gothic-chat.de mailto:n...@gothic-chat.de wrote: Hi, I've read about the prefork-engine for the test-server in another thread, which could be very useful for me (our outsourced codemonkeys sometimes produce VERY SLOW controllers and together with multiple ajax-request, this means waiting ;)). About usage I found only this: $ cpan Catalyst:Engine::HTTP::Prefork $ CATALYST_ENGINE='HTTP::Prefork' script/myapp_server.pl Amazingly, this doesn't change anything at all with my app, after starting there are still only two processes (some kind of supervisor I think and the real server process) and the requests are served one-by-one. Even more confusing, if I set CATALYST_ENGINE to 'Whatever', I get no error message or something. Is there required more to use it, besides installing the module from CPAN? Thanks and regards, Neo [GC] Hi Neo, Are you running a really old version of Catalyst::Devel? If you specify the -r option to myapp_server.pl that was generated with a (oh, 2 years?) very old version of Catalyst::Devel it will not work right. This option clobbers your engine and sets the engine to 'HTTP::Restart'. Take a look at your script/myapp_server.pl and find the section for checking $restart The proper lines should be: if ( $restart $ENV{CATALYST_ENGINE} eq 'HTTP' ) { $ENV{CATALYST_ENGINE} = 'HTTP::Restarter'; } It used to omit the test for CATALYST_ENGINE, and ... well, that's not right :) Otherwise, it should definitely throw an error for an invalid engine being specified: $ CATALYST_ENGINE='Yourmom' perl script/myapp_server.pl Can't locate Catalyst/Engine/Yourmom.pm in @INC -J Ha! Thank you very much, this was exactly the problem! Our startup-scripts indeed seem to be abount two years old. I remember seeing a warning about old scripts once, but haven't seen them in a while and thought one of my colleagues fixed it. If I may ask a following question how to rebuild the scripts? _ I can't reproduce the old warning and either I'm too stupid to use Google or the howto is hidden somewhere in subspace... catalyst.pl -force -scripts MyApp moritz ___ 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] Too many records returned
I think you need to retrieve that object after -update() again: Character.pm --- sub character : Local FormConfig('character/character.yml') { my ($self, $c, $id) = @_; my $book; if (defined($id)) { $book = $c-model('DB::Character')-find($id); unless ($book) { $c-stash-{error_msg} = Invalid Character record -- Cannot edit; $c-response-redirect($c-uri_for('list_character')); $c-detach; } } else { $book = $c-model('DB::Character')-new_result({}); } my $form = $c-stash-{form}; if ($form-submitted_and_valid) { $form-model-update($book); $book = $c-model('DB::Character')-find($book-id); $c-stash-{status_msg} = 'Record ammended'; $c-response-redirect($c-uri_for('list_character')); $c-detach; } else { $form-model-default_values($book); } $c-stash-{given_title} = 'Edit Character'; $c-stash-{template} = 'character/character.tt2'; } ___ 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::Controller::DBIC::Transaction Integration
If any Cat dev could point me to a Cat controller that does the action registering correctly, so I can fix C-C-HTML-FormFu, I'd very much appreciate it. Did you try to put this in C::C::HTML::FormFu? sub _parse_Form_attr { my ( $self ) = @_; return ( ActionClass = 'HTML::FormFu::Action::Form' ); } sub form : Form { } would be the same as sub form : ActionClass('HTML::FormFu::Action::Form') { } and create_action() is not needed anymore. There is a wiki entry I wrote about that: http://dev.catalystframework.org/wiki/gettingstarted/howtos/controllerattributes moritz ___ 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 ExtJS
Thanks for the link Moritz, I'm working my way through your examples from http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-ExtJS/lib/HTML/FormFu/ExtJS.pm Should javascript.tt2 contain this: script type=text/javascript Ext.onReady(function(){ var submitForm = function() { form.getForm().submit({ success: function(rst, req) { // submission was successful and valid } }) } }); }; var form = [% form.render %]; form.render(document.body); }); /script I needed to make these changes to get it to display. Yes that's correct. HTML::FormFu::ExtJS helps you with creating the form only. The whole logic is up to you. There are many ways to display a form. I usually put them in an Ext.Window. But you can still render them directly to your html body. moritz ___ 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 ExtJS
Hi Scott, thank for your reply, in having a go at using Catalyst::View::JSON i keep running into the ... encountered object 'MyApp::Model::DB::Experiment=HASH(0xe8ac4c)', but neither allow_blessed nor convert_blessed settings ... error. I'm getting data from DBIC but can't figure out how to get that into Catalyst::View::JSON. The hello world example works fine, but when trying to adapt this i run into trouble sub hello : Local { my($self, $c) = @_; # $c-stash-{message} = 'Hello World!'; $c-stash-{books} = [$c-model('DB::Books')-all]; ### this doesn't work $c-forward('MyApp::View::JSON'); } any pointers into the right syntax/approach here would be greatly appreciated. I presume i have to write some kind of JSON encoder for the data coming out of $c-model('DB::Books')-all? thanks again for your help Hi, You can access the raw data through $row-{_column_data}. But this is not recommended because it doesn't call any inflators. try $c-stash-{books} = [map { $_-{_column_data} } $c- model('DB::Books')-all]; Moritz ___ 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 ExtJS
Hi Scott, thanks for the info, do you use any particular module or have you built it yourself? I have found so far: HTML::FormFu::ExtJS Catalyst-Controller-HTML-FormFu-ExtJS any you'd recommend taking a look at? thanks again adam Hi Adam, I'm the author of the above mentioned modules. C::C::HTML::FormFu::ExtJS was just a proof of concept. You can use it though. It's simply a subclass of C::C::HTML::FormFu and replaces new HTML::FormFu with new HTML::FormFu::ExtJS. HTML::FormFu::ExtJS is actively developed. The version on CPAN is not very recent because I'm waiting for the maintainer of HTML::FormFu to release a new version. The most recent version is at http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-ExtJS/ (requires the svn version of HTML::FromFu). Try it, look at the tests, see me at IRC #formfu or email me. I'd be glad if someone is using this module so we can find bugs and add features to it. moritz ___ 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 - can't find Can't locate DBIx/Class/TimeStamp.pm in @INC ( have both perl 5.8.8 and 5.8.9 installed)
Am 10.03.2009 um 11:59 schrieb kakim...@tpg.com.au: hi , everyone, I installed DBIx::Class::TimeStamp successfully. I nevertheless have both perl 5.8.8 and 5.8.9 in my machine. I think it was when I ran apt-get on my ubuntu feisty box months ago apt-get install perl (yes,itchy fingers) and it installed perl 5.8.9. How did you install TimeStamp? Try $ locate TimeStamp.pm moritz ___ 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] In search of RESTful CRUD holy grail
Am 04.03.2009 um 13:25 schrieb Zbigniew Lukasiak: This might be a futile mission - but I think I learn something with each recurrence of this discussion. So let's restart it once again. CatalystX::CRUD::REST has a well described RESTful URI structure: # POST /foo- create new record # GET /foo- list all records # PUT /foo/pk - update record # DELETE/foo/pk - delete record # GET /foo/pk - view record # GET /foo/pk/edit_form - edit record form # GET /foo/create_form- create record form I think everyone will agree that this is indeed REST. For some cases there might be a slight problem with that URI schema - if you have a string primary key - and it can have the value of 'create_form' - then you will not know if the client is requesting a view on the object with that id or if he wants the page with the form to create a new object. This leads to new variation: # POST /foo- create new record # GET /foo- list all records # PUT /foo/by_id/pk - update record # DELETE/foo/by_id/pk - delete record # GET /foo/by_id/pk - view record # GET /foo/by_id/pk/edit_form - edit record form # GET /foo/create_form- create record form Of course 'by_id' could be 'instance' or whatever (perhaps the library should let the user to choose that infix part). Now '/foo/by_id/pk/edit_form' needs to make a PUT request to /foo/by_id/pk. To get around the problem with requests outside of the basic 'GET' and 'POST' repertoir we can use Catalyst::Request::REST::ForBrowsers. But it also means that for browser requests in the case of mistakes made in the form the action answering that PUT request to '/foo/by_id/pk' needs to render the form again with error indicators. But for non browser requests in case of similar errors it needs to encode those errors in some other way. This shows that 'edit_form' is only informing us how to *render* (or serialize) the data. In the case of GET requests it informs us that we should render the object data inside of a form and in the case of a PUT request with errors it informs us that we should similarly put the error data into the form. This leads to next variation: # PUT /foo/by_id/pk - update record or return the error encoded for non-browsers # PUT /foo/by_id/pk/edit_form - update record or return the error encoded as HTML form # DELETE/foo/by_id/pk - delete record # GET /foo/by_id/pk - view record (for non-browsers encoded) # GET /foo/by_id/pk/edit_form - view record encoded as an edit form And similarly: # POST /foo - create new record # POST /foo/create_form - create record form # GET /foo - list all records # GET /foo/create_form - create record form i.e. - here we treat 'edit_form' and 'create_form' consistently as a path info parameter informing us about the serialization method. The advantage of this arrangement is also that we don't need to put any address into the 'action' parameter of the form - and let it always submit to itself. In another variation we could move that parameter from path info to real parameters and have uris like: # PUT /foo/by_id/pk- update record or return the error encoded # PUT /foo/by_id/pk?x-view=edit_form - update record or return the error encoded as HTML form # DELETE/foo/by_id/pk- delete record # GET /foo/by_id/pk - view record (encoded) # GET /foo/by_id/pk?x-view=edit_form- view record encoded as an edit form Finally we need serialisation and dispatching to different methods for the same address (/foo/by_id/) based on the method. This is covered by Catalyst::Controller::REST. What I have not yet explored is how to add this new serialisation method (to 'edit_form') to the configuration of a Catalyst::Controller::REST based controller. Hi, here are my thoughts on this: I don't distinguish between edit_form and create_form. If there is a primary key or similar avaiable (either in the path or in $c-req- param) I show the edit form, if there is no such value I show the create form. Furthermore I would not put the form rendering in the same path as the REST interface. I would do something like this: # POST /foo- create new record # GET /foo- list all records # PUT /foo/pk - update record # DELETE /foo/pk - delete record # GET /foo/pk - view record # GET
Re: [Catalyst] In search of RESTful CRUD holy grail
Am 04.03.2009 um 19:30 schrieb Bruce Keeler: On 3/4/2009 4:45 AM, Moritz Onken wrote: Furthermore I would not put the form rendering in the same path as the REST interface. This is my preference too. Keep the browser stuff out of the REST api. I would do something like this: # POST /foo- create new record # GET /foo- list all records # PUT /foo/pk - update record # DELETE /foo/pk - delete record # GET /foo/pk - view record # GET /form/foo/pk - edit record form # GET /form/foo - create record form So now, what do we do with errors and redisplay of forms. I would say a form should post / put / delete to the rest api. Within that controller we can easily see if a browser is requesting this url or a web service (see ForBrowser's looks_like_browser()). If it's a browser we can detach to the /form/foo controller. Otherwise we show the errors in the format of the Accept header. I don't like this, however. If your UI is all AJAXy, by all means let it use the REST api directly. But for old-school HTML forms, I'd post to the /form/foo or /form/foo/pk and let that controller either call the REST api internally, or bypass it altogether. I like that idea! ___ 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] New version of InstantCRUD
Am 23.02.2009 um 10:53 schrieb Alexander Hartmaier: I'm currently patching the hell out of Controller::DBIC::API. Search by passing a json string and pagination is already in the repo, prefetch support is done but needs some sort of controller side restriction so that someone can't fetch the contents of the whole db by using the rels (api for that welcome). This should/could be the basis for ajax based LFB modules to load data instead of relying on an LFB internal API. What I'd like to see is a more split up LFB so I could use the (extjs) form generation on a per table (=controller) basis wherever I need it (for tables where a customized form isn't needed). - Alex Hi all, I'm following a different approach. My current project uses HTML::FormFu config files for both validating user input and generating json which contains the data of a resultset or result row. I do not use the html generation capabilities of FormFu, just validation, filters, transformers, inflators and deflators. I wrote http://search.cpan.org/~perler/DBIx-Class-AsObject-0.09_01/ which is far from being stable. But it generates a perl object from a result row using a HTML::FormFu configuration file. I think Controller::DBIC::API lacks of the ability to do proper validation. Maybe we can join forces on that one and add a configuration file to each controller. moritz ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] HTML::FormFu form elements
On Thu, 12 Feb 2009 09:38:18 +0100, Jens Schwarz blacky6...@gmx.de wrote: I've run into a scenario where I need to be able to build an HTML::FormFu form and then only display portions of it in my template. (So, the typical [% form %] in the template will be replaced by something else, at least in my ideal world.) What I do in this context: The template remains untouched. But in my Controller, I manually remove the desired elements: $form-remove_element($form-get_element({ name = 'element_name' })); Jens Did you try form.get_all_element()? get_element returns top-level elements, only. ___ 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 FYI: HTML::FormFu::ExtJS
On Thu, 12 Feb 2009 08:29:37 -0600 (CST), Kevin Monceaux ke...@rawfeddogs.net wrote: On Wed, 27 Aug 2008, Moritz Onken wrote: There is no difference in the form config file. You simply replace HTML::FormFu-new with HTML::FormFu::ExtJS-new and you are done. Does anyone have examples of using HTML::FormFu::ExtJS with Catalyst? Is there a Catalyst::Controller::HTML::FormFu::ExtJS plugin anywhere? I couldn't find one on cpan. I like the look of the HTML::FormFu::ExtJS forms, and being able to activate a WYSIWYG textarea editor with just a: - type: Textarea attrs_xml: wysiwyg: 1 would be really nice. I tried unsuccessfully to hack Catalyst::Controller::HTML::FormFu to use HTML::FormFu::ExtJS. It doesn't seem to be quite as simple as replacing HTML::FormFu-new with HTML::FormFu::ExtJS-new. Hi Kevin, I'm using HTML::FormFu::ExtJS with Catalyst. But I do not use a custom controller. My methods look like sub form : Local { my ($self, $c) = shift; my $form = new HTML::FormFu::ExtJS; $form-load_config_file(...); $form-process($c-req); ... I'd be glad to have a Catalyst::Controller::HTML::FormFu. You can contact Carl via the html-formfu mailing list and ask what tweaks are necessary. What kind of error occur when you replace HTML::FormFu-new with HTML::FormFu::ExtJS-new in _form? Cheers, Moritz ___ 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 FYI: HTML::FormFu::ExtJS
On Thu, 12 Feb 2009 08:29:37 -0600 (CST), Kevin Monceaux ke...@rawfeddogs.net wrote: would be really nice. I tried unsuccessfully to hack Catalyst::Controller::HTML::FormFu to use HTML::FormFu::ExtJS. It doesn't seem to be quite as simple as replacing HTML::FormFu-new with HTML::FormFu::ExtJS-new. Have a look at http://html-formfu.googlecode.com/svn/trunk/Catalyst-Controller-HTML-FormFu-ExtJS/. There are no tests yet but t/01basic-form.t already passes :-) (don't run make test, most of them will fail, they are just copied from C::C::HTML::FormFu) I'd be glad if you try this out. Moritz ___ 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 FYI: HTML::FormFu::ExtJS
On Thu, 12 Feb 2009 09:42:20 -0600 (CST), Kevin Monceaux ke...@rawfeddogs.net wrote: Moritz, On Thu, 12 Feb 2009, on...@houseofdesign.de wrote: I wasn't getting an error. It did partially work. I know pretty much nothing about ExtJS. I think [% form %] was only outputting part of the needed JavaScript. From all the examples I found it looks like the JavaScript in question needed to be in the head and my [% form %] was in the body. I moved it into a [% head.extra = BLOCK %] ... [% END %] block, which I use to add things to the head section of my wrapper, and think I almost had the additional JavaScript that was needed right, but couldn't get it to render the form. And I've since backed out all the ExtJS stuff I added to the form. I'm leaning towards jQuery. It's masked input plugin works more like I prefer than any others I've tried so far. With a quick search I found a WYSIWYG jQuery plugin that I'm trying out now. After adding the needed .js and .css files to the head of the page I added: attributes: class: wysiwyg to the form's TextArea element, and: script type=text/javascript $(document).ready(function() { $('.wysiwyg').wysiwyg(); }); /script to the page and I have a WYSIWYG textarea editor. Try this in your head: script Ext.onReady(function(){ var simple = [% form %]; simple.render(document.body); }); /script ___ 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] create search engine friendly uri from string
I have tried: use strict; use Search::Tools::Transliterate; use utf8; my $tr = Search::Tools::Transliterate-new; $tr-ebit(0); print $tr-convert(ăşţâîĂŞŢÂÎ); #It prints: astâîASTÂÎ I want to print ai instead of âî and AI instead of ÂÎ. Am I using $tr-ebit correctly? The latest 4 chars are 4 new UTF-8 chars in romanian language (U +0218, U+0219, U+021A, U+021B). Can they be transliterated? They are şŞţŢ but with a comma below, and not with a sedila. Can they be displayed as sStT? Did you have those problems with Text::Unidecode, too? ___ 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] create search engine friendly uri from string
On Tue, 16 Dec 2008 11:51:28 +0100, Robin Berjon ro...@berjon.com wrote: Before putting that into a module though you might want to think about what should happen to characters outside the [a-z0-9] range as \W will match differently based on locale. I'm not sure what the recommended behaviour is for such cases. That's what I'm thinking about right now. I couldn't find a reference which says that \W matches differently based on locale. Ptyhon can convert an utf8 string to an ascii string and replaces characters like ä with the most equivalent character a. Is there such a thing for perl? cheers, moritz ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] create search engine friendly uri from string
Hi, I was wondering if anyone has a nice regex or module which modifies a string to look good in an url. You know this behaviour from blogs which make urls from the blog title Example: Beta Launch Invites: Kwyno Brings The Web Into Your IM And (Soon) SMS Inboxes - http://www.techcrunch.com/2008/12/15/beta-launch-invites-kwyno-brings-the-web-into-your-im-and-soon-sms-inboxes/ Any ideas? cheers, moritz ___ 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] create search engine friendly uri from string
On Mon, 15 Dec 2008 18:28:03 -0800, Ashley a...@sedition.com wrote: Just a caveat that should be in the doc you end up with if not possible in the code. URIs are supposed to be unique to a resource. Titles of articles and pages are not (necessarily). The end user/dev will have to check for duplicates against the data and append a -II or -2, and so on. -Ashley I'll go with this approach: I use my primary key (happens to be a uuid string) and append the string from the title. I read just the uuid string and dismiss everything else. This way I don't have to worry about uniqueness and have seo friendly urls anyway. mo ___ 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] Troubleshooting Help Please
Am 06.10.2008 um 16:14 schrieb Moritz Onken: Authentication Session Session::Store::FastMmap Session::State::Cookie Storing the session with FastMmap is not a good idea. If the cache_size of FastMmap is exhausted it starts dropping sessions to make space for new sessions. You can change the cache size by setting it like this (default is 5mb): cache: backend: class: Cache::FastMmap cache_size: 100m Actually you need to set that parameter somewhere else. See the docs to Session::Store::FastMmap fore more information. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Testing RESTful web services
Am 05.10.2008 um 10:47 schrieb Ian Docherty: Hi I am writing a simple test to test a POST method in a web service but my controller does not see any content in the POSTed request. In the controller both the $c-request-body and $c-request- content_length are undefined. Any ideas? -- test.t --- use strict; use warnings; use Catalyst::Test 'MyApp'; use HTTP::Request; my $req = HTTP::Request-new( 'POST', '/foo', [ Content_Type = 'text/plain' ], hello world, ); It's Content-type = ... ___ 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: CSRF
Am 01.10.2008 um 08:57 schrieb Ashley: On Sep 30, 2008, at 11:13 PM, Aristotle Pagaltzis wrote: * Ashley [EMAIL PROTECTED] [2008-09-30 19:30]: If scripting is involved that makes it a XSS attack instead, though. No? No. Yeah, that was unclear. I was talking about our own sites and Cat apps, not the web at large. It was in that context which I suggested script based attacks were by definition going to be XSS. Malicious ActionScript is still script. But I hadn't read the POST exploits as described in the white paper so I was wrong. Might be pretty simple in Cat stuff. The crux of the POST issue seems that the target site's cookies are still safe from the attacking site's POST. So, off the top of my head, untested, please modify, correct, refine, put in wiki, etc. Form template: form action=[% c.request.uri() %] method=post [% USE Digest.SHA1 -%] input type=hidden value=csrf_check value=[% c.sessionid | sha1_hex %] / /form Controller form validation: use Digest::SHA1 qw(sha1_hex); some_error_or_other() unless $c-user_exists and $c-request-body_params-{csrf_check} eq sha1_hex($c-sessionid); I think this gives you a good protection. But if you have a XSS problem with your website the attacker could receive the session cookie via XSS (see the facebook example above). After that he can set up his form using the checksum. The best way is to include a random string which has to be stored somewhere for comparison on the server side. moritz ___ 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: CSRF
Am 01.10.2008 um 12:20 schrieb Aristotle Pagaltzis: * Moritz Onken [EMAIL PROTECTED] [2008-10-01 09:25]: The best way is to include a random string which has to be stored somewhere for comparison on the server side. Doesn’t have to be stored. Send a random string as well as a HMAC digest of a server secret plus the same string. To check a token, check if the random string plus server secret hash to the same digest as the one provided by the client. Since the server secret is not known or knowable to third parties, if the digest checks out, then this token must have been minted by the server. Very simple; near-zero CPU overhead; no server-side storage required. Hi, but this does still rely on the fact that there is no XSS issue on your page, doesn't it? I imagine a case where the attacker's site opens a iframe to your site which exploits a XSS issue and can send the hole form information back to the attacker's site. He has now the HMAC and the random string. cheers, moritz ___ 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: CSRF
Am 01.10.2008 um 14:20 schrieb Jonathan Rockway: * On Wed, Oct 01 2008, Moritz Onken wrote: I imagine a case where the attacker's site opens a iframe to your site which exploits a XSS issue and can send the hole form information back to the attacker's site. He has now the HMAC and the random string. I was under the impression that you could open an iframe to someone else's site and manipulate it from javascript running on your own site, without relying on any vulnerabilities on that site. Maybe not? Maybe flash can do this? (Why do we even have iframes? For serving ads?) Hi Jonathan, you cannot access data on a different frame via javascript if it's not from the same server. This is called the same origin policy and is also applicable to iframes. greetings moritz ___ 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: CSRF
Am 01.10.2008 um 16:23 schrieb Aristotle Pagaltzis: * Moritz Onken [EMAIL PROTECTED] [2008-10-01 12:55]: but this does still rely on the fact that there is no XSS issue on your page, doesn't it? So what? If your site has an XSS hole, it’s already game over. The attacker can inject Javascript that passes the same-origin policy blockade, so they can already do whatever the hell they want. I imagine a case where the attacker's site opens a iframe to your site which exploits a XSS issue and can send the hole form information back to the attacker's site. He has now the HMAC and the random string. Using an XSS hole to initiate a CSRF attack is like breaking in through the window to steal the house keys so you can unlock the front door. Attackers don’t build Rube Goldberg contraptions. Regards, Yeah you're right. Good point ;-) ___ 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] CSRF
Am 30.09.2008 um 19:20 schrieb Ashley: On Sep 30, 2008, at 10:08 AM, Moritz Onken wrote: attackers can use POST This is possible due to the fact that flash movies can send any request to a server. You can achieve this even with a XMLHTTPRequest. If scripting is involved that makes it a XSS attack instead, though. No? -Ashley I was wrong about the XMLHttprequest. Posting to another server is not possible as of the same origin policy. But flash movies can send post request to a different server without user interaction. XSS is more like posting a javascript snippet to a facebook wall which does some javascript actions in the context of the user who opens that wall. cheers, moritz ___ 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] CSRF
Am 30.09.2008 um 21:15 schrieb [EMAIL PROTECTED]: Moritz Onken [EMAIL PROTECTED] wrote on 09/30/2008 01:08:38 PM: Am 30.09.2008 um 19:20 schrieb Ashley: On Sep 30, 2008, at 10:08 AM, Moritz Onken wrote: attackers can use POST This is possible due to the fact that flash movies can send any request to a server. You can achieve this even with a XMLHTTPRequest. If scripting is involved that makes it a XSS attack instead, though. No? -Ashley I was wrong about the XMLHttprequest. Posting to another server is not possible as of the same origin policy. But flash movies can send post request to a different server without user interaction. Actually, no. Flash can do GET to another server (hostname) but as of flash 7 (they are at 9 now), you need a crossdomain.xml file on the receiving end to allow POST and data loads. I'm sorry, didn't know about that. But it's still possible to submit a (invisble) form with the method set to POST without any user interaction (chapter 2.3 from the paper). moritz ___ 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] Slow template processing on debian lenny
Hi, I've been using TT for years and enjoy the features it provides. In one of my Catalyst applications, I'm processing a template which generates HTML to give me a table with counts taken from a hash. I'm using a lot of nested FOREACH to generate the table. On my machine, an ubuntu hardy, it works fast - about 2.5 seconds to process the template. On a production server using debian lenny, it used to take around the same amount of time. But recently, I upgraded it to libperl 5.10 and updated the different Perl modules including Template and Catalyst::View::TT. After this upgrade, the same template takes 25 seconds on average to process. The times I am mentioning are the times taken on the server side, as shown by the Catalyst application debug logs. I tried to work around the problem by bypassing C::V::TT and using the following code to process the template inside the controller, but to no avail: my $tmpl = Template-new({ INCLUDE_PATH = $c-config-{home} . '/root', RELATIVE = 1 }); my $output = ''; $tmpl-process('index.tt', { %{$c-stash}, c = $c }, \$output); $c-res-body($output); Try Template::Alloy instead. It's a fully compatible faster implementation of TT. replace my $tmpl = Template-new({ INCLUDE_PATH = $c-config-{home} . '/root', RELATIVE = 1 }); with my $tmpl = Template::Alloy-new({ INCLUDE_PATH = $c-config-{home} . '/root', RELATIVE = 1 }); and install Template::alloy, of course. ___ 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] Pushing data to Catalyst powered web page
Good afternoon all I am busy with a project where I need to read an RFID tag, get the data associated with the tag and then push the data to a web page for a security person to monitor. I can successfully read the tag by using LogicAlloy's ALE server. It then calls my Catalyst application at http://localhost/ale/notifier : sub notifier : Private { my ( $self, $c ) = @_; #$c-stash-{template} = 'notifier.tt2'; $c-stash-{tagdata} = $c-request-params-{tagdata}; open (TagData, 'C:\Eclipse Projects\Asset Tracker\AssetTracker\lib\AssetTracker\tagdata.txt'); print TagData $c-request-params-{tagdata}; close TagData; } As you can see I do not get the associated tag data yet, I am just trying to display the tag data received from the ALE server. I can see that the data is coming through correctly by monitoring the console debug and checking the tagdata.txt file. The problem that I have is that I have no idea how to push the data to a web page instead of pulling. Hi, you might want to have a look at http://meteorserver.org/. This server pushes data to a client via a persistent http connection. To handle such things with catalyst is not a very good idea. the ALE server will talk to the meteor server and not the catalyst application. If you do not need realtime push you could reload a catalyst page every x seconds. This page opens the file tagdata.txt and prints its content. Add a html meta tag to reload the page every x seconds. moritz ___ 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] Duplicate entries with C::P::Session::Store::DBIC and MySQL - new findings
Am 27.08.2008 um 10:19 schrieb Tobias Kremer: Quoting Tobias Kremer [EMAIL PROTECTED]: Quoting Daniel Westermann-Clark [EMAIL PROTECTED]: The flash: rows were used for compatibility with Store::DBI. We can break compatibility if people find the it not very useful. I have to admit that I don't understand what compatibility with Store::DBI you're talking about. AFAICT the Store::DBI source doesn't separate between session and flash (does it support the flash at all?). Maybe you (or Andy) can shed some light on this! Ok, a second glance (after the first coffee) revealed that the separation is indeed there :) The question is, why? Just guessing: not every request has its own session object. There are users with no session attached to them. ___ 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] RFC FYI: HTML::FormFu::ExtJS
Hi, HTML::FormFu::ExtJS uses the validation and processing power of HTML::FormFu and combines it with the great abilities of the JavaScript framework ExtJS to generate more intuitive forms. There is no difference in the form config file. You simply replace HTML::FormFu-new with HTML::FormFu::ExtJS-new and you are done. The result of $form-render is a string of JavaScript which generates a Ext.FormPanel. Have a look at the examples which show the output of FormFu next to FormFu::ExtJS: http://search.cpan.org/src/PERLER/HTML-FormFu-ExtJS-0.01/examples/html/ All FormFu elements are supported. See the docs for more information and caveats. I use this module in a productive project already. But this project does not cover all possible variations of forms so there might be some bugs. There will be a HTML::FormFu::ExtJS::Grid module in the near future which helps you to generate the config parameters for an ExtJS grid view from a formfu config file. Suggestions, comments, bugs are welcome! moritz ___ 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] Announce: Instant AJAX web front-end for DBIx::Class
Am 18.08.2008 um 23:22 schrieb Oliver Gorwits: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi folks, I'd like to announce a new Cat application which is now on the CPAN. The ListFramework Builder (LFB) takes your DBIx::Class Schema definition and produces an AJAX CRUD web interface, on the fly. The specific goals are minimal configuration and very quick deployment. LFB doesn't use scaffolding - the interface is dynamically generated from files in the distribution. Table relationships are well supported (belongs_to, has_one, might_have, and has_many), as are auto incrementing primary keys, and many data types. It's early days, and I'm working mostly on the ExtJS frontend at the moment, with a new release every couple of days or so. You can see a live demo of the current release of LFB, here[1]: ~ http://dragonstaff.co.uk/oliverg/album Feedback and early adopters are welcome! Drop me a line if you have any questions or comments. Here it is, on CPAN: Hi, Great goob! A few comments: * Is it possible to add this as a plugin to an existing catalyst application (as an admin panel)? * Why do you not use the filter abilities of extjs for the grid? they are much more convenient * Had you have a look at ExtJS 2.2? It has much better support for ExtJS 2.2 and Checkboxgroups * You created these comboboxes for has_many relationships. Did you think about prodiving a different interface for selecting the items depending on the number of possible values? What I'm saying: If you specify the color of a item (red, blue, and green) and would be great to have a radiogroup to select it. If there are many (10) It would be great to have a select box. If there are even more (1000) an autocomplete field would be great. Nevertheless a great tool. Catalyst lacked such a feature. moritz ___ 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] Configuring a Controller from the config file
Which contains the class-level defaults. Not application defaults. You should never, ever EVER access $self-config in a model, view or controller object. Your config value will be in $self-{key}. It's considered normal to do package My::Controller::Foo; use strict; use warnings; use parent qw(Catalyst::Controller); __PACKAGE__-mk_accessors(qw(foo bar)); __PACKAGE__-config( foo = 'default_for_foo', bae = { default = 'for_bar' }, ); Thanks a lot! works great :-) ___ 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] Debug with FCGI
Am 01.08.2008 um 12:45 schrieb Angel Kolev: Hi all. I run my cat app as standalone FCGI server+apache2: script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5 How can i run it in debug mode same as catalyst development server? ___ 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/ Try CATALYST_DEBUG=1 script/myapp_fastcgi.pl -l /tmp/myapp.socket -n 5 ___ 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] Configuring a Controller from the config file
Hi, I tried to set some config options for a controller with the config file. YAML-code: --- name: MyApp Controller::Root: key: value I'm using ConfigLoader and the debug shows that it successfully loaded the yaml file. In a method in my Root controller I tried to access those config options via $self-config. I had no luck. $c-config shows the hole config. I could access the config options via $c-config-{Controller::Root} but shouldn't it avaiable via $self- config? What am I missing? moritz ___ 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] Preventing simultaneous logins
Am 25.07.2008 um 10:27 schrieb Daniel McBrearty: 1. checking whether there is an existing session associated this username Session::PerUser ? I looked briefly at this, but I'm a bit wary because C::P::Session::Store::Fastmmap warns against being used with it. What is PerUser doing that is special in that respect, and what is a good backend for it? REading the docs for it, it seems like something slightly different - keeping the same session in place, even if the user logs in in the middle of it, if I understand correctly? You shouldn't store a session in a store which might lose the session because it runs out of memory. Use a store which stores the session permanently like DBIC. cheers ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email from a Catalyst app
Am 02.07.2008 um 12:09 schrieb ivorw: I know there's more than one way to do this. I'm looking at what the best practice is. I've had some success inthe past with Catalyst::Plugin::Email, but I'm now looking at Catalyst::View::Email[::Template] which seems altogether much cleaner, able to be controlled from the config. Does C::P::Email work on that machine? Did you try to telnet your machine and send a mail via the command line? greetings, moritz ___ 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] Strange Problem: gb2312 showed incorrect in mod_perl, but correct in developer server
Apache might force the encoding of specific mime types. Check the apache config and look for the content type View::JSON generates. cheers, moritz Am 02.06.2008 um 18:39 schrieb J. Shirley: 2008/6/1 cui robin [EMAIL PROTECTED]: 2008/6/2 J. Shirley [EMAIL PROTECTED]: 2008/6/1 cui robin [EMAIL PROTECTED]: Hi, When a page loaded in firefox, then it will send a ajax request to get data in json format. Some gb2312 words is in the json data. When catalyst is started by /home/robin/CBS/script/cbs_server.pl, the data got by client is same as the data i print on the screen by $c-log-debug(). It's showed corrected in firefox client or ie client. But when catalyst is running by apache mod_perl, the data got by client is different from the data i print on the screen by $c-log- debug().It's showed incorrected. A chinese world in gb2312 charset have 2 bytes. what I found in the client is that: 2 bytes of a chinese word was splited, and a octal byte \303 or \302 was added before every byte. So showed incorrect in client. Anyone meet the same problem when using mod_perl? Thanks! Robincui How are you generating the JSON? We had a similar circumstance (although our production server would also exhibit failures under the built-in server) because of varying JSON.pm versions. Make sure you use a JSON module that properly understands unicode. I try to use Catalyst::View::JSON wherever possibly, and if it isn't then JSON::XS::encode_json( $perlref ) works the most reliably. -J I use standard JSON module [use JSON;] from cpan,version is 2.07. code like below: my $json = new JSON; $json-canonical(1); my $response = $json-encode($var); But i think the problem is nothing to do with JSON, for some points like below: 1. The problem will not occur when I use catalyst's built-in server 2. After JSON module convert a hash to JSON data, I use $c-log- debug output to screen, I saw it was correct. I think the problem occur when apache (mod_perl) send data to client. the data was modified. But I don't kown why? Some code like below: my $jsResponse = $ajaxRequest-{response} . \n $callback_function; $c-log-debug(JS Response:\n$jsResponse); # the showed on the screen is correct; $c-response-content_type('text/html; charset=GB2312'); $c-response-body($jsResponse); The mod_perl,apache,perl version like below: [Mon Jun 02 12:28:31 2008] [notice] Apache/2.0.55 (Unix) PHP/5.2.3 mod_perl/2.0.3 Perl/v5.8.8 configured -- resuming normal operations Any other solution? Use Firebug, or related tools, and send the request and response headers outside of mod_perl as the browser sees them. That will help gather prudent information ___ 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] Shirts for YAPC::NA
CafePress sucks. The quality of the print is pretty bad. I bought a few catalyst shirts and they look like pretty bad after a few weeks... Could you find another partner? Am 02.06.2008 um 09:11 schrieb Mike Whitaker: I'll be placing a CafePress order later in the week to save on US- abroad postage for myself (as I have a tame US shipping address in Chicago). If any non-US folks going to YAPC::NA want to piggyback on the order, please let me know before close of UK business Thursday: I'll take USD cash @ the conference, or PayPal. -- Mike Whitaker| Perl developer, writer, guitarist, photographer [EMAIL PROTECTED] | Board member, http://www.enlightenedperl.org/ Y!: tuxservers | Blog: http://perlent.blogspot.com/ IRC: Penfold | CatSwag: http://www.cafepress.com/catalystdev ___ 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] Dispatching with Chained vs HTTP method
Hi Zbyszek, do you plan FormFu support? In case the submitted values are not valid the response is a xml/json/whatever which includes the error messages. That would be really great :) cheers, moritz Am 30.04.2008 um 11:24 schrieb Zbigniew Lukasiak: Hi Toby, I don't know if you are aware - but building a REST-like CRUD interface to DBIx::Schema is my long term goal (started with Catalyst::Example::InstantCRUD). Do you think we could collaborate? Cheers, Zbyszek On Wed, Apr 30, 2008 at 10:26 AM, Toby Corkindale [EMAIL PROTECTED] wrote: just looking for some advice on the best way to do something.. So I wrote a controller class using Chained that basically auto- converts any DBIx::Schema (which includes a tiny extra base class itself) into a REST API.. Well, a simple one anyway - it supports find and search so far, and foreign keys in the objects get serialised into hashes of the URIs to fetch them. All working nicely so far, but this is all for GET queries. But the behaviour should be different depending upon whether you GET /item/1234 or DELETE /item/1234 etc. I was thinking something like this: (Abbreviated code below) sub item_by_id : Chained CaptureArgs(2) { my ($self, $c, $type, $id) = @_; $c-stash-{item} = $c-model(DB:$type)-find($id); } sub delete : Chained('item_by_id') Args ActionClass('MethodDELETE') { my ($self, $c) = @_; $c-stash-{item}-delete; } sub modify : Chained('item_by_id') Args ActionClass('MethodPUT') { my ($self, $c) = @_; $c-stash-{item}-update($c-request-params); } Then the appropriate ActionClasses would check if the $c-req- method eq 'GET' or 'DELETE' or whatever. But I was just wondering if you had other ideas, and if using ActionClasses with Chained actions is crackfuelled and going to lead to a world of misery and pain. Cheers! Toby ___ 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/ -- Zbigniew Lukasiak http://brudnopis.blogspot.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/ ___ 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] Dispatching with Chained vs HTTP method
Maybe you could make it modular so we can easily add another processor like formfu Am 30.04.2008 um 12:03 schrieb Zbigniew Lukasiak: On Wed, Apr 30, 2008 at 11:46 AM, Moritz Onken [EMAIL PROTECTED] wrote: Hi Zbyszek, do you plan FormFu support? In case the submitted values are not valid the response is a xml/json/whatever which includes the error messages. That would be really great :) I have not yet settled down with the choice of the form processor. I've started with FormFu - but now I am playing with Rose::HTML::Form - and I found it much more flexible. -- Zbigniew Lukasiak http://brudnopis.blogspot.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/ ___ 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: CatalystSites.org
Totally depends. I ported an app to Catalyst that previously was basically one-action-per-controller. It cannot be called anything less than a lot of work, but it paid of royally. The code is as DRY as it was before, but it’s now far better structured. Previously it was blocks of if-elsif chains grouping together execution steps that are shared by some URIs but not others – now it’s Chained. A typical controller looks something like this: sub base : Chained PathPart('doc') CaptureArgs(0) { ... } sub list : Chained('base') PathPart('') Args(0) { ... } sub item : Chained('base') PathPart('') CaptureArgs(1) { ... } sub view : Chained('item') PathPart('') Args(0) { ... } sub edit : Chained('item') Args(0) { ... } This gives `/doc` (goes `base` then `list`), `/doc/*` (goes `base` then `item` then `view`), and `/doc/*/edit` (goes `base` then `item` then `edit`). And then you can put stuff shared by all actions in `base`[^1], and stuff shared by all actions that relate to a single document (eg. stuffing that document into the stash) all in `item`. By liberal use of `PathPart('') CaptureArgs(0)` you can force any URI to step down any number of intermediate steps you require, so you can use that to group together shared code any way you see fit: sub foo : Chained CaptureArgs(0) {} sub bar : Chained('foo') PathPart('') CaptureArgs(0) {} sub baz : Chained('bar') PathPart('') CaptureArgs(0) {} sub qux : Chained('baz') Args(0) {} This will dispatch `/foo/qux` across the entire foo bar baz qux chain. Now consider: ... This is the best example I've seen! It would be great if you could write this up and put it in the manual or wiki! I think I finally know how chained works :-) thanks! ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] RIA on Catalyst
Hi Peter, I'm using Catalyst and ExtJS. I use JSON as the default view and pass everything to the stash so it gets to the UI. I'm not using any REST or SOA or anything like that because my app will never communicate with other apps. Are you sure that all the http methods work with xmlhttprequest? Doing a quick google search I found this: http://lists.macosforge.org/pipermail/webkit-unassigned/2006-March/006215.html I can recommend ExtJS. It has very good docs and is pretty straight forward. I'm using HTML::FormFu too. It does all the validation and I wrote a small wrapper which creates ExtJS forms from formfu form objects. Server side validation can be done pretty easy this way. cheers, moritz Am 10.04.2008 um 19:25 schrieb Peter Edwards: I've been thinking about how to implement a Rich Internet Application type interface using WSDL and REST data sources including some from a Catalyst base in an SOA style environment. I like Extjs but I've also been looking at Tibo General Interface http://www.tibco.com/devnet/gi/default.jsp which has a good open source tool for generating RIAs http://gi.tibco.com/ Anyone used it with/without Catalyst and any comments? Thanks, Peter http://perl.dragonstaff.co.uk ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ 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: Catalyst::Plugin::AutoValidate
Hi Markus, great plugin. But is it really a plugin? I'd prefer to use it as a controller base class because it is controller specific. This way you could chose which controllers should use this plugin and let the others do their work without being disturbed by this plugin (and you could still use it in the Root controller). I think the C::Plugin namespace is already poisened enough :) just my 2 cents, Cheers moritz Am 09.04.2008 um 11:06 schrieb Markus Holzer: Hello fellows, please bear with me, as this is my first contribution to Catalyst. From the pod: This Plugin validates request parameters against a specification in a file that directly relates to the requests path (like the .fb files when using Formbuilder). I'm curiuos of your opinions. Thank you, Holli ___ package Catalyst::Plugin::AutoValidate; use warnings; use strict; use YAML qw( LoadFile ); use Catalyst::Request; use Config::Validate; use Data::Dumper; use NEXT; our $VERSION = 0.01; sub prepare { my $class = shift; my $c = $class-NEXT::prepare( @_ ); my ( $config, $rpath, $spec_root, $spec_file, $validation_spec, $validator ); # config for this package $config= $c-config-{'Catalyst::Plugin::AutoValidate'}; # the request path $rpath = $c-request-path || $config-{index_spec} || 'index'; # root dir to look for specifications $spec_root = $config-{spec_root} || $c-{home}/cvspec; # spec file, deduced from path $spec_file = $spec_root/${rpath}..($config- {spec_extension}||cvs); # check if there are custom types configured if ( $config-{types} ) { # add to the validation module if ( ref( $config-{types} ) eq ARRAY ) { for ( @{$config-{types}} ) { Config::Validate::add_default_type(%$_); } } else { Config::Validate-add_default_type(%{$config-{types}}); } # move the types, so they won't get reprocessed another time $config-{xtypes} = delete $config-{types}; } # there is no matching spec file unless ( -e $spec_file ) { # that's ok or not, depending if we are paranoid $c-request-{validated} = $config-{paranoid} ? 0 : 1; } else { # load spec and validate the request against it $validation_spec = LoadFile( $spec_file ); $validator = Config::Validate-new( schema = $validation_spec ); # will die if validation fails eval { $validator-validate( config = $c-request- {parameters} ) }; unless ( $@ ) { $c-request-{validated} = 1; } else { $_ = $@; s/^.+?validate\(\): //; s/instead.+//; $c-request-{validation_error} = $_; $c-request-{validated} = 0; } } return $c; } 1; __DATA__ =head1 NAME Catalyst::Plugin::AutoValidate - Catalyst-Plugin for easy automatic validation of Request-Parameters =head1 VERSION Version 0.01 =head1 SYNOPSIS This Plugin validates request parameters against a specification in a file that directly relates to the requests path (like the .fb files when using Formbuilder). For the heavy lifting it uses Lhttp://search.cpan.org/~cmo/Config-Validate-0.2.6/lib/Config/Validate.pm ; All validation options from that module are supported, as they get simply passed through. # application code package MyApp; use strict; use warnings; use Catalyst qw(AutoValidate); # MyApp::Controller::Root.pm # check parameters and display error message when # appropriate. Does NOT RUN THE CONTROLLER in that case, # otherwise proceed with controller sub begin : Private { my ($self, $c) = @_; $c-response-body( $c-request-{validation_error} ), $c-detach unless $c-request-{validated}; } # $c-{home}/cvspec/math/multiply.cvs (YAML) a: type: integer b: type: integer # MyApp::Controller::Math.pm sub multiply : Local { my ($self, $c) = @_; # this is safe because Autovalidate ensures both are integers $s-stash-{result} = $c-req-param('a') / $c-req-param('a') } =head1 CONFIGURATION __PACKAGE__-config( 'Catalyst::Plugin::AutoValidate' = { # root dir for looking up specifications spec_root = '', # when set, all requests without specification die paranoid = 0, # the name of the index spec (for empty paths) index_spec = 'index', # extension for spec-files spec_extension = 'cvs', # custom types types = [ # generator sub that generates a closure, could come in handy for lookups { name = 'custom', validate = sub { my $lookup = { exists = 1 }; return sub { die Not in lookup table! unless $lookup-{$_[1]} }; }-() }, # or easier sub { die Doesnt match! unless $_[1] =~ /[abc]/ }; ] } ); =cut =head1 AUTHOR Markus Holzer, C holli.holzer at googlemmail.com =head1 BUGS Please
Re: [Catalyst] Session expiry per user
Am 14.03.2008 um 13:53 schrieb Bill Moseley: Catalyst::Plugin::Session::DynamicExpiry isn't working for me using cookies. The patch was never applied so I go with this: sub auto : Private { my ( $self, $c ) = @_; if ( $c-user_exists ) { $c-config-{session}-{expires} = $c-session-{per_user_expiry} || $c-config-{session}-{expires}; $c-session_expires(1); return 1; } } set $c-session-{per_user_expiry} if you want a different expiry. $c-session_expires(1) does all the stuff like setting cookies etc. ___ 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] Push services with catalyst
But I still need a lot of code which is run by catalyst, like authentication and of course the whole dbic schema. What about Catalyst::Engine::HTTP::POE? cometd.com is not very informative ... Am 05.03.2008 um 23:47 schrieb Peter Edwards: Jay wrote: On Wed, Mar 5, 2008 at 11:48 AM, Moritz Onken [EMAIL PROTECTED] wrote: I'm combining ajax with push. So it's a real push service, the website is not pulling the data on a constant time rate. A process per client is really bad. I'll need to serve hundreds of client at the same time. Seems like push is not an option... Take a look at cometd: http://cometd.com/ Thanks for mentioning that, it looks interesting, particularly as it's hooked up to perlbal. Moritz, I've done something similar before using POE to handle many connections more cheaply than Apache (thanks to Matt Trout for the suggestion). It was to serve XML formatted requests though you could return JSON formatted data just as easily http://search.cpan.org/perldoc?POE::Component::Server::TCP Regards, Peter http://perl.dragonstaff.co.uk ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] uri_for problem
[%- ourl = Catalyst.uri_for('/search') _ ?stype=seqidquery= -%] ? Am 05.03.2008 um 10:50 schrieb Emmanuel Quevillon: Hi, I am trying to build some url from TT using uri_for sub but I encounter some problem with it. When in my tt I have : [%- ourl = Catalyst.uri_for('/search?stype=seqidquery=') -%] when I click on it, I get an url that looks like : search%5C%3Fstype=seqidquery= Is there a way to get the proper url produce in the HTML page without '%5C%3F' ? I tried quoting and double quoting the url and escaping the question mark but without success. Thanks a lot. -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ 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] Push services with catalyst
Hi, I consider offering a push service for real-time data. It's AJAX based and requires a consistent connection. I'm not sure about the memory usage of this. I plan to run the catalyst app as fastcgi server. Does every consistent connection create an extra fastcgi process? Which means an additional ~30mb (if that's the size of a fastcgi process)? moritz ___ 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] Push services with catalyst
I'm combining ajax with push. So it's a real push service, the website is not pulling the data on a constant time rate. A process per client is really bad. I'll need to serve hundreds of client at the same time. Seems like push is not an option... Am 05.03.2008 um 19:39 schrieb Brian Kirkbride: Moritz Onken wrote: Hi, I consider offering a push service for real-time data. It's AJAX based and requires a consistent connection. I'm not sure about the memory usage of this. I plan to run the catalyst app as fastcgi server. Does every consistent connection create an extra fastcgi process? Which means an additional ~30mb (if that's the size of a fastcgi process)? moritz If it's AJAX then you are really polling as opposed to pushing. In this case Lighttpd or Nginx are your friends. They can handle all of the connections (with a long KeepAlive) and only talk to the backend FastCGI when a poll request comes through from the AJAX client. If you're really pushing with a constantly connected client, you'll need a FastCGI process per client. The difference is who initiates communication over the channel. If the server can send to the client at any moment, that's true push. Most people get along with a rapidly polling client that says Anything for me? every so often. In general polling is wasteful of bandwidth, while push is wasteful of server-side resources. Best, Brian ___ 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] $c-user-some_relationship always retrives user id from the db
If someone tells me where to put that kind of code Matt suggested I'll write a patch and some (1? :-) ) tests. Am 15.02.2008 um 02:16 schrieb Guillermo Roditi: Which means the entire thing would be pointless. What you want to do really is $class-new({ %saved_stuff, -result_source = $schema- source($class) }); $new_obj-in_storage(1); then it'll work as if you re-fetched the object (%saved_stuff being the return of $obj-get_columns). Making stuff work with only the PK stashed in the session is left as an exercise to the reader, but would probably be best done using Data::Thunk and Data::Swap. /me confoos. Why not just use the shiny new freeze / thaw hooks? Wouldn't it make sense to store a frozen version of the User row / object in the session and then thaw it upon request? This seems like it would be a really natural way to cache this information. Ideally, the thawing would be a lazy operation as well i think. I just bring this up because the code you just sent would not work when one is using things like DigestColumns or EncodedColumn, which are most commonly seen in User-type objects --Guillermo Roditi (groditi) ___ 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] $c-user-some_relationship always retrives user id from the db
Thanks, nice work. Works perfectly. Am 16.02.2008 um 18:37 schrieb Jay K: Hi There, I suppose now is as good a time as any - The Catalyst::Authentication::Store::DBIx::Class module currently on CPAN has the 'avoid the db hit' code is in it. It is not enabled by default, but add 'use_userdata_from_session = 1' to your config and it will not reload from the database unless you specifically request it. See the docs: http://xrl.us/bgbn9 (aka http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class-0.104/lib/Catalyst/Authentication/Store/DBIx/Class.pm#CONFIGURATION ) as there are some things you should know about operating in that mode. Jay On Feb 16, 2008, at 8:20 AM, Moritz Onken wrote: If someone tells me where to put that kind of code Matt suggested I'll write a patch and some (1? :-) ) tests. Am 15.02.2008 um 02:16 schrieb Guillermo Roditi: Which means the entire thing would be pointless. What you want to do really is $class-new({ %saved_stuff, -result_source = $schema- source($class) }); $new_obj-in_storage(1); then it'll work as if you re-fetched the object (%saved_stuff being the return of $obj-get_columns). Making stuff work with only the PK stashed in the session is left as an exercise to the reader, but would probably be best done using Data::Thunk and Data::Swap. /me confoos. Why not just use the shiny new freeze / thaw hooks? Wouldn't it make sense to store a frozen version of the User row / object in the session and then thaw it upon request? This seems like it would be a really natural way to cache this information. Ideally, the thawing would be a lazy operation as well i think. I just bring this up because the code you just sent would not work when one is using things like DigestColumns or EncodedColumn, which are most commonly seen in User-type objects --Guillermo Roditi (groditi) ___ 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/ --- May we not return to those scoundrels of old, the illustrious founders of superstition and fanaticism, who first took the knife from the altar to make victims of those who refused to be their disciples. - Voltaire ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] $c-user-some_relationship always retrives user id from the db
Hi, I request all albums of a user by calling $c-user-albums-all; That results in a query which retrieves the user id and then querys the album table with that user id in the where clause. It works, but how can I prevent that first query which retrieves the user id? Can't I store the user id in the session so that the query could use that value instead of receiving it from the database? I looked through the docs but couldn't find anythink. I hope this is the right place to ask. Thanks in advance, moritz ___ 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] add components to files generated by C::Helper::Model::DBIC::Schema
Hi, I need to add some components to some packages created by Catalyst::Helper::Model::DBIC::Schema. I tried adding them under the md5 checksum so updates wont break, but some of them needed to be placed before Core is loaded. I didn't find anything about this in the docs. Any help? Thanks in advance, Moritz ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] TT VMethods
different country, different separators :-) e.g: 10,000.00 is ten thousand in the usa 10.000,00 is ten thousand in germany Am 17.01.2008 um 15:42 schrieb Chisel Wright: On Thu, Jan 17, 2008 at 01:14:22PM +0100, Moritz Onken wrote: please implement localization (different separators) Huh? -- Chisel Wright e: [EMAIL PROTECTED] w: http://www.herlpacker.co.uk/ I even make myself laugh sometimes... ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::View::Email broken?
Hi, could you also implement a way to put the subject in the template? Something like (TT): [% subject = My Subject %] [% BLOCK content %] Email content [% END %] This makes localization possible for the subject, when can we expect a new version? Greets, Moritz Am 10.01.2008 um 01:50 schrieb J. Shirley: On Jan 9, 2008 3:26 PM, Bernhard Graf [EMAIL PROTECTED] wrote: J. Shirley wrote: Hi Bernhard Could you file this as an RT bug? I'm working on the next version which will also have attachment support and don't want to miss this. Done. But thinking about this module brought me to the conclusion, that it doesn't buy me anything (besides headaches). Instead I've put a tiny little send_mail method in MyApp's base class, that calls Email::MIME::Creator and Email::Send. Less code that can break (and actually does) and more elegant to say $self-send_mail($email_mime_object); instead of $c-stash-{email} = $email_mime_hash; $c-forward('View::Email'); -- Bernhard Graf Thanks for the bug! I definitely see your point about the simpler send_mail method, and I think for a lot of cases it probably is easier that way. I really want to tie into the template rendering process with it, and that was my main impetus for writing the module in the first place. Once I can tie into other views to render attachments, I think it will be worth it (An attachment sourced from a PDF View, for example). Until then, it's just slow progression that way. Thanks for the feedback, though. If you are just doing a plugin cycle, you may want to look at Catalyst::Plugin::Email. -J -- J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one bird... http://www.toeat.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/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::View::Email broken?
You could run the code which sends the mail within a template which gets post processed. There you can access subject and content and attachments if you like and pass them to the mail function. the post processed template could check whether subject or content is avaiable. if so pass it all together to create the mail. Otherwise use the stashed subject and the template output for the mail. I'd prefer this way because you have all your localization in one place. Moritz Am 10.01.2008 um 17:20 schrieb J. Shirley: On Jan 10, 2008 1:36 AM, Moritz Onken [EMAIL PROTECTED] wrote: Hi, could you also implement a way to put the subject in the template? Something like (TT): [% subject = My Subject %] [% BLOCK content %] Email content [% END %] This makes localization possible for the subject, when can we expect a new version? Greets, Moritz Am 10.01.2008 um 01:50 schrieb J. Shirley: On Jan 9, 2008 3:26 PM, Bernhard Graf [EMAIL PROTECTED] wrote: J. Shirley wrote: Hi Bernhard Could you file this as an RT bug? I'm working on the next version which will also have attachment support and don't want to miss this. Done. But thinking about this module brought me to the conclusion, that it doesn't buy me anything (besides headaches). Instead I've put a tiny little send_mail method in MyApp's base class, that calls Email::MIME::Creator and Email::Send. Less code that can break (and actually does) and more elegant to say $self-send_mail($email_mime_object); instead of $c-stash-{email} = $email_mime_hash; $c-forward('View::Email'); -- Bernhard Graf Thanks for the bug! I definitely see your point about the simpler send_mail method, and I think for a lot of cases it probably is easier that way. I really want to tie into the template rendering process with it, and that was my main impetus for writing the module in the first place. Once I can tie into other views to render attachments, I think it will be worth it (An attachment sourced from a PDF View, for example). Until then, it's just slow progression that way. Thanks for the feedback, though. If you are just doing a plugin cycle, you may want to look at Catalyst::Plugin::Email. -J -- J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one bird... http://www.toeat.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/ ___ 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/ Moritz, That patch isn't likely to go in, since subject belongs in the headers which is outside of the rendering cycle or that mime-part. If you want to do localization of the subject, just do: $c-stash-{email}-{subject} = $c-localize(Subject Here); -J -- J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one bird... http://www.toeat.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/ ___ 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] Template render problem (plugin error) - Hops-0.05 application
try installing Template::Plugin::Class Am 21.12.2007 um 12:39 schrieb Peter Sørensen: Hi, I am new to Catalyst. I have just installed it and got my first very simple application to work. (Catalyst 5.7012 , perl 5.8.5) Now I'm trying to learn by example, and have downloaded the Hops-0.05 application and got this working - I thought. But when accessing it from my browser I get the following error: .. [debug] Rendering template list [error] Could'nt render template plugin error - Class: plugin not found .. Obviously I'm missing something. Could someone shed some light on this and point me in the right direction? Maybee howto get more debug output or other ways to track down the problem. Regards and thanks Peter ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/