Re: [Catalyst] password strength
Adam Witney wrote on 4/5/17 8:14 AM: Hi, I am trying to build in rules to check password strength when users reset their password.s Do people generally roll their own, or is there something already written? I can find things like Data::Password and Password::Policy, but not sure which is better to use There's no Perl port yet, but I highly recommend https://github.com/dropbox/zxcvbn -- Peter Karman . https://karpet.github.io . https://keybase.io/peterkarman ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] Chained and exceptions
On 5/10/13 10:10 AM, Bill Moseley wrote: What would the developers think of deprecating this behavior (for the few that might actually be relying on this) and issue a warning if a config option is not set that fixes the issue? +1 I have lots of ugly code that checks for $c-error in order to break chains. Not having to do that, or making it configurable, would be nice. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst and LDAP with sessions
Birger Burkhardt wrote on 2/28/12 7:48 AM: Hi Francisco, i am not quite sure, if it could be done using existing classes/modules. Can you please have a look at the following both links. Are you sure, i have to implement the storage of the passwod in a memcached server? http://cpansearch.perl.org/src/BOBTFISH/Catalyst-Model-LDAP-FromAuthentication-0.02/README According to this changelog (see entry in Version 1.007): http://cpan.uwinnipeg.ca/htdocs/Catalyst-Authentication-Store-LDAP/Changes.html the user object has to be serialized and stored in the session to be used for further connects to the LDAP server. No need to store the user credentials or object separately, unless you have other needs (as Birger seems to). The fix in 1.007 mentioned here: https://rt.cpan.org/Ticket/Display.html?id=53279#txn-734373 was for the case where the User object was being stored in the session. That isn't done by default (as I mentioned earlier in this thread). Birger, it seems like your use case is a little different than what the LDAP authn module assumes. You don't just want to do initial authn and then create a Catalyst-specific session/cookie; that's what the module does. Instead you seem to want to re-bind at every HTTP request as the logged-in user, in order to perform subsequent LDAP actions that go beyond simple authentication. You can do that with the LDAP authn module, but that isn't its original intent. I'd suggest explicitly storing the user's credentials in the session on initial login, and 2-way encrypting the password so that you can decrypt it out each time you need to bind to your LDAP server (maybe in an auto() method in your affected controller(s)). I use Crypt::CBC for that in my apps (mostly because I am able to use the same algorithm from both PHP and Perl), but I am sure there are other 2-way encryption modules that would work just as well. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst and LDAP with sessions
Birger Burkhardt wrote on 2/24/12 7:22 AM: After successful authentication, all further request should be executed via the credentials of the logged in user. are you somehow storing those credentials so that they persist over the life of the session? The LDAP authn plugin does not do that for you, afaik. The credentials exist only for the life of that particular login HTTP request. or maybe I'm misunderstanding what you're trying to do? In the login controller the user is authenticated [...] # Get the username and password from form my $username =3D $c-request-params-{username}; my $password =3D $c-request-params-{password}; # If the username and password values were found in form if ($username $password) { # Attempt to log the user in if ($c-authenticate({ username =3D $username, password =3D $password })) { [...] But when I do a new request from within another controller, i get an ldap error meaning the credentials are invalid: code in other controller: [...] my $ldapconn =3D $c-user-ldap_connection(); my $mesg =3D $ldapconn-search( base =3D ou=3Dusers,dc=3Dexample,= dc=3Dcom, filter =3D (uid=3D*)); my @entries =3D $mesg-sorted('uid'); $c-stash(users =3D \@entries,); $c-stash(template =3D 'userList.tt2'); [...] -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Actions for asserting relationships
Bill Moseley wrote on 5/30/11 11:46 PM: I'm looking for more guidance wrt URLs. Say in the music database example that tracks have a many-to-many relationship to albums. A track can be associated with zero or more albums. In the API for this we can POST, GET, PUT, and DELETE /track and /album. But, what about asserting relationships between the two? POST /album/$album_id/add_track { track = $track_id }; POST /album_track { album = $album_id, track = $track_id ); POST /album/$album_id/track/$track_id (or /track/$track_id/album/$album_id). The last one seems best as it allows associating other data with the relationship, and make DELETE make sense. And what HTTP status code should be returned if a) the relationship is created? b) the relationship already exists? I'm not sure it's important that there's a distinction if only need to assert that the relationship exists. But, a 201 really implies that the resource was created. I suppose to make this more RESTful the $track_id and $album_id should be URIs in that second example, but makes less sense in the first and third examples. (1) consider if/how PUT should be used instead of POST. I've found [0] to be a helpful guide to the distinction. This seems to affect your (b) question mostly. (2) I tend to use the 3rd URL example in my apps. I return 201 on creation and 204 on a no-op (your (b) example), or 200 on update or delete success (on DELETE I return the deleted resource, similar to how Perl's delete() function works on hash items). In the end it feels to me like there are probably 1 or 2 best ways to do this kind of thing, and I emphasize in my apps the consistency and repeatability of the approach (and document it!) rather than fretting too much about whether I have got it perfect. [0] http://jcalcote.wordpress.com/2008/10/16/put-or-post-the-rest-of-the-story/ -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: Making secure session cookies (or, how do we make Explorer stop complaining about nonsecure content on a secure page?)
will trillich wrote on 2/21/11 5:50 PM: Okay -- we'd tried this approach using Chrome already, and it is not showing *any* http:// requests from the https:// page. Life HTTP Headers (FireFox) shows either https://server.name/path requests or server-relative /path requests. Period. Same url, yet internet explorer complains... I've got a knack for finding weird stuff like this. Anybody else seen this? I've been bitten by this when the .js or .css I am loading will load an img. E.g., ExtJS loads a s.gif file by default from http and I have had to edit the .js file(s) to use a https version instead. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Form Filosophy - pardon the pun:)
Steve wrote on 01/05/2011 08:03 AM: Hello all, I'm interested to hear from those producing real live applications, (that they plan to support for years) what combination of form rendering tool sets are being used and why. http://wiki.catalystframework.org/wiki/#Module_documentation I use RHTMLO myself, largely because it works the way my brain does. Same with RDBO. I know I'm in the minority amongst Catalyst users, which probably says something unflattering about my brain. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: superuser switch-user session function?
will trillich wrote on 11/29/2010 05:37 PM: Aha! It looks like a sneaky, evil, wrong, mean, horrid way to switch-user in the middle of a session is to $c-session-{__user}{id} = $new_id_here; # since id = PK But that's undoubtedly bad form of the worst kind. What's the canonical non-sneaky above-board friendly golden way to do this? I don't know that there is a canonical way. This is Perl. As I mentioned in my reply to this thread in July[0], one way is to login as the new user and store the original username in the new user's session. That way the app knows that the new user is allowed to revert to the original user, but otherwise the app treats the current session just as it would if the new user had logged in normally. [0] http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg09968.html -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Which Form Validation Libs?
Eric Berg wrote on 11/29/2010 09:34 PM: You guys got any recommendations? Rose::HTML::Objects -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Per request data in controller base class
Bill Moseley wrote on 11/23/10 8:12 PM: Now, controllers can be chained together, so for example I might have a chain /cd/*/track/*/movement/* which all use the same base class, and where in the movement action I might want to be able to fetch the cd and track objects fetched when processing the chain. So, $c-stash-{item} isn't such a good name. One option might be for the base class to use its class name as a namespace in the stash. That is, $c-stash-{CD}-{item} and $c-stash-{Track}-{item}; Controllers may be chained together, but the URI that triggers the dispatched action represents a unique item. I.e., the URI may describe a movement in relationship to its parent track and its parent CD, but the URI describes the *movement*. But that might just be philosophical neither-nor-there. In general, I find name-spacing the stash a useful exercise, esp when dealing with multiple developers using the stash as they work on different parts of a single dispatch chain. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Running system commands under FastCGI with IPC::Cmd / IPC::Run
heidi brandenburg wrote on 10/21/2010 03:02 PM: I've run into this problem with FCGI too. Our solution at the time, since the fileno call was in an internal API, was to skip it when STDOUT was tied. Getting an updated FCGI instead sounds like a happier thing. I notice this in current FCGI comments: # Some things (e.g. IPC::Run) use fileno to determine if a filehandle is open, # so we return a defined, but meaningless value. (-1 being the error return # value from the syscall in c, meaning it can never be a valid fd no) # Probably a better alternative would be to return the fcgi stream fd. sub FILENO { -1 } In addition, you may want to look at SVN::Class, which does some fileno hackery for this same reason. http://cpansearch.perl.org/src/KARMAN/SVN-Class-0.16/lib/SVN/Class.pm -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] autocrud/ExtJS question
Oliver Gorwits wrote on 09/24/2010 07:47 AM: If anyone does have any suggestions for how this might be done better in the user interface, please let me know. CatalystX::CRUD::YUI handles many-to-many (and one-to-many) selection through a livegrid (ExtJS extension) widget, so that there is no need to know or care how many possible combinations there might be. You can demo the feature using one of the test apps in svn[0]: % svn co https://svn.msi.umn.edu/sw/perl/CatalystX-CRUD-YUI/trunk cxcy % cd cxcy % perl Makefile.PL % make test % perl t/MyDBIC/script/mydbic_server.pl and point your browser at http://localhost:3000/crud/test/foo/list [0] While the m2m support has been in CXCY for a long time, I just now added examples to the svn trunk test app. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Deleting the expired session files?
Octavian Rasnita wrote on 9/4/10 8:39 AM: Hello, I am trying to create a script that will be executed by a cron job which will delete all the expired session files, but without success. I use the Session::Store::File plugin. can't you just use the mtime of the file to determine whether it should be deleted? -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] working with strange port setups
Tomas Doran wrote on 8/21/10 12:44 PM: On 21 Aug 2010, at 10:51, Darren Duncan wrote: Therefore, can anyone tell me how to configure Catalyst so that it builds the urls I need, or alternately where in the Catalyst source I should look in order to create a patch to enable this? You want to be adding a test in t/aggregate/unit_core_engine_cgi-prepare_path.t and you're very likely to want to do the fix in Catalyst::Engine::CGI specifically, probably, these lines: if ( $port !~ /^(?:80|443)$/ $host !~ /:/ ) { $host .= :$port; } -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] superuser switch-user session function?
w...@serensoft.com wrote on 07/08/2010 12:27 PM: Hmm: Become-user? Is there a clean way to provide a means for sys-admins to become user to track down issues? It's much easier to diagnose when seeing what the user's seeing directly, when we look at it through our own eyes -- as opposed to relying on vague user-style descriptions (unrecognized date format vs doesn't work). I have implemented this feature in my app. I don't know how clean it is, but my controller looked something like this: package MyApp::Controller::Admin::Sudo; use strict; use warnings; use Carp; use Data::Dump qw( dump ); use base qw( Catalyst::Controller ); sub switch_user : Local { my ( $self, $c ) = @_; my $newusername = $c-req-params-{username}; if ( !$newusername ) { $c-error404; return; } if ( uc( $c-req-method ) ne 'POST' ) { $c-error404; return; } if ( exists $c-session-{sudo_switched_from} ) { $c-error( already switched user from . $c-session-{sudo_switched_from} ); $c-stash( error_msg = 'You must restore your original user first.' ); return; } my $oldusername = $c-user-id; $c-log-info(user $oldusername sudo to user $newusername); my $model = $c-model('Account'); my $groups = $model-get_groups_for( $newusername ); # logout as current user $auth-logout($c); # login as newuser $auth-login( $c, $newusername, $groups ); $c-session-{sudo_switched_from} = $oldusername; # redirect to user home page $c-res-redirect( $c-uri_for('/my') ); } sub restore_original_user : Local { my ( $self, $c ) = @_; my $orig_user = $c-session-{sudo_switched_from}; if ( !$orig_user ) { $c-error404; return; } my $current_user = $c-user-id; my $model = $c-model('Account'); my $groups = $model-get_groups_for( $orig_user ); # logout as current user $auth-logout($c); # login as original user $auth-login( $c, $orig_user, $groups ); # redirect to myMSI $c-res-redirect( $c-uri_for('/my') ); } -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: Follow Up: [Catalyst] Alternatives to DBIx:Class?
John Karr wrote on 4/19/10 4:37 PM: So let me ask a follow up: What materials would you provide to an Intermediate Level Programmer to help them learn either Fey or DBIC? Materials could be working code, articles, things in documentation, documentation for other things that happens to explain it well, chapters in books, etc. Rose::DB::Object (RDBO) hasn't been mentioned much in this thread. It has good manpage-type docs, and a decent intro tutorial: http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Tutorial.pod There is also Rose::DBx::Garden::Catalyst for bootstrapping an entire Cat app using RDBO: http://www.catalystframework.org/calendar/2007/7 -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Distributing and updating Cat apps
Bogdan Lucaciu wrote on 4/9/10 2:10 PM: To properly include the templates I would just use something like: View::TT INCLUDE_PATH = __path_to(root)__ ... or similar. The static content lives in /usr/share/perl5/Dist/Name/root/static, if you use a caching reverse proxy (like varnish) you can just let Static::Simple serve them, otherwise just point your web server's /static location to that dir. See also Catalyst::Plugin::Static::Simple::ByClass -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Taking advantage of idle periods by performing some action(s)
Ido Perlmuter wrote on 03/25/2010 10:04 AM: Kiffin, thanks for the heads up about Plugin::Scheduler, seems to fit my needs quite good. Starting an external worker that needs to connect to the schema and try hard to figure out what's going on in the already running Catalyst process is pointless, hard to implement and kinda ugly (in my opinion). I won't argue with the ugly part, since taste is personal, but if it is hard to connect to the schema and start background processes, I suspect your application architecture needs a re-think. Catalyst is for gluing HTTP onto an application. If you're doing more than that, the architecture needs reconsideration. My app is already up and running, why start a new process? it's those idle moments when nobody seems to visit my stupid websites that I want the app to employ itself with some useful tasks. Scheduler is triggered on requests. So by definition your app is not idle. Bill's point is that if you have non-HTTP request cycle actions as part of your business model, they don't belong in your Catalyst app. That doesn't mean you can't reuse parts of the code in your Catalyst app, but that the Catalyst engine itself doesn't need to be involved. cron is your friend. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Redirecting Catalyst's Log to a File
John Karr wrote on 03/08/2010 03:14 AM: I'm having a problem with deploying a Catalyst application (I'm learning Catalyst and this is the first application I've tried to put on the web, and it works on my test machine which has a similar configuration to my ISP, but just times-out at my isp returning nothing), and need to capture the logging output from the fastcgi script to a file instead of the apache log. I already tried plugging in Catalyst::Plugin::Log4perl::Simple, while it redirects cgi and Catalyst's internal server to a file it does not work under fastcgi. I use Catalyst::Plugin::Log4perl (no ::Simple) with fcgi and it works. Here's my config: # A simple root logger with a Log::Log4perl::Appender::File # file appender in Perl. log4perl.rootLogger=DEBUG, LOGFILE log4perl.appender.LOGFILE=Log::Log4perl::Appender::File log4perl.appender.LOGFILE.filename=/var/log/apache2/myapp.log log4perl.appender.LOGFILE.mode=append log4perl.appender.LOGFILE.layout=PatternLayout log4perl.appender.LOGFILE.layout.ConversionPattern=[%r] %d %c - %m%n -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Check session expiry without extending it
Bill Moseley wrote on 03/04/2010 08:39 AM: The developer explained that the AJAX session check was needed to prevent a user from making a lot of changes in the client that could not be saved due to a an expires session. Not sure I see the logic there. I've been solving that session-has-expired-so-ajax-call-fails problem by having a global listener on my ajax class that checks whether the session cookie has expired before every xhr request. I'm not completely happy with how this works (it feels kludgy; it assumes the cookie expiration time == session expiration time; and it relies on an alert() to halt the browser's progress (effectively making an async call synchronous)), but so far it's the most effective way I've found of preventing user meltdown when their carefully crafted request will be lost because the session has expired on the server end. // make sure we are logged in before every xhr request Ext.Ajax.on('beforerequest', function(conn, opts) { if (!AIR.Auth.isAuthenticated()) { AIR.Auth.login(); return false; } return true; }); // get session cookie. Returns false if the cookie is expired. AIR.Auth.isAuthenticated = function() { var auth_tkt = Ext.util.Cookies.get('auth_tkt'); return auth_tkt; } // spawn a popup window to the login page, halting the browser's // XHR call with an alert() AIR.Auth.login = function() { // open a popup panel var winOpts = 'height=400,width=400,resizable=yes,scrollbars=yes,menubar=yes'; // the closeWindow param tells the login script to generate // local page js on success that will close the popup window. var url = 'https://my.sso.url/login?back=closeWindow'; AIR.Auth.window = window.open(url,'login-window',winOpts); if (window.focus) { AIR.Auth.window.focus(); } // the alert is necessary to keep the browser from proceeding // with whatever request it was making. alert(Your session has expired. Login again and then click Ok.); } -- Peter Karman . http://peknet.com/ . pe...@peknet.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/
[Catalyst] C::A::Store::LDAP and multiple UID attributes
There are 3 open RTs against Store::LDAP: https://rt.cpan.org/Ticket/Display.html?id=51499 https://rt.cpan.org/Ticket/Display.html?id=51504 https://rt.cpan.org/Ticket/Display.html?id=51505 All three are about the same issue, which is multiple UID attributes on a single LDAP entry breaking role lookups. I'm the current maintainer of the module but am unsure at this point what the best way to address the issue is. I'm inclined to simply update the POD to include a caveat about assuming one uid per LDAP entry, which is the *convention* with the POSIX schema even if the schema does not *require* it. OTOH, it might be a legitimate feature request to support multiple UIDs in a single entry, in which case I'll have to put on my thinking cap about how best to fix it. I'm soliciting feedback here from other devs and users of the LDAP auth stuff. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Page fragment caching
Tobias Kremer wrote on 01/20/2010 03:51 AM: Any other ideas? Template::Plugin::Cache ? -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] CatalystX::CRUD::Controller::RHTMLO: related database tables and nested forms
Thanks for the detailed report, Adam. I'll try and reply with the detail it deserves. Adam Mackler wrote on 1/12/10 8:05 PM: So, now firing up the app that was magically created for me, I have a pulldown menu with the name of app on it. On this menu I have items for Debtor and Name. I see an option to create a Debtor, and I get a blank form. In the HTML source of the form, searching for name='id' finds nothing. So far so good. Now I see that the current_name field has a text field for me to enter the value of the id column of this debtor's row in the names table. What I want to do is to replace this with three text fields for first, middle, and last names. I think the way to do this is with nested forms. You could go down that road, if you wanted to, and certainly RHTMLO supports it (as you discovered). But the RDGC controllers would require some more drastic surgery than what you probably want to attempt. Instead, I think you want to use the existing features in RDGC to first create a Name and then relate a Debtor to it. That is a little backwards from how you would think of it as a user, but RDGC is a bare-metal db app. That is, it tries to give you a one-to-one reflection of how the db is organized, and if your db is highly normalized (which is a good thing, depending on how you are using it) then the resulting web UI can feel a little cart before the horse. So, in the UI presented to you, if you select Bigk from the menu, then Name - Create, and create a Name record first, you're on the right track. After you save the Name record, you should see the Related menu on the left, and the option for Debtors. Click Debtors, and then Create new Debtors on the right. Enter and save the new Debtor record and you're nearly there. Since you've got a one-to-one going both directions in your schema, you'll want to enter the FK in the 'debtor' column for the original Name record you entered. Then you should be able to click back and forth between the Name and Debtor record you've created, since the FK columns should have a href generated next to each value. Rather than viewing FK ints all the time, what I tend to do is create a unique, human-friendly column in each table, or add a method called 'unique_value' in my RDBO subclass that returns a human-friendly value. The 'unique_value' method is called if available. Hope that helps. Feel free to ask more questions if it doesn't, and consider adding a write-up of your experience to the Catalyst wiki to help the next folks who stumble along this path. Oh, and doc patches also welcome. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] CatalystX::CRUD::Tutorial...looking for missing pieces.
Oliver Gorwits wrote on 1/7/10 2:36 PM: For AutoCRUD[1] I discovered that ExtJS is now available from the CacheFly CDN so we are freely permitted to point at those files: lovely! thanks Oliver. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] CatalystX::CRUD::Tutorial...looking for missing pieces.
Adam Mackler wrote on 1/6/10 11:56 AM: Please download a copy of LiveGrid Javascript lib from http://code.google.com/p/ext-ux-livegrid/ and install it locally on a static web server. Then update your local root/crud/tt_config.tt file. The page source shows references to javascript files on static.msi.unm.edu and yui.yahooapis.com, so I'm guessing the error dialogs are indicating that the javascript files will be coming from those two sites rather than my server. In other words it shouldn't stop the application from working. If I'm wrong here, please let me know. Anyway, I would like to make those messages go away. You are correct that the application will work with the .js files coming from those URLs. My idea was that the package should Just Work out of the box, but that (a) it was impractical to bundle all the .js dependencies with the .pm files and (b) it was impolite to just point at known-good URLs without an annoying warning that you should get your own copy and stop using someone else's bandwidth. To get rid of those messages, just copy the installed tt_config.tt file to your local app and modify it. Example: % cd MyApp % perldoc -l CatalystX::CRUD::YUI::tt [some/perl/path/to]/CatalystX/CRUD/YUI/tt.pm % cp [some/perl/path/to]/CatalystX/CRUD/YUI/tt/crud/tt_config.tt \ root/crud/tt_config.tt % vi root/crud/tt_config.tt and change the URL values to your own local copy of the .js libs. I typically put them either in the root/static dir so that I can serve them with the Static::Simple plugin, or on some known web server dedicated to serving static content. If you want to serve them with Static::Simple (the easiest, but not what you want to do when you deploy to production), change the URL values to something like: ExtBaseURL = c.uri_for('/static/extjs'); LGBaseURL = c.uri_for('/static/livegrid'); and unpack the .js stuff into root/static/extjs and root/static/livegrid. I downloaded the two menioned items, ExtJS and LiveGRid, with no problems, but my certainty ends there. (BTW I have zero experience with Javascript, and my only expeience with TT is from Catalyst Tutorials--I've been happily using Mason for years.) My confusion here has several bases: First, the term update with regard to the tt_config.tt, since I have no such file. I'm taking that to mean create rather than update. Yes, there is poor documentation around the tt_config.tt file. The assumption is that you have already copied it over and now need to modify it. But that's a poor assumption. Doc patches welcome. Next, based on reading the pod for Rose::DBx::Garden::Catalyst::View, I've concluded the error messages above mean to say update your local root/rdgc... when they say root/crud... If I'm wrong here, please let me know. 'crud' is correct. The CatalystX::CRUD::YUI package is descended from RDGC, and RDGC is now mostly a wrapper around CXCY. RDGC just provides the bootstrapping code generation; CXCY is the actual Catalyst application. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Rose+CRUD tutorial attempt giving syntax error
Adam Mackler wrote on 1/6/10 12:32 PM: [warn] Calling $c-view() will return a random view unless you specify one of: [warn] * $c-config(default_view = the name of the default view to use) [warn] * $c-stash-{current_view} # the name of the view to use for this request [warn] * $c-stash-{current_view_instance} # the instance of the view to use for this request You need to set a 'default_view' value in your app config file. Assuming you have called your RDGC View file 'RDGC.pm' you should use the value 'RDGC'. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] CatalystX::CRUD::Tutorial...looking for missing pieces.
Peter Karman wrote on 1/6/10 8:44 PM: To get rid of those messages, just copy the installed tt_config.tt file to your local app and modify it. Example: and I forgot the important part: remove this line from your local copy: ThisIsDefTTConfig = 1; -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] CatalystX::CRUD::Tutorial...looking for missing pieces.
Adam Mackler wrote on 01/05/2010 11:05 AM: Hello everyone. I'm relatively new to Catalyst, and could spend many hours asking questions of experts. For the moment, this is the wall I've hit: Without going into too much background, I want to get CatalystX::CRUD implemented. I feel that if I can just get a working example going I can make my own project work. There is a tutorial, CatalystX::CRUD::Tutorial. It's a good start, but hasn't been enough for me. In particular there's a line in the docs: Assuming you have created a View and some templates, you can now search, browse, create, read, update and delete all your Album and Song data. I made a View, and I made some templates. Obviously I'm still missing stuff, because I'm not yet searching, browsing, creating or reading the tutorial database data. For example, a submit button on the forms I assume should be added to the tutorial example Forms. My first guess put the button on the form, but hitting it just reloads the page. And that's where I am: guessing, experimenting, reading, reading, experimenting, reading. It would be really great if there were a working example I could look at--or even just the missing pieces from the CatalystX::CRUD::Tutorial. I figure that if there's anyone who knows what I want to know, this is the best place to look. Hi Adam, Try the tutorial here: http://www.catalystframework.org/calendar/2007/7 It uses Rose::DBx::Garden::Catalyst, which assumes you are using RDBO. If you want to use DBIx::Class as your ORM package, you can do that too, but it requires a little more manual intervention at present as I haven't CPANified the bootstrapping code I have lying around somewhere. Either way, there are example apps for both RDBO and DBIC in their respective test directories here: http://cpansearch.perl.org/src/KARMAN/CatalystX-CRUD-ModelAdapter-DBIC-0.11/t/example http://cpansearch.perl.org/src/KARMAN/CatalystX-CRUD-Model-RDBO-0.22/t/lib/ Feel free to post back here with any questions/comments/patches. pek -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Partial page cache plugin
Tomas Doran wrote on 12/07/2009 03:48 PM: I don't see why there needs to be anything CHI specific? (But I'd welcome doc patches / wiki / advent articles showing how to use CHI). strangely, I'm experiencing deja vu all over again... http://lists.scsys.co.uk/pipermail/catalyst/2009-February/020984.html I did like using the C::P::CHI while it existed on cpan, and preferred it over the C::P::Cache plugin. But I understand t0m's point and agree (in principle anyway... ;) ) -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Partial page cache plugin
Julien Sobrier wrote on 12/6/09 2:04 AM: Hello, there is a plugin for caching an entire page. I am looking for the same type of plugin to cache part of the page, but did not find one. Waht is the best way to achieve this in Catalyst? If you are using Template Toolkit, http://search.cpan.org/dist/Template-Plugin-Cache/ -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] auto method never triggered
Julien Sobrier wrote on 11/1/09 8:07 PM: Thank you Shoudl It put __PACKAGE__-config-{namespace} = ''root;, or simply remove this line? You should leave it as-is in the Root.pm and remove the line altogether in the Admin.pm. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] FormFu or FormBuilder
Zbigniew Lukasiak wrote on 10/30/2009 09:19 AM: On Fri, Oct 30, 2009 at 2:56 PM, Kiffin Gish kiffin.g...@planet.nl wrote: I noticed that both FormFu and FormBuilder are mentioned in the Catalyst tutorial, and would be interested to hear the advantages and disadvantages of using the one or the other. Have a look at: http://www.perlfoundation.org/perl5/index.cgi?form_processing There is also a Form page at the Catalyst wiki - but FormBuilder is not mentioned there at all: http://dev.catalyst.perl.org/wiki/howtos/forms I just added RHTMLO to the cat wiki forms page too. Looks like FormBuilder is not recommended anymore, according to the wiki (to answer the OP question). -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] CatalystX::CRUD Storage Error
Amiri Barksdale wrote on 7/30/09 4:11 PM: On Tue, Jul 28, 2009 at 08:30:44AM -0500, Peter Karman wrote: | Peter Karman wrote on 07/28/2009 07:51 AM: | Amiri Barksdale wrote on 7/27/09 8:46 PM: | On Thu, Jul 16, 2009 at 11:33:38PM -0500, Peter Karman wrote: | | Also, your controller inherits from the base CatalystX::CRUD::Controller, which | | doesn't really *do* anything by default. I.e., you need a form handler to | | serialize and validate your model. Look at CatalystX::CRUD::Controller::RHTMLO | | for one example. Or consider writing a controller base class that adapts your | | favorite form handler (HTML::FormFu or Form::Processor or ...). This is what I am trying to do. I have been poring over the docs for CatalystX::CRUD::Controller::RHTMLO, and looking at its source code, to see whether I can figure out what adaptations to make to tie FormHandler to C:X:CRUD. I am just unclear on the API I think. Is this correct: To make a controller base class to use HTML::FormHandler with C:X:CRUD, I can look at, for instance, CatalystX::CRUD::Controller::RHTMLO, and just replicate its functionality using Formhanlder stuff? I need subroutines named form, field_names, all_form_errors, form_to_object, do_search, etc., because those are what CatalystX::CRUD::Controller expects? You probably don't need all those. At a minimum: form() field_names() form_to_object() save_obj() I've just read over the pod for HTML::FormHandler for the first time, so take my remarks as those of a complete novice in that regard. But here are some first attempts you could play with and modify. I think creating a generalized CX::C::C::HFH class will be a little tricky since the model support is already baked into HFH, but it could be made to work, I'm sure, by someone more familiar with the workings of HFH. as an example: sub form { my ( $self, $c ) = @_; $self-throw_error(context required) unless defined $c; $self-{_form} ||= $self-form_class-new; $self-{_form}-clear(); $self-{_form}-ctx($c); # $c should be weaken()'d return $self-{_form}; } sub field_names { my ( $self, $c ) = @_; $self-throw_error(context required) unless defined $c; return [ map { $_-name } @{ $self-form($c)-fields } ]; } # this is usually the heart of a CX::C::Controller # but see comments on process() below. sub form_to_object { my ( $self, $c ) = @_; return $c-stash-{object}; # basically a no-op } sub save_obj { my ( $self, $c ) = @_; # here's where H::F is unique, # since the process() method does a lot of what # CX::C::Controller does too. # I'm not sure how best to do this. my $form = $c-stash-{form}; my $obj = $c-stash-{object}; # process() does mostly what save() does in CX::C::Controller return $form-process( item = $obj, params = $c-req-params ); } Hope that steers you in the right direction. You might seek counsel from the HTH folks as to what the best way is to use just the form handling pieces of HTH, without the model integration, since one of the chief aims of CX::C::Controller is to *do* the model integration for you. The code above basically delegates all the model integration to the process() method, as HTH does. -- Peter Karman . http://peknet.com/ . pe...@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] CatalystX::CRUD Storage Error
Amiri Barksdale wrote on 7/27/09 8:46 PM: On Thu, Jul 16, 2009 at 11:33:38PM -0500, Peter Karman wrote: | Also, your controller inherits from the base CatalystX::CRUD::Controller, which | doesn't really *do* anything by default. I.e., you need a form handler to | serialize and validate your model. Look at CatalystX::CRUD::Controller::RHTMLO | for one example. Or consider writing a controller base class that adapts your | favorite form handler (HTML::FormFu or Form::Processor or ...). I am making quite a bit of headway with this, and I have chosen HTML::FormHandler as...my form handler. I am having some difficulty integrating the two, though. A controller and a form that it uses look like this: http://scsys.co.uk:8001/31717 When I start the server and try to look at ui/crud/creator/list, I get this error: Caught exception in ml2::Controller::UI::CRUD::Creator-auto Attribute (form) does not pass the type constraint because: Validation failed for 'ml2::Forms::CreatorForm' failed with value ml2=HASH(0xd27cf30) (not isa ml2::Forms::CreatorForm) at /home/amiri/mlrepo/lib/perl5/CatalystX/CRUD/Controller.pm line 110 Instead of C::X::CRUD loading the form, it is loading the whole application class. Is my controller still misconfigured? no, it's a bug in the documentation. The default form() method looks like this: sub form { my ( $self, $c ) = @_; # ... } and so your override needs to expect $c as well. -- Peter Karman . http://peknet.com/ . pe...@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] CatalystX::CRUD Storage Error
Peter Karman wrote on 07/28/2009 07:51 AM: Amiri Barksdale wrote on 7/27/09 8:46 PM: On Thu, Jul 16, 2009 at 11:33:38PM -0500, Peter Karman wrote: | Also, your controller inherits from the base CatalystX::CRUD::Controller, which | doesn't really *do* anything by default. I.e., you need a form handler to | serialize and validate your model. Look at CatalystX::CRUD::Controller::RHTMLO | for one example. Or consider writing a controller base class that adapts your | favorite form handler (HTML::FormFu or Form::Processor or ...). I am making quite a bit of headway with this, and I have chosen HTML::FormHandler as...my form handler. I am having some difficulty integrating the two, though. A controller and a form that it uses look like this: http://scsys.co.uk:8001/31717 When I start the server and try to look at ui/crud/creator/list, I get this error: Caught exception in ml2::Controller::UI::CRUD::Creator-auto Attribute (form) does not pass the type constraint because: Validation failed for 'ml2::Forms::CreatorForm' failed with value ml2=HASH(0xd27cf30) (not isa ml2::Forms::CreatorForm) at /home/amiri/mlrepo/lib/perl5/CatalystX/CRUD/Controller.pm line 110 Instead of C::X::CRUD loading the form, it is loading the whole application class. Is my controller still misconfigured? no, it's a bug in the documentation. The default form() method looks like this: sub form { my ( $self, $c ) = @_; # ... } and so your override needs to expect $c as well. I should clarify further. Your controller code: has 'form' = ( isa = 'ml2::Forms::CreatorForm', is = 'rw', default = sub { ml2::Forms::CreatorForm-new }, ); is moreorless what the base controller does. So by having that 'has' declaration, you break it. Try taking the 'has' declaration out and see if that works. -- Peter Karman . http://peknet.com/ . pe...@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] recommended/best practice way of serving static files after authentication?
Tomas Doran wrote on 7/28/09 7:25 PM: On 28 Jul 2009, at 14:55, Ash Berlin wrote: On 28 Jul 2009, at 14:42, John SJ Anderson wrote: $WORK-mate is working on a Cat app that (among other things) allows authenticated users to download from a set of static files. He's wondering what the best way is to set things up so that the Cat app can handle the authentication/authorization parts of things but then hand the static file serving part off to Apache. Thanks for any help/hints. john. Largely depends on what webserver you are using. Lighttpd has X-LIGHTTPD-Sendfile (or something similarly named) nginx has something like X-Accel-Redirect which does the same (and can do more.) Both of these tell the webserver to serve static content from a file. Hit google for these env vars to find out how they work There's an apache module which will do the same as the lighttpd one http://tn123.ath.cx/mod_xsendfile/ Never used it mind. Whilst this is all sage advice, remember - DO THE SIMPLEST THING WHICH COULD POSSIBLY WORK. Ergo, $c-serve_static_file($c-path_to(qw/ sekrit_files file1.avi /)); is probably a good bet (From Catalyst::Plugin::Static::Simple). Unless you have dozens of concurrent users, all downloading large files (where large is 10s of Mbs), then just do that - it's easy, it works, you don't have to think about production vs development, etc. This is also sage advice. It will work well in development, and can also work in production if your cat app proves to scale to your demand. With a little more code you can scale far more than C::P::S::S will allow. I like to use mod_auth_tkt with Apache for general authn/authz tasks, and it works just as well for one-time authn for serving static files. Something like this (in MyApp.pm): use Apache::AuthTkt; __PACKAGE__-config( auth_tkt_conf = '/etc/httpd/conf.d/auth_tkt.conf', static_uri= 'http://mystatic.domain/authn/', static_user = 'mystaticuser', static_tokens = 'catalyst', env = 'prod', # or 'dev' or 'test' or ... ); sub serve_my_static_file { my ($c, $file) = @_; my $conf = $c-config; my $env = $conf-{env} || 'dev'; if ($env eq 'dev') { # do as t0m suggests $c-serve_static_file($c-path_to('sekrit', $file)); } else { # if it doesn't exist (assuming same filesystem as MyApp) # then return 404 if (! -s $c-path_to('sekrit', $file)) { $c-res-status(404); $c-res-body('not found'); } else { # let apache serve it my $at = Apache::AuthTkt-new( conf = $conf-{auth_tkt_conf}, # or hardcode secret ignore_ip = 1, # in case req is proxied ); my $ticket = $at-ticket( uid = $conf-{static_user}, tokens = $conf-{static_tokens}, ) or die $at-errstr; my $uri = join('', $conf-{static_uri}, $file, '?auth_tkt=', $ticket ); $c-res-redirect($uri); } } } and then a mod_auth_tkt.conf something like: TKTAuthSecret foobarbing123 TKTAuthDigestType MD5 Location /authn # TKTAuthLoginURL must be present # but in this case we assume all requests # are pre-authenticated. Send someplace that # returns a custom 401 or whatever. TKTAuthLoginURL http://nosuchurl/ # really short. i.e., as long as it takes for # the browser to receive the 302 and request the # new uri. 2 seconds should be *ample* TKTAuthTimeout 2 # *IMPORTANT* lest requests use the same token over # and over again, negating its temporary intent. TKTAuthTimeoutRefresh 0 # optional, really. just for example. TKTAuthToken catalyst # must match config in $at call above in perl TKTAuthIgnoreIP on # turn on to debug TKTAuthDebug 3 # tell apache to protect this space AuthType None require valid-user mystaticuser /Location Many variations on the theme are possible of course, including putting the auth_tkt value in the uri path instead of as a param and then using mod_rewrite in apache to untangle it. -- Peter Karman . http://peknet.com/ . pe...@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] CatalystX::CRUD Storage Error
Eden Cardim wrote on 07/17/2009 06:51 AM: On Thu, Jul 16, 2009 at 11:36 PM, Peter Karmanpe...@peknet.com wrote: There really is no method called 'storage' in DBIx::Class::ResultSet, so at least the error message is telling the truth. - $self-app_class-model( $self-model_name )-storage-sqlt_type +$self-app_class-model( $self-model_name )-result_source-storage-sqlt_type that would be true if $self-model_name returned the moniker name of a particular ResultSet. But it shouldn't. It should return the (MyApp-prefix-remove) name of the Catalyst::Model::DBIC::Schema class. -- Peter Karman . http://peknet.com/ . pe...@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] CatalystX::CRUD Storage Error
Amiri Barksdale wrote on 7/16/09 2:34 PM: It seems that my CatalystX::CRUD ModelAdapter is unable to find the method storage in DBIx::Class::ResultSet. Here is the error and the code: http://scsys.co.uk:8001/31231 Does anyone know how to fix this? what does your Controller config look like? Specifically, what is the value of 'model_name' and what does the model_name class look like? The model_name value should be the same for all your Controllers (the main subclass of Catalyst::Model::DBIC::Schema in your Model directory). There really is no method called 'storage' in DBIx::Class::ResultSet, so at least the error message is telling the truth. -- Peter Karman . http://peknet.com/ . pe...@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] CatalystX::CRUD Storage Error
Amiri Barksdale wrote on 7/16/09 10:48 PM: On Thu, Jul 16, 2009 at 09:36:47PM -0500, Peter Karman wrote: | what does your Controller config look like? Specifically, what is the value of | 'model_name' and what does the model_name class look like? The model_name value | should be the same for all your Controllers (the main subclass of | Catalyst::Model::DBIC::Schema in your Model directory). Progress! I changed all my CRUD controllers to look like this: package ml2::Controller::UI::CRUD::Band; use strict; use warnings; use base qw/CatalystX::CRUD::Controller/; __PACKAGE__-config( 'model_adapter' = 'ml2::ModelAdapter::UI::CRUD::Adapter', 'model_name' = 'DB', ### Did not work with 'ml2::Model::DB' ); 1; And now I get an error: Couldn't instantiate component ml2::Controller::UI::CRUD::Band, Can't use an undefined value as a HASH reference at /home/amiri/mlrepo/lib/perl5/CatalystX/CRUD/ModelAdapter/DBIC.pm line 179.Compilation failed in require at ./script/ml2_server.pl line 66. So, I am thinking my adapter may be misconfigured. No your adapter is fine. Your controller needs more info. Try (at a minimum): __PACKAGE__-config( 'model_adapter' = 'ml2::ModelAdapter::UI::CRUD::Adapter', 'model_name'= 'DB', 'model_meta'= { dbic_schema= 'Band', # assuming this is the moniker name resultset_opts = {} }, ); Look at the example MyApp in the t/ directory of the cpan dist for more examples. Also, your controller inherits from the base CatalystX::CRUD::Controller, which doesn't really *do* anything by default. I.e., you need a form handler to serialize and validate your model. Look at CatalystX::CRUD::Controller::RHTMLO for one example. Or consider writing a controller base class that adapts your favorite form handler (HTML::FormFu or Form::Processor or ...). -- Peter Karman . http://peknet.com/ . pe...@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] offset the URI of an existing Cat App
Ian Docherty wrote: I think I must have missed something. Is there a single point where I can make a change that will replicate through all my controllers? Can anyone put me right? this is done completely at the deployment config level. There's nothing to modify in your actual code. How are you deploying the app? FastCGI? mod_perl? etc. -- Peter Karman . http://peknet.com/ . pe...@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] RenderView install problem
apologies if this has been reported elsewhere. fresh perl 5.8.9 install under ubuntu. latest of everything installed from cpan, but install of Catalyst::Action::RenderView fails with: t/04live...Could not load class (TestApp) because : Can't use string (TestApp) as a HASH ref while strict refs in use at accessor _application defined at /home/pkarman/perl/lib/site_perl/5.8.9/Catalyst/Component/ApplicationAttribute.pm line 8. Compilation failed in require at /home/pkarman/perl/lib/site_perl/5.8.9/x86_64-linux/Class/MOP.pm line 135. at /home/pkarman/perl/lib/site_perl/5.8.9/x86_64-linux/Class/MOP.pm line 120 Class::MOP::load_first_existing_class('TestApp') called at /home/pkarman/perl/lib/site_perl/5.8.9/x86_64-linux/Class/MOP.pm line 141 Class::MOP::load_class('TestApp') called at /home/pkarman/perl/lib/site_perl/5.8.9/Catalyst/Test.pm line 23 Catalyst::Test::__ANON__('Catalyst::Test', 'all', 'HASH(0x1400530)', 'HASH(0x13f2d50)') called at /home/pkarman/perl/lib/site_perl/5.8.9/Sub/Exporter.pm line 493 Sub::Exporter::_expand_group('Catalyst::Test', 'HASH(0x13fffb0)', 'ARRAY(0x14000a0)', 'HASH(0x13f2d50)', 'HASH(0x1400580)', 'HASH(0x13f2920)') called at /home/pkarman/perl/lib/site_perl/5.8.9/Sub/Exporter.pm line 424 Sub::Exporter::_expand_groups('Catalyst::Test', 'HASH(0x13fffb0)', 'ARRAY(0x1400080)', 'HASH(0x13f2d50)') called at /home/pkarman/perl/lib/site_perl/5.8.9/Sub/Exporter.pm line 742 Sub::Exporter::__ANON__('Catalyst::Test', '-all', 'HASH(0x7f54b0)') called at /home/pkarman/perl/lib/site_perl/5.8.9/Catalyst/Test.pm line 106 Catalyst::Test::import('Catalyst::Test', 'TestApp') called at t/04live.t line 10 main::BEGIN() called at /home/pkarman/perl/lib/site_perl/5.8.9/Catalyst/Test.pm line 10 eval {...} called at /home/pkarman/perl/lib/site_perl/5.8.9/Catalyst/Test.pm line 10 BEGIN failed--compilation aborted at t/04live.t line 10. -- Peter Karman . http://peknet.com/ . pe...@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] featurizing a catalyst app
Tomas Doran wrote on 6/28/09 10:08 AM: On 28 Jun 2009, at 09:16, Robert Buels wrote: Rodrigo wrote: But how about the /root part? Can mixed-up root dirs be seen as a single root dir easily? I'm interested in making a pluggable app as well. Seems like you and I would want the ability to specify an arrayref for MyApp-config-{root}, and have that work. Poking around cursorily, that doesn't seem to be supported right now. Can somebody who knows what they're talking about (i.e. not me) confirm? Assuming that you're mandating a TT view for your pluggable parts, then you can just subclass View::TT to have an INCLUDE_PATH which picks up the 'root' directories from all your loaded 'Components'. fwiw, you can see an example of this on CPAN in CatalystX::CMS::View -- Peter Karman . http://peknet.com/ . pe...@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] featurizing a catalyst app
Rodrigo wrote on 6/28/09 12:11 PM: Assuming that you're mandating a TT view for your pluggable parts, then you can just subclass View::TT to have an INCLUDE_PATH which picks up the 'root' directories from all your loaded 'Components'. I usually have /static stuff too, mostly css and images. Catalyst::Plugin::Static::Simple::ByClass is one way to deal with that. CatalystX::CMS and CatalystX::CRUD::YUI both use it. -- Peter Karman . http://peknet.com/ . pe...@peknet.com gpg key: 37D2 DAA6 3A13 D415 4295 3A69 448F E556 374A 34D9 ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] Is it possible somehow to mix and match path parts using Chained?
Dennis Daupert wrote on 6/9/09 4:51 PM: MyApp::User; MyApp::User::Actionitem; I have my CRUD methods for actionitems in the child class. This is fine for 'items that are unassociated to meetings or projects. But when I tell the 'item it now is attached to Meeting 37, and the meeting leader does a search on Actionitems people have attached to the meeting, things get complicated. Let's say the team leader is user # 16. She logs into her /user/profile, clicks on 'meetings,' selects meeting 37, and does a search for actionitems people have sent to that meeting. Now we need a method flow like this: /user/16/meeting/37/actionitem/list have you looked at how CatalystX::CRUD::Controller does this? It supports arbitrary relationship names like you are describing. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst and ExtJS : Using Table Relationships
jagdish eashwar wrote on 5/24/09 10:11 AM: Hi, I am trying my hand at using Catalyst and the ExtJS Grid (instead of TT). I am able to fetch data from a single table and display them in the grid. But I am not able to figure out how I can use the table relationships to fetch, say, the corresponding item_name for a given item_code and display that in the grid instead of the item_code. If I use TT, I use the following to fetch the item_name from another table in the schema: [% FOREACH item IN item_stash %] [% item.belongs_to_relationship.item_name %] [% END %] How is this to be done when one is using the ExtJS Grid? I'm following mainly Jason Kohles' tutorial which is available at http://www.catalystframework.org/calendar/2007/9. Presumably when you serialize your data into JSON, just use the foreign table value you want instead of the foreign key. CatalystX::CRUD::YUI implements this with the ExtJS livegrid extension, using Rose::HTMLx::Form::Related. Basically, each Controller corresponds to one table, and each table has one ORM (DBIC or RDBO) class and one Form (RHTMLO) class. The Form class builds an internal metadata structure for serializing a table row using unique values from foreign (related) tables instead of the foreign key value. So for example, if you had a db like: create table persons ( id serial primary key, name varchar(255) not null ); create unique index person_name on persons(name); create table users ( username varchar(16), person_id int not null references persons(id) ); create unique index user_username on users(username); where each Person can have one or more related User records, every time the User Form is serialized it displays the person.name instead of the users.person_id. The unique value is defined in each ORM class (DBIx::Class::RDBOHelpers for DBIC and Rose::DBx::Object::MoreHelpers for RDBO) with the unique_value() method, which by default looks for the first single-column unique column in the table. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Testing controller which require login.
Peter Karman wrote on 05/14/2009 01:51 PM: Louis Erickson wrote on 05/14/2009 09:39 AM: I'm using AuthTkt, and it works very well. glad to hear it. If you're using AuthTkt, then the whole cookie this is a non-issue. Just pass the ticket as a URL param like the tests do. The plugin supports both ways (cookie and param). I should also mention that the AuthTkt plugin has backed-in support for a mock user, specifically designed for tests and development. Look at the SYNOPSIS here: http://search.cpan.org/dist/Catalyst-Authentication-AuthTkt/lib/Catalyst/Authentication/AuthTkt.pm -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Testing controller which require login.
Louis Erickson wrote on 05/13/2009 12:07 AM: Can I just generate the cookie and put it in the cookie store directly before the query is made to the application? I can generate the cookie with the SSO library. I don't see a way to do that through either test tool. I'm coming in late on this thread, but can at least offer a how I do it case. Catalyst::Authentication::AuthTkt is a shim for Apache::AuthTkt, a cookie-based SSO system. In order to test how the Session and Authentication plugins interact, I hacked around how Catalyst::Test does requests in order to preserve a session cookie over multiple requests. You can see the AuthTkt tests here[0]. The my_request() function just sets $ENV{COOKIE} and lets the standard AsCGI magic work. I'm sure that's a Bad Way to Do It, but it works. I would love to see some basic cookie features in Catalyst::Test, and if I knew the Right Way to do it, I'd be happy to add code. I use Catalyst::Test for most things. It is simple, comes with Catalyst so there's no extra dep. I have used the Mech tests too, and Mech is cool. But I like keeping my deps down where I can. [0] http://cpansearch.perl.org/src/KARMAN/Catalyst-Authentication-AuthTkt-0.10/t/01-authtkt.t -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Testing controller which require login.
Louis Erickson wrote on 05/14/2009 09:39 AM: I'm using AuthTkt, and it works very well. glad to hear it. If you're using AuthTkt, then the whole cookie this is a non-issue. Just pass the ticket as a URL param like the tests do. The plugin supports both ways (cookie and param). Why didn't it occur to me to look at the tests for it? I have had to learn that habit myself. On Thu, 14 May 2009, Peter Karman wrote: You can see the AuthTkt tests here[0]. The my_request() function just sets $ENV{COOKIE} and lets the standard AsCGI magic work. I'm sure that's a Bad Way to Do It, but it works. Why is it a bad way? If it's a standard and documented part of AsCGI, then it should continue to work properly, shouldn't it? It should probably be: local $ENV{COOKIE} = $cookie; instead. It's a little nitpicky, since in this particular case setting the global env var doesn't hurt, but in general I try to avoid setting class/global/env vars unless I really want global behaviour. The question I asked in the other message about cookies and Catalyst::Test is: Is that a good idea? Should it get added and/or documented, and let people use it, or should people be pointed at Mechanize or other tools? Seems like a good idea to me to make some sort of official way to get/set cookies in Catalyst::Test. I won't have time soon to try it myself; care to try a patch yourself? -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Tests fail installing Catalyst::Controller::FormBuilder
Louis Erickson wrote on 5/5/09 1:46 PM: While trying to install Catalyst::Controller::FormBuilder, we got some fairly annoying and significant looking errors. We're installing on OS X 10.5. This was working on a 10.4 machine, and we got catalyst-devel to install cleanly on 10.5. The tests give a big chunk of errors... I'm not sure even which lines go with which test. Does anyone have any idea why or what we might have to do to get this to work? downgrade to Catalyst::Runtime 5.7 to start with. those errors look like 5.8 incompat issues. after you've done that, give some thought to whether you want to stick with C::C::FormBuilder. I see that the latest release is nearly 2 years old, and there are several RT tickets opened against it since then, which indicates a lack of ongoing maintenance. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Tests fail installing Catalyst::Controller::FormBuilder
Louis Erickson wrote on 5/5/09 5:08 PM: On Tue, 5 May 2009, Peter Karman wrote: downgrade to Catalyst::Runtime 5.7 to start with. those errors look like 5.8 incompat issues. Yes, they do. I have the complete set of modules running on 5.8 on another machine. There's two main differences that I can think of. 1 It was an upgrade from 5.7. Some dependency is installed that wasn't on the new machine that isn't properly included in the dependency list. 2 My working 5.8 machine is on Linux. I have to wonder what Apple has done to Perl. I just tried installing C::C::FB under mac 10.5 with both stock perl (5.8.8) and a locally compiled version (5.8.8) and got those same errors both times with C::R 5.8. Then I tried it with a SUSE Linux install with C::R 5.8, and got the same errors. methinks this is a Cat 5.8 + C::C::FB issue, and that you need to re-check your working copy on Linux, which might either (a) be 'force install'ed or (b) be from an rpm and not straight from cpan or (c) be running C::R 5.7 after all. after you've done that, give some thought to whether you want to stick with C::C::FormBuilder. I see that the latest release is nearly 2 years old, and there are several RT tickets opened against it since then, which indicates a lack of ongoing maintenance. I noticed that. Mr. Rockway's book used FormBuilder, and it seemed to work fine. Since it had been working, I assumed there simply wasn't a lot of updates because they weren't needed. it's the number of unanswered RT tickets that would disturb me. No updates can definitely indicate stability; open tickets suggests neglect. I did see the Catalyst Wiki suggesting FormFu instead, but only found that after I had already used FormBuilder. At the moment, I can't look that up because the Catalyst Wiki appears to be down, while my book is still working. Outdated and filled with things that will lead a newcomer down the wrong path, but readable. What a terrible trade-off. and they say the age of the book is over... :) -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Slow fastcgi: A debugging aid
Octavian Râsnita wrote on 5/4/09 5:43 PM: It would be nice to be able to limit the number of requests per fastcgi child process... Catalyst::Plugin::AutoRestart -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Using test database with TWAM?
Jesse Sheidlower wrote on 04/30/2009 10:42 AM: Unfortunately I don't know how to do this from a test script, and I don't know how to tell TWAM to run a particular app but with a different DBIC schema (in this case, the identical one but with a different name, pointing to the test db) instead. Or how to do the same thing, but with TWAM hitting the app with the external-server method (so I can test the Apache deployment). Would be grateful for any pointers. Here's what I do. I have 3 different domains (environments): dev, test and prod. I indicate which one I want with an environment variable, which defaults to 'dev' (so if I forget, I only affect development data). % MY_DOMAIN=test make test My base db class (I use RDBO but DBIC would work just as well) checks that env var and picks a profile to use based on the domain value. I maintain 3 database instances, one for each domain. I basically take a dump of my production data via cron on a regular basis, and then import a recent dump to my test and dev dbs as needed. That's a one-line system() call in my test scripts in a BEGIN block. Having the 3 database instances is also nice for schema dev work, as I can make changes in dev, test them with my code, and then deploy the changes to test domain, test code, repeat for prod (unless my tests are somehow destructive of data, in which case I have checks for that env var in my tests and only run in test/dev.) HTH pek -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Jason Kohles' tutorial on ExtJs editable data gridsand Catalyst
jagdish eashwar wrote: Hi Craig, Thanks a lot for taking the trouble to work through the tutorial. Since you have been able to get it to save changes to the database, I think we will be able to isolate where I'm going wrong. Regarding whether to use 'Catalyst' or 'c' as the context, when I created the TT view with the Catalyst helper command 'script/adventajaxgrid_create.pl view TT TTSite', it automatically set the CATALYST_VAR = 'Catalyst'. I changed this to 'c', and the 'Catalyst.uri_for' to 'c.uri_for'. The Ext Grid behaves just like before. It does everything except the Save. Can you paste your root/static/advent.js and your View/JSON.pm ? I would like to compare it with what I have done. Did you try commenting out the 'console.log' line as someone else suggested? ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/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] Tutorial for cache?
Alexander Tamm wrote on 04/16/2009 01:32 AM: Tomas Doran wrote: Take a look at Catalyst::Plugin::Cache. The docs are a bit crap (patches welcome!), but it'll do what you want, and has nice features to give you curried accessors for things etc.. Well, that's just it... I've read the docs and tried to configure it, but I never get a cache hit. I've tried this: in MyApp.pm: __PACKAGE__-config( # other stuff. 'Plugin::Cache' = { 'backend' = { store = 'FastMmap', }, }, ); ...but the return value of $c-cache-get-($key) is always undef, although I make sure to always $c-cache-set( $key, $value) I had the same experience and just switched to the File cache plugin instead. -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Jason Kohles' tutorial on ExtJs editable data grids and Catalyst
jagdish eashwar wrote on 04/16/2009 05:55 AM: Hi, I have been able to work through all of Jason Kohles' tutorial except the part about saving changes back in the database. The 'New Person' and 'Discard Changes' in the tool bar are working, but the 'Save Changes' is not. I have checked several times for any typing mistakes that I might have committed, but that part of the code is not working for me. I wonder if the argument ('data') in the submitChanges function is to be substituted with something more explicit by the reader. I will be glad to receive some help and guidance. I forgot to mention in my earlier post that the tutorial is available at http://www.catalystframework.org/calendar/2007/9. Tip: you won't get any useful help until you show us your code. -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Jason Kohles' tutorial on ExtJs editable data grids and Catalyst
jagdish eashwar wrote on 04/16/2009 10:30 AM: [% META title = 'Advent AJAX Grid' %] script type = text/javascript var posturl = '[% Catalyst.uri_for(/people_data_submit) %]'; var gridurl = '[% Catalyst.uri_for(/people_data) %]'; Should probably be: var posturl = '[% c.uri_for(/people_data_submit) %]'; var gridurl = '[% c.uri_for(/people_data) %]'; -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Gen. principles for JS integration?
Jesse Sheidlower wrote on 4/11/09 9:51 PM: I don't know the best way to handle this. I'd expect that what I want to do is pass a variable like url_to_call to the JS, but I don't know how to get it there. I can certainly have a script block in my TT file that simply sets the JS variable from the stash, but this feels like a kludge. I assume there's also some way to tweak the controller so that this relative URL will work properly with chained controllers, but this also feels like a kludge. It might be a kludge, but it's what I do. I use YUI and ExtJS (with some jQuery). The namespace creation in YUI/ExtJS is nice, so I can make a YUI.myApp namespace, e.g. script type=text/javascript YUI.myApp.BaseURL = '[% c.uri_for('whatever') %]'; // set constant /script I tend to render whatever can't be put in a .js file in script tags, often building up a TT hashref and then rendering it as JSON: [% SET myJsonConfig = { foo = 'bar', ... }; %] script var myFooThing = YUI.myApp.initFooThing([% myJsonConfig.as_json %]); /script See Template::Plugin::Handy for the as_json vmethod. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst and ExtJS
Adam Witney wrote on 3/14/09 9:36 AM: Hi, I was thinking about using Catalyst and ExtJS, does anyone have any experience or know if they will play nicely together? Doing some googling implies that this is not a popular combination due to the limited information CatalystX::CRUD::YUI uses the ExtJS LiveGrid feature. IME, picking a JS lib is orthogonal to the form manager (if you use one) or Catalyst classes you pick. They can make some things easier in the simple cases, but in the more complex cases I end up handcrafting the forms and JS myself. -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Authentication Confusion
Ruan Kendall wrote on 3/7/09 6:19 AM: Authentication::Credential::Password Authentication::Store::Htpasswd get rid of those. The Auth plugin loads the right classes based on your config. Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: In search of RESTful CRUD holy grail
Aristotle Pagaltzis wrote on 03/04/2009 02:12 PM: * Zbigniew Lukasiak zzb...@gmail.com [2009-03-04 13:30]: CatalystX::CRUD::REST has a well described RESTful URI structure: […] I think everyone will agree that this is indeed REST. URI structures and REST are completely ortogonal. That statement is about as meaningful as saying that a URI structure is Perlish. Aristotle, You have written[0] a lot about REST. I listen when you do. When I hear RESTful URL I interpret that as URI-as-a-noun (or more negatively-defined, URI-with-no-verbs). Perhaps we should use something like REST-friendly URL? [0] e.g., http://www.mail-archive.com/catal...@lists.rawmode.org/msg01712.html -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] OT: edit/add seperate actions?
Zbigniew Lukasiak wrote on 03/03/2009 02:53 PM: If you use CatalystX::CRUD::REST, you can do: # 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 CatalystX::CRUD::REST uses the C::R::REST::ForBrowsers feature of 'x-tunneled-method' param to support PUT and DELETE via POST. And where do the forms submit? I mean what is their action address? Do they submit to themselves - or does edit_form submit to /foo/pk?x-tunneled-method=PUT and create to /foo both with POST method? And it is the second - then what do you do when the form parameters are incorrect and you need to redisplay the form? using the CXC REST API: if you GET /foo/1234, then you must PUT /foo/1234 to save it. (or POST /foo/1234?x-tunneled-method=PUT -- although I always put the x-tunneled-method value in a hidden input body param, not as part of the URL). if you GET /foo/create_form, then you must POST /foo. When the form is redisplayed on validation error, it just retains the original action. -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] OT: edit/add seperate actions?
Zbigniew Lukasiak wrote on 03/03/2009 04:18 PM: On Tue, Mar 3, 2009 at 10:27 PM, Peter Karman pe...@peknet.com wrote: Zbigniew Lukasiak wrote on 03/03/2009 02:53 PM: If you use CatalystX::CRUD::REST, you can do: # 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 CatalystX::CRUD::REST uses the C::R::REST::ForBrowsers feature of 'x-tunneled-method' param to support PUT and DELETE via POST. And where do the forms submit? I mean what is their action address? Do they submit to themselves - or does edit_form submit to /foo/pk?x-tunneled-method=PUT and create to /foo both with POST method? And it is the second - then what do you do when the form parameters are incorrect and you need to redisplay the form? using the CXC REST API: if you GET /foo/1234, then you must PUT /foo/1234 to save it. (or POST /foo/1234?x-tunneled-method=PUT -- although I always put the x-tunneled-method value in a hidden input body param, not as part of the URL). Sure - that was just for clarification of how the PUT is done with browsers :) if you GET /foo/create_form, then you must POST /foo. When the form is redisplayed on validation error, it just retains the original action. I was just thinking about the possible CRUD REST schemas and it found that under that schema you display the same form under two addresses: /foo/1234/edit_form and /foo/1234 (in case of the error). And the other day I had that idea that perhaps instead of using path part - use another parameter so /foo/1234?x-view-method=edit_form would render the form and /foo/1234 would render the standard view of the object. This way the form would have just one address. In CXC REST, /foo/1234 is analogous to /foo/1234/view in the RPC format. It does not return a HTML form. It just returns the object data. I.e., read-only. So the URLs represent two different things. Of course, that's just how I implement the API in CatalystX::CRUD::YUI, but you could make /foo/1234 return whatever you want. The basic API is view-agnostic, and there's nothing in the core Controller API that dictates what is returned. The controllers just stash the object represented by the URL and leave representation up to the view. Both things are just different representations of the same thing - so using a parameter to differentiate between them seems quite logical. But on the other hand it might look too different from the traditional ways. they could be different (as they are in CXC::YUI), or they could be the same. That's up to the implementer of the API, I guess. -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] CatalystX
Dermot wrote on 3/3/09 4:36 PM: 2009/3/3 Oliver Gorwits oliver.gorw...@oucs.ox.ac.uk: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Zbigniew Lukasiak wrote: ListFramework is focused on the task of providing such an admin interface - so I guess out of the many other Catalyst CRUD frameworks it must really excel at that. But if you were looking rather for a scaffolding (i.e. something that builds a *template* CRUD application - which you can later modify to adjust to your needs) - then you could have a look at mine Catalyst::Example::InstantCRUD In general the authoritative page on Catalyst CRUDs is: http://dev.catalystframework.org/wiki/crud Agreed - it depends what you want from the application, whether you need it to be customized, etc. Zbigniew has described the situation very well, here. For CX::ListFramework::Builder, it sounds like Dermot could set it to run in an /admin path-part, then set an ACL on that in the Apache config so only his site admins could access that area. That's exactly what I have done. Limit it via ACL. It allows me - alone - to quickly view of the schema purely (for reference purposes). I was bowled over by how quickly you could get a web2.0(ish) interface into you schema. The version I have 0.41 is displaying the relatioships in a unexpected way but it was the Extjs interface that scored for me. I was going to ask the question some time ago how CatalystX differ from Catalyst but I guess I should just do the tutorial when I get some spare time. http://search.cpan.org/dist/CatalystX-CRUD/lib/CatalystX/CRUD/Tutorial.pod just to be clear: that tutorial is specific to CatalystX::CRUD, which is an entirely separate project from LFB. http://dev.catalyst.perl.org/wiki/crud outlines some of the differences (though it seems to be down atm). -- Peter Karman . http://peknet.com/ . pe...@peknet.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: decoding in core
Neo [GC] wrote on 02/23/2009 09:41 AM: Does anyone know a _safe_ method to convert _any_ string-scalar to utf8? Something like anything_to_utf8($s) , regardless if $s contains ascii, latin1, utf8, tasty hodgepodge or hot fn0rd, utf8-flag is set or not and is neither affected by full moon nor my horrorscope, _without_ doing double-encoding (there MUST be some way to determine if it already is utf8... my silly java editor can do it and perl makes difficult things at least possible). I would greatly appreciate this philosophers stone and will send my hero a bottle of finest bavarian (munich!) beer called Edelstoff (precious stuff - tasty). Search::Tools::UTF8::to_utf8() comes close. It won't handle mixed encoding in a single string (which would be garbage anyway) but it does try to prevent double-encoding and uses the Encode goodness under the hood. -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Where am I? ;-)
Jens Schwarz wrote on 02/19/2009 12:13 AM: Hi, with this somewhat philosophic question, I want to know, how a Controller knows, which of its action is currently active (p.ex. displayed to the user). http://search.cpan.org/~mramberg/Catalyst-Runtime-5.71000/lib/Catalyst.pm#$c-action And a similar question: How does the root controller know what other controllers are available in the app? http://search.cpan.org/~mramberg/Catalyst-Runtime-5.71000/lib/Catalyst.pm#$c-controllers -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] New version of InstantCRUD
Zbigniew Lukasiak wrote on 02/17/2009 02:05 PM: On Tue, Feb 17, 2009 at 7:48 PM, Alexander Hartmaier alexander.hartma...@t-systems.at wrote: Would be great if we could combine our efforts instead of creating even more choices for the users of cat in form of InstantCRUD, Controller::DBIC::API and so on (http://dev.catalyst.perl.org/wiki/crud). Sure. Let me only point out that InstantCRUD was one of the first (published just after Enzyme). But this idea of combining efforts is what lead me when starting that wiki page. I am open for collaboration, I've already started figuring out what can be done with Peter Karman (of CatalystX::CRUD). For me his approach is a bit too heavy - it requires too much knowledge of his libraries to extend the controller using it - it wraps the model into it's own abstractions (CatalystX::CRUD::Iterator, CatalystX::CRUD::Model ) - while I believe that it should be possible to have the CRUD as an add-on and let the user work with his original Model. I updated my work to try out this - and also show the others what I really mean. And Zbigniew's feedback led to the development of http://search.cpan.org/dist/CatalystX-CRUD-ModelAdapter-DBIC/ for which I thank him. CatalystX::CRUD has different aims than InstantCRUD. It's an API rather than a scaffolding generator. All the projects on that wiki page are trying to solve specific problems. The problem CXCRUD was trying to solve was how to let RDBO, DBIC, modelX, etc, play nicely with RHTMLO, FormFu, etc. As for whether it is too heavy or complicated, I agree that the docs and examples could use work. But then, that seems to be a common complaint for even the most useful of CPAN code. -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Plugin::Authentication overrides $c-req-user
Daniel Westermann-Clark wrote on 02/11/2009 02:53 PM: On 2009-02-11 10:06:42 +0100, Rodrigo wrote: I'm not familiar with $c-req-user, but isn't REMOTE_USER a header you can read with $c-req-header('remote_user'), or whatever header name is being passed around? Some authentication schemes might provide headers containing the username, but REMOTE_USER is different. It's not available as a header. Regardless, is there a reason it should be a string at first and then an object? It's inconsistent and causes a loss of information about the request. If no one is using this behavior, I'd be happy to provide patches to deprecate or remove it. Why not just add a remote_user() method on $c-req instead? It's a little more typing, but is more explicit about where the value comes from and doesn't potentially break any existing apps. -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] IO::Pipe and the Catalyst Server
Bill Moseley wrote on 02/05/2009 09:10 AM: On Thu, Feb 05, 2009 at 01:23:03PM +0100, Florian Ragwitz wrote: On Wed, Feb 04, 2009 at 10:25:15PM -0800, Bill Moseley wrote: I have a module that uses IO::Pipe and when I run it under the Catalyst server the pipe doesn't work (see below). Please try to reproduce with Catalyst-Runtime-5.8000_06. It has a fix related to spawning external processes from the dev server. $ PERL5LIB=$HOME/cur_cat script/pipe_server.pl 5.8000_06 You can connect to your server at http://bumby2:3000 about to read from handle hello Same problem. is it possible this is related to how Cat can mess with STDOUT and STDIN? I have these lines in SVN::Class: # this trick cribbed from mst's Catalyst::Controller::WrapCGI # we alias STDIN and STDOUT since Catalyst (and presumaly other code) # might be messing with STDOUT or STDIN open( *REAL_STDIN, = . fileno(*STDIN) ); open( *REAL_STDOUT, = . fileno(*STDOUT) ); -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: OT: Better TT pager?
Oliver Charles wrote on 01/23/2009 01:31 PM: On 23 Jan 2009, at 15:00, Jesse Sheidlower wrote: I like this quite a bit, more than some of the other solutions which I tried, and think I'll use this. Glad you like it :) One question, from an arithmetically-challenged one: How would I modify this to allow the user to skip by, say, tens? If you have a search with 1000 pages, you can only go to the beginning or end, but getting to the middle would be unbearably tedious (it would be only slight less tedious having to do it be tens, but still better). Well, it really depends on how you want to display the results. But I guess you'd do some kind of loop, doing (i * 10) to get the multiples of 10 - the just looping until you exceed total_pages. However, this is really getting a bit more complex than should be in a template (arguably, even my template is too complex) - so you should look to maybe subclass Data::Page to do this for you. Data::Pageset or even Data::Pageset::Render I use Data::Pageset in all my apps. See e.g. SWISH::WebService, which includes TT snippets implementing XML and HTML pagers. -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] autocomplete forms?
Michael Higgins wrote on 12/31/2008 11:45 AM: Hey, all -- Using formbuilder forms with Controller::FormBuilder. But. What I'd like (actually, probably need) is to have some of the list select boxes asynchronously populated with lists that would autocomplete. Am I painted into a corner, or can I shoehorn some AJAX-y goodness into Controller::FormBuilder? If so, how? If not, what should I use? . . . Also, the tables are well designed and constrained, so dbix schema loader rocks well on it. Is there a catalyst-friendly *form suite* that will do the same? What follows is not about formbuilder, since I do not use it. CatalystX::CRUD::YUI uses Rose::HTMLx::Form::Related, which in turn uses Rose::HTMLx::Form::Field::Autocomplete as a special field type. There's even a feature that detects if the autocomplete feature should be turned on automatically for form fields that represent foreign keys. As far as auto-generating your forms from your db schema, Rose::DBx::Garden does that for RDBO. I have some code lying around that does it for DBIC too, but I haven't yet CPAN-ified it (likely under Rose::HTMLx::Form::Generator). If you're interested in that, prod me offlist and I'll try to get to it. -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] create search engine friendly uri from string
Octavian Rasnita wrote on 12/16/2008 06:16 AM: From: on...@houseofdesign.de 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? Maybe Text::Unidecode could be helpful... or Search::Tools::Transliterate -- Peter Karman . pe...@peknet.com . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] create search engine friendly uri from string
Octavian Rasnita wrote on 12/16/08 1:33 PM: Just as a feedback, here is a short comparison I've made between these 2 modules: Text::Unidecode is 5 or 6 times faster than S::T::T. Interesting. I had never compared times since STT was always fast enough for my purposes. I just refactored convert() in STT and uploaded 0.20 to pause. My benchmark script shows the new version is 244% faster. -- Peter Karman . http://peknet.com/ . pe...@peknet.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/
[Catalyst] CatalystX::CRUD::YUI 0.008
Uploaded last night to CPAN. New in this version: 0.008 17 Nov 2008 * tweek CSS for a.box to fix padding in relation to form.inline, button.box * fix crud.js bug to allow for sort column to include table prefix (e.g., t2.name) * total refactor of UI to include: * left menu instead of tabbed relationships view * stricter dom structure * yui_header.tt * split up some .tt into smaller chunks * RelOpts hash instead of separate *_relationships vars in .tt * use LiveGrid instead of YUI DataTable ***NOTE*** all the YUI DataTable support is now dropped in favor of ExtJS LiveGrid -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Simple caching question
Jesse Sheidlower wrote on 11/07/2008 08:02 AM: On Thu, Nov 06, 2008 at 05:23:29PM -0500, Jesse Sheidlower wrote: Given how light my requirements are--the app's been chugging along fine for years without any caching--I don't think I need to bother putting another app into the mix. The memory requirements for Memcached don't worry me--the server never goes down, and even if it did, another round of database retrievals wouldn't hurt anybody--but if it's something that needs managing, I'll just go with FastMmap and see how that works. Hmm. I'm not sure what's going on, but PageCache is actually making my app _slower_. Regardless of where I put the config stuff, on my laptop running ab I'm seeing about 38-39 requests/sec running without PageCache, but 35-36 with. I've seen that before when the pages weren't actually being cached. It was likely misconfig on my part, but in the end I switched to the File cache backend because It Just Worked. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst, MVCs and other MVCs
Jacinta Richardson wrote on 11/03/2008 09:25 PM: I know that Catalyst is about dispatch more than about CRUD, but I'd love pointers to a tutorial about how to get a basic system with working CRUD up and working within minutes. When I first tried Catalyst (about a year ago) I worked through the tutorial but it did not cover all aspects of CRUD (I've forgotten what was missing) and I later found that the modules it recommended were deprecated. So I'd really, really love advice here. http://www.catalystframework.org/calendar/2007/7 http://search.cpan.org/dist/CatalystX-CRUD/lib/CatalystX/CRUD/Tutorial.pod http://search.cpan.org/dist/CatalystX-CRUD-YUI/lib/CatalystX/CRUD/YUI.pm -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: LDAP store patches (Was: Re: [Catalyst] mix authentication stores)
Tomas Doran wrote on 9/30/08 9:27 PM: On 1 Oct 2008, at 03:11, Peter Karman wrote: Tomas Doran wrote on 9/30/08 8:24 PM: so if anyone reading could poke the Store::LDAP maintainer and get them to join the thread (and respond to my patches!), that'd be awesome... that'd be me. Hi! I've seen the tickets; haven't yet read the patches, but in general the feature ideas look sane. If someone else has time to look at the patches, I likely won't get to it for a few more days. No huge rush, I'm just totally spoilt by the Moose community where you end up finding a bug, writing a test case, and then finding it's been fixed in trunk already. As long as you're around and alive, have seen my patches 'in theory' and will get to them at some point then I'm more than happy to await your leisure.. and finally, time made itself available. committed to cat svn as r8570 and uploaded just now to pause as 0.1004. Thanks for the patches. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] best practices - model or controller ?
Yves Räber wrote on 10/4/08 1:16 AM: Hello, I want to implement something really simple : log some events into a database. And I already can think of three way to do it, but because this will be used very frequently I'd like to know what's the best solution. For me the best solution would be to have little overhead, and a really short command (like $c-logdb()). 1/ In the DBIC Model package MyApp::Model::AppDB sub add() { my $self = shift; my $message = shift; my $log = $self-resultset('Log'); $log-create( { message = $message }); } And then call $c-model('AppDB')-add('Hello World'); This seems ok, but $c-model('AppDB')-add('Hello World') ... too much characters. 2/ In the controller (in Root.pm) sub log : Private { my ($self, $c, $message) = @_; $c-model('AppDB::Log')-create({ message = $message; }); } And then call $c-forward('/log', [ 'Hello World' ]); This doesn't seem really elegant to me. 3/ As a plugin This seems really overkill, but I like the idea of having a really short command like $c-logdb(...); So could someone tell be what is best practice is ? You don't need a real plugin unless you need to override the dispatch process. But I often put convenience methods in my MyApp.pm base class. So implement your idea #1 and then add: package MyApp; sub logdb { my $c = shift; my $msg = shift or croak msg required; $c-model('AppDB')-add($msg); } -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] mix authentication stores
Tomas Doran wrote on 9/30/08 8:24 PM: Splitting the current LDAP code so that it could be either a store and/or credential also wouldn't be hard, and I volunteer to help with the effort. yes, that's a good idea. The current LDAP auth plugin is in the Store namespace but does both Store and Credential right now. I'm personally fine with the LDAP store, but I've thrown a couple of patches in that direction to add stuff I need, so doing a bit more hacking on it wouldn't push the boat out. I haven't had any response to these yet however, so if anyone reading could poke the Store::LDAP maintainer and get them to join the thread (and respond to my patches!), that'd be awesome... that'd be me. I've seen the tickets; haven't yet read the patches, but in general the feature ideas look sane. If someone else has time to look at the patches, I likely won't get to it for a few more days. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] fcgid
John Lee wrote on 09/29/2008 08:46 AM: What's the general concensus in the catalyst community nowadays? Is mod_fastcgi preferred at large over mod_fcgid these days? I saw a post I use mod_fastcgi. It has the external server option, which I like because I can stop/start my app without having to bounce the entire web server. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Search example in any docs?
Dr. Jennifer Nussbaum wrote on 09/23/2008 02:38 PM: Is there any place that shows a simple example of a web form - DBIC search in Catalyst? And if not, shouldnt there be? The problem is that db search quickly becomes complicated when you're dealing with multiple tables, relationships, column types, etc. See Search::QueryParser::SQL on CPAN for my attempt at this. There is a dbic() method too. CatalystX::CRUD::Model::Utils depends on S::QP::S to turn $c-req-params into a query, if you want to look at one example. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Model::LDAP vs Authentication::Credential::LDAP
Peter Karman wrote on 8/17/08 2:09 PM: Matt S Trout wrote on 8/17/08 12:39 PM: On Mon, Aug 11, 2008 at 11:49:00AM -0500, Peter Karman wrote: I am going to be doing something similar eventually using Net::LDAP::Class and either C::Model::LDAP or a CatalystX::CRUD::ModelAdapter::LDAP. You might look at Net::LDAP::Class to see if it makes what you're doing any easier. Damn. Net::LDAP::Class reserves -meta for a crappy metadata object. Could that not be called metadata or something to make it easier to use with catamoose? yes, it could. I'll change it for the next release. Thanks for the feedback, Matt. Uploaded as 0.09. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Model::LDAP vs Authentication::Credential::LDAP
Matt S Trout wrote on 8/17/08 12:39 PM: On Mon, Aug 11, 2008 at 11:49:00AM -0500, Peter Karman wrote: I am going to be doing something similar eventually using Net::LDAP::Class and either C::Model::LDAP or a CatalystX::CRUD::ModelAdapter::LDAP. You might look at Net::LDAP::Class to see if it makes what you're doing any easier. Damn. Net::LDAP::Class reserves -meta for a crappy metadata object. Could that not be called metadata or something to make it easier to use with catamoose? yes, it could. I'll change it for the next release. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Model::LDAP vs Authentication::Credential::LDAP
On 08/07/2008 10:52 AM, Buchan Milne wrote: So far I have stored the cleartext password in the session, after encrypting it with the session key. Now, I would like to find some way of providing the credentials to the model. I wrote a connection_class for my models, but it seems that the connection_class doesn't have access to the context, so I can't retrieve $c- user-ldap_entry-dn or $c-sessionid(). Is there really no way to do this at present (without dumping Model::LDAP and doing everything via Net::LDAP directly)? I am going to be doing something similar eventually using Net::LDAP::Class and either C::Model::LDAP or a CatalystX::CRUD::ModelAdapter::LDAP. You might look at Net::LDAP::Class to see if it makes what you're doing any easier. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::*::REST and Javascript
J. Shirley wrote on 8/11/08 10:03 PM: I use YUI extensively in conjunction with REST -- it works great. Takes a very minimal amount of work to connect Catalyst::Controller::DBIC::API::REST with the YUI DataTable, too. YUI 2.5.1 has better methods for setting the content type, too, so you can serialize out as JSON without doing weird hacks that were previously needed (in case you saw someone, probably me, bitching about that last year :)) (YUI 2.5.x)++ There are examples of using YUI with both RPC and REST style services here: http://search.cpan.org/~karman/Rose-DBx-Garden-Catalyst-0.09_04/ That uses RDBO, RHTMLO, CatalysX::CRUD(::REST) and YUI 2.5.x specifically. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Debug with FCGI
On 08/01/2008 07:55 AM, Angel Kolev wrote: Doesn`t work too. All debug output goes to apache log. I tryed with -e option - same result. Look at Catalyst::Log::Log4perl if you want to send debugging output somewhere different than stderr. I have this in MyApp.pm just before my setup() call: unless ( $ENV{LOG4PERL} $ENV{LOG4PERL} eq 'local' ) { require Catalyst::Log::Log4perl; __PACKAGE__-log( Catalyst::Log::Log4perl-new( __PACKAGE__-path_to('log4perl.conf') . '' ) ); } and then my log4perl.conf file: log4perl.rootLogger=DEBUG, LOGFILE log4perl.appender.LOGFILE=Log::Log4perl::Appender::File log4perl.appender.LOGFILE.filename=/path/to/myapp.debug_log log4perl.appender.LOGFILE.mode=append log4perl.appender.LOGFILE.layout=PatternLayout log4perl.appender.LOGFILE.layout.ConversionPattern=[%r] %F %L %c - %m%n and finally, I start up my test server like: LOG4PERL=local perl script/myapp_server.pl so that the normal Catalyst log() feature is used. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Authentication::Credential::LDAP
On 07/22/2008 10:37 PM, Matt S Trout wrote: On Wed, Jun 25, 2008 at 11:27:13AM -0700, Bruce J Keeler wrote: Also, somewhat apropos, I have a C::A::{Store,Credential}::ActiveDirectory that I based on the LDAP stuff. The LDAP modules didn't work for me because they want to bind anonymously and retrieve the crypted password, whereas AD just wants to authenticate with a bind. So, having established this isn't true. Could you perhaps instead post a message asking why your config of the main LDAP store didn't work so we can figure out what configuration problem you had and document it? likely he is missing a 'binddn' and 'bindpw' config setting. The initial bind() will try anonymously if those are not set. What I usually do for Active Directory is create a user specifically for use with Net::LDAP (and by extension, C::A::Store::LDAP), and then do all my initial binds with that user/pass. 'binddn' and 'bindpw' are fully documented; if the docs can be improved, please send a patch. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] javascript in Catalyst using Template Toolkit
Jonathan Rockway wrote on 7/18/08 8:17 PM: Someone else suggested linking to '/lib/site/multifile.js'. I don't think that will work either. Jon is correct. I broke an ankle jumping to the conclusion that '/lib/site' was in the Static::Simple config include path. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] REST, JSON and Content-Type
On 06/16/2008 06:52 PM, Christopher Laco wrote: Committed to trunk. RT filed for MIME::Types claco++ -- Peter Karman . [EMAIL PROTECTED] . http://peknet.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/
[Catalyst] ANNOUNCE: 0.09_01 dev release of Rose::DBx::Garden::Catalyst
I've just uploaded a new 0.09_01 dev release of Rose::DBx::Garden::Catalyst to CPAN. The package has been completely refactored with one principle in mind: move what used to be generated code into test-able, subclass-able, Perl modules. The RDGC project was described in last year's Catalyst Advent calendar here: http://www.catalystframework.org/calendar/2007/7 Also new in this version: * support for YUI 2.5.x * Excel export of db records * lots of UI improvements Feedback, comments welcome. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Dbix-class] Re: [Catalyst] untainting utf8 text for db
Daniel McBrearty wrote on 6/7/08 5:25 AM: of course. But how do you regex an inclusive list for any character in any human language ? [\w]+ works pretty well iirc, if your locale includes UTF-8. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Changes to the behavior of $c-namespace in 5.7013
On 05/19/2008 06:04 PM, John Napiorkowski wrote: I'd just like to clarify this is the behavior we want and see if we can cook up a test for it. Is this giving anyone else trouble? FYI, I just sent a test patch exposing the problem to the catalyst-dev list. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] RFC: Catalyst::Controller::REST::DBIC
On 05/05/2008 02:33 PM, luke saunders wrote: On Mon, May 5, 2008 at 7:28 PM, Peter Karman [EMAIL PROTECTED] wrote: On 05/05/2008 12:16 PM, J. Shirley wrote: The discussions about a better CRUD base class with REST and RPC adapters is obviously the better (best?) solution, but I also think there will be significant disagreement between appropriate URI resource conventions (as my exchange with zby is an example of.) As has been mentioned before, there is an existing REST + CRUD implementation already on CPAN: http://search.cpan.org/dist/CatalystX-CRUD/lib/CatalystX/CRUD/REST.pm Out of interest, why did you not use Catalyst::Controller::REST here? A few reasons. One, the CRUD::REST primary design goal is to allow you to simply change your @ISA list in order to switch from RPC to REST style URIs. If you are already using a CX::CRUD::Controller-based class, you just put CX::CRUD::REST at the front of your @ISA list and voila. That goal would have required a bit more method aliasing and other hackery in order to support the *_VERB API in C::C::REST. Two, the C::C::REST module (and related Action class) have a lot of support for automatic serialization. CX::CRUD is completely agnostic about response type. Maybe it shouldn't be. But it is. Three, C::C::REST does not have real-world browser HTTP use in mind, as REST::ForBrowsers does. That's not bad; it's just more pure imo. CX::CRUD tries to support both, and as of yesterday, svn has support for the 'x-tunneled-method' param like REST::ForBrowsers does. Four, I didn't need the overhead. :) Having said all that, I expect that C::C::REST could work well with CX::CRUD::REST, and I'd love to see a patch that implements it, bearing in mind the points above. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] RFC: Catalyst::Controller::REST::DBIC
On 05/05/2008 12:16 PM, J. Shirley wrote: The discussions about a better CRUD base class with REST and RPC adapters is obviously the better (best?) solution, but I also think there will be significant disagreement between appropriate URI resource conventions (as my exchange with zby is an example of.) As has been mentioned before, there is an existing REST + CRUD implementation already on CPAN: http://search.cpan.org/dist/CatalystX-CRUD/lib/CatalystX/CRUD/REST.pm It definitely has URI styles in place already, though overriding fetch() to chain to a different root (like /id instead of /) seems trivial to me. There is also work started on a DBIC adapter, and existing model stores in place already for RDBO and filesystem (LDAP is on my TODO list). SVN is here: http://dev.catalyst.perl.org/repos/Catalyst/CatalystX-CRUD/ I hope to push a new release of CX::CRUD soon that will support the 'x-tunneled-method' syntax of drolsky's REST::ForBrowsers in addition to the '_http_method' syntax of prior CX::CRUD::REST releases. Please, consider building on existing code like CX::CRUD and/or suggesting changes to the current implementation, rather than starting a new project. There are already too many CRUD-style Catalyst modules on CPAN imho. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] RFC: Catalyst::Controller::REST::DBIC
On 05/05/2008 03:29 PM, J. Shirley wrote: My vote is hierarchy like: /foo /{token} # Can be pk1 if you so desire /- # - is never acceptable as an identifier /create # if you want an empty action here Now, I do vote against having an explicit create action, since POST /foo (or POST /foo/{token}) seems to be a more reasonable create action. fwiw, CX::CRUD::REST uses: http://search.cpan.org/~karman/CatalystX-CRUD-0.25/lib/CatalystX/CRUD/REST.pm#SYNOPSIS I use 0 (zero) as my reserved PK value since seq PKs start at 1 and zero evaluates as false in Perl. my ($self, $c, $oid) = @_; if (!$oid) { # could be absent or zero, either is fine # ... } Also, I adopted drolsky's suggestion of /create_form instead of /create in order to keep the RESTful no-verb style URIs. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Sending email safely with Catalyst
On 04/11/2008 04:42 AM, Paul Makepeace wrote: It's terribly easy to get this wrong so wanted some feedback from people who'd previously implemented something like this live before inadvertently turning my site into a spam conduit :-) I use the View::Email instead of the Plugin. I find that the View better fits my architecture philosophy and allows for easy email template management similar to my other HTML view templates. The same kind of security safeguards apply to sending email as for protecting against SQL injection and other taint issues. I don't try sending large numbers of email (see other replies on this thread for suggestions on that). Usually it's a confirmation email for some action the requester has made. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Problem storing session data
On 04/01/2008 03:17 AM, Peter Sørensen wrote: Thanks for the suggestion. I tried but this does not solve my problem. I'm a little uncertain on where to set theese values. I've done this: _PACKAGE__-config-{session = { storage = '/tmp/session'.$$, cache_size = '10m', page_size = '256k', expires = 3600 }; Should that instead be: __PACKAGE__-config( session = { storage = '/tmp/session'.$$, cache_size = '10m', page_size = '256k', expires = 3600 } ); -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: Patch for Catalyst::Plugin::Unicode::Encoding
Perhaps the best approach would be to warn and not decode when flagged data is seen, that way the data should never be deformed and the author can see that something else is decoding too early and they can fix it. I like this proposal. Doesn't break backwards compat and gives user something to chew on. Jon, what do you think? -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Instant CRUD with DBIC::Schema
On 03/12/2008 05:50 AM, Zbigniew Lukasiak wrote: After some more playing with CatalystX::CRUD I think I can formulate my arguments a bit more clearly. I believe the objects that users of CatalystX::CRUD get in their controller should be the real things - i.e. objects from their models not CatalystX::CRUD::Model::Objects. This would be the minimal interface and minimal hassle for injecting CatalystX::CRUD::Controller actions to a legacy Catalyst controller. Let me outline the problem I was trying to solve, and maybe you can suggest an alternate solution. Or explain why the problem I see is not the problem you see. My original idea for CX::CRUD was to design an API that was high-level enough that a CRUD Controller would not need to know anything specific about a CRUD Model, except what was defined by the CX::CRUD API. That is, if I was using Rose::HTML::Objects to manage my forms, my Controller could exchange DBIC for RDBO as its Model and not need to change any Controller code. Likewise, the Model need not know anything about the Controller except what was defined by the API. Ideally, all the logic for Controller and Model is encapsulated within each, and they talk to each other minimally and only through well-defined methods. Some levels of indirection were thus required. CX::CRUD is duct tape, but it ought to be sensible and predictable how the duct tape works. So then the questions began. Assuming I have a $form and an $object: (1) where and how should they interact? Should they interact in the Controller or the Model? Or somewhere not either of those? (2) should the $form and $object have any expectations about the methods available on the other object? Or how else can they interact in a relatively agnostic way? From a programming philosophy perspective, I could be persuaded about the answer to (1). I don't have strong opinions. IME, it's more practical for me in my Cat apps to put workflow kinds of code in a Controller, make my Models as thin as possible, and put as much code as possible in classes outside of Catalyst altogether. For CX::CRUD, I compromised, based on the pattern I followed in Catalyst::Controller::CRUD, and put the basic $form/$object interaction in the Controller, and made the Model a thin/convenient wrapper around the non-Catalyst model class(es). I did this because, to my way of thinking, it makes a sensible parallel construction to implement Form processing in the Controller and storage processing (business logic, whatever you want to call it) in the Model. The Model knows nothing about Forms; the Form is just one way of getting data to and from the Model, and since facilitating workflow is what a Controller does, the Form belongs in the Controller. Since I decided to put the $form/$object code in the Controller, the answer to (2) became more obvious to me: the objects should have some common expectations about each other. In the case of the $object, the $form should expect the $object to implement the basic CRUD methods: create() read() update() delete(). That's where CatalystX::CRUD::Object came from. It abstracts those 4 methods and leaves it up to CX::CRUD::Model authors to implement them for their particular model package (ORM, whatever). In the case of the $form, the $object should expect some way of getting and setting data (moving data to/from) the $form. That's where the CX::CRUD::Controller config values for 'init_form' and 'init_object' come from, and why the form_to_object() method is not implemented in the base Controller but left up to the specific Form implementation (like in CX::CRUD::Controller::RHTMLO). Now granted, a lot of my API ideas are influenced by how RHTMLO and RDBO work. I don't apologize for that; I like those APIs, which is why I use those packages. But I can understand that the DBIC/FormFu folks think differently, which is why there is more than one ORM and Form package out there. :) So, assuming I have identified the design problems correctly, I can imagine an alternate solution. Get rid of CatalystX::CRUD::Object. Put the create/read/update/delete methods in CatalystX::CRUD::Model instead. Change the base Controller behaviour to do this: $c-model( $self-model_name )-create( $object ); instead of this (what it does currently): $object-create; Now, I like the current implementation because it is (a) terser and (b) seems clearer to me what is happening. But if the design goal of common expectations for $form and $object is to be achieved, we need some way of defining that API. I'm open to suggestions of how to get rid of CX::CRUD::Object and still defining a way for Controllers to be Model agnostic. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.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
Re: [Catalyst] Instant CRUD with DBIC::Schema
On 03/12/2008 06:33 AM, Kieren Diment wrote: On 12 Mar 2008, at 21:50, Zbigniew Lukasiak wrote: After some more playing with CatalystX::CRUD I think I can formulate my arguments a bit more clearly. OK, bear in mind that you're competing with Reaction here. Reaction has some promise, but its development is slow so far (for casual users anyway), and it may suffer from some of the hyperverbosity and/or (superficially) excessive indirection that is endemic in enterprise ready™ software. I'm not qualified to comment further on this. I didn't get the sense that CX::CRUD is competing with Reaction. CX::CRUD is, as mst put it, a simple solution for a simple problem. Reaction seems to have loftier goals. By simple I mean it is supposed to be simple for the user. Subclass CX::CRUD::Controller::RHTMLO and you've adapted your existing RHTMLO form to Catalyst. The idea is the same as for jrockway's Model adapter. Authors of CX::CRUD Models and Controllers (like zby is attempting with DBIC and FormFu) may find it not so simple. Then it's up to us to hash out whether that is the fault of the documentation or the API or the design. Or some combination of those. I believe the objects that users of CatalystX::CRUD get in their controller should be the real things - i.e. objects from their models not CatalystX::CRUD::Model::Objects. This would be the minimal interface and minimal hassle for injecting CatalystX::CRUD::Controller actions to a legacy Catalyst controller. What I particularly like about InstantCRUD is that everything is spelled out nicely for the coder once they run the helper. That is, mostly once you've been through the catalyst learning curve, the instantcrud learning curve isn't very much more at all. InstantCRUD's main problem is HTML::Widget, and secondarily the lack of many-to-many introspection. I'm not sure how big the problem with the tight coupling with DBIC is - I'd like to see a shitfight between merlyn and mst, with zby as mediator to straighten that one out. Or maybe between merlyn and zby with mst mediating ... I think it would be best to be able to treat a CatalystX::CRUD application like any other catalyst application. That is, minimal modification of $c-model('Foo') compared to an ordinary catalyst app so that the CRUD generator mostly gets out of the way. Clarification: CX::CRUD is *not* a code generator. It is not like InstantCRUD in that sense. Or really in any sense. CX::CRUD is first an API and second a collection of base classes to make implementing that API easier for specific packages. That is, I never use CX::CRUD in my Catalyst apps. I use CX::CRUD::Controller::RHTMLO and CX::CRUD::Model::RDBO quite a lot. So does Rose::DBx::Garden::Catalyst, with which you might be confusing CX::CRUD. For bonus points I'd like to see a REST service available by default, with a browser based service available on top of this. This way we get the API for free and the browser UI gets to forward to the REST API (with suitable massaging of the stash). CX::CRUD::REST is part of the core dist. It is designed to make swapping between REST and RPC-style APIs as trivial as: use base qw( CatalystX::CRUD::REST CatalystX::CRUD::Controller::SomeThing ); where SomeThing is currently RHTMLO or (hopefully soon) FormFu. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Instant CRUD with DBIC::Schema
On 03/12/2008 10:27 AM, Zbigniew Lukasiak wrote: If you'd make them to use the same db connection than indeed this would be like the ModelAdaptor. But then again you should have just on adaptor per model type - not per table (for models with tables). certainly if you think CX::CRUD::Model::DBIC should be implemented that way, I encourage you to do so. The RDBO approach is 1class=1table, so the RDBO Cat Model follows that. All the classes can share (or not) a single DBI connection; that's up to how the underlying RDBO classes are configured. The db connection information is not part of CX::CRUD::Model::RDBO. It is only the DBIC model that requires that information. RDBO uses a separate class (Rose::DB) to implement DBI handle management, and that information is in the (non-Catalyst) RDBO classes. CX::CRUD::Model is completely agnostic about storage, connections, etc. It's up to the implementation to handle that part. If you like the model_adaptor() syntax in the Controller API, how would you implement a ModelAdaptor class and how would you change the Controller API to use it? You've left this part of my email unanswered... :) -- Peter Karman . [EMAIL PROTECTED] . http://peknet.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/