Re: [Catalyst] The Definitive Guide to Catalyst ... p. 165 listing all users and their roles
Instead of role.role_id.role you should do role.role.role obviously that's silly in how confusing it is, so eventually if I were you i'd make the column in the role table to be called name, and then instead of calling user_roles role, call then user_role. That would make the above user_role.role.name. Sorry, for the top post, replying from my phone On Jul 11, 2012 10:58 AM, Robyn Jonahs learn.catal...@gmail.com wrote: Hi, I am working through the chapter in the book to learn about many to many relationship bridges. I have made it through the chapter up to the last part where it has us list all users and their roles. Page 165 in Chapter 6. This is the template file root/authusers/list.tt html head titleAll users and their roles/title /head body table trthUserID/thth Username/ththeMail/ththRoles/th/tr [% WHILE (user = users_rs.next) %] tr td[% user.id %]/td td[% user.username %]/td td[% user.email %]/td td ul [% FOREACH role = user.user_roles %] li[% role.role_id.role %]/li [% END %] /ul /td /tr [% END %] /table /body /html If I remove the last role in the FOREACH loop it will list the id for the roles. It fails to list the text associated with the roles and I can't figure out what is going wrong. The only major difference between the book and what has happened for me locally is that DBIx::Class::Schema::Loader (version 0.07025 ) created the schema results as DBAuthTest$ ls lib/Auth/Schema/Result/ Role.pmUser.pmUserRole.pm Not the plurals as in the book (Roles.pm, User.pm and UserRoles.pm). I have been trying to track these names and keep it consistent with what I am doing as opposed to the book instructions and so far I have worked through it. The result gives the li dots but no values. So it is counting them correctly but not retrieving the values. I am stumped on this and any help at all would be greatly appreciated. The other relevant files are: The Controller = lib/DBAuthTest/Controller/AuthUsers.pm package DBAuthTest::Controller::AuthUsers; use Moose; use namespace::autoclean; BEGIN {extends 'Catalyst::Controller'; } =head1 NAME DBAuthTest::Controller::AuthUsers - Catalyst Controller =head1 DESCRIPTION Catalyst Controller. =head1 METHODS =cut =head2 index =cut sub base : Chained('/'): PathPart('authusers'): CaptureArgs(0) { my ( $self, $c ) = @_; $c-stash(users_rs = $c-model('AuthDB::User')); $c-stash(roles_rs = $c-model('AuthDB::Role')); } sub add : Chained('base'): PathPart('add'): Args(0) { my ( $self, $c ) = @_; if(lc $c-req-method eq 'post') { my $params = $c-req-params; ## Retrieve the users_rs stashed by the base action: my $users_rs = $c-stash-{users_rs}; ## Create the user: =head2 Original Code - keep for now as I don't trust the code below. my $newuser = $users_rs-create({ username = $params-{username}, email= $params-{email}, password = $params-{password}, }); =cut =head2 Catching Errors - No Workiee, not in their code either. =cut my $newuser = eval { $users_rs-create({ username = $params-{username}, email= $params-{email}, password = $params-{password}, }) }; if($@) { $c-log-debug( User tried to sign up with an invalid email address, redoing...); $c-stash( errors = { email = 'invalid' }, err = $@ ); return; } return $c-res-redirect( $c-uri_for( $c-controller('AuthUsers')-action_for('profile'), [ $newuser-id ] ) ); } } sub user : Chained('base'): PathPart(''): CaptureArgs(1) { my ($self, $c, $userid) = @_; my $user = $c-stash-{users_rs}-find({ id = $userid },{ key = 'primary' }); die No such user if(!$user); $c-stash(user = $user); } sub profile : Chained('user') :PathPart('profile'): Args(0) { my ($self, $c) = @_; } sub edit : Chained('user') :PathPart('edit'): Args(0) { my ($self, $c) = @_; if(lc $c-req-method eq 'post') { my $params = $c-req-params; my $user= $c-stash-{user}; ## Check user is allowed to update this profile #if($c-user-object-id != $user-id) { # die Malicious attempt to update another user by: . $c-user-username; #} ## Update user's email and/or password $user-update({ email = $params-{email}, password = $params-{password}, }); ## Send the user back to the changed profile return $c-res-redirect( $c-uri_for( $c-controller('AuthUsers')-action_for('profile'), [ $user-id ] ) ); } } =head2 Original sub set_roles :Chained('user'): PathPart('set_roles'): Args() { my ($self, $c) = @_; my $user = $c-stash-{user}; if(lc $c-req-method eq 'post') { ## Fetch all role ids submitted as a list my @roles =
[Catalyst] Conversion from Subversion to Git complete!
I should have sent this out on Tuesday, but it slipped my mind. The conversion is complete! You can access the new repo at gitweb: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits/Catalyst-Runtime.git;a=summary read access: git://git.shadowcat.co.uk/catagits/Catalyst-Runtime.git read/write: catag...@git.shadowcat.co.uk:Catalyst-Runtime.git If you'd like to get write access to the repo pop into the IRC channel (#catalyst on irc.perl.org) and ask about it; we can possibly get you hooked up -- fREW Schmidt http://blog.afoolishmanifesto.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] Conversion from Subversion to Git complete!
Woops, that was a frew fail, here's the real gitweb url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits/Catalyst-Runtime.git;a=summary -- fREW Schmidt http://blog.afoolishmanifesto.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 Git Conversion
Yet another re-export as we were missing a number of tags and the branches had silly names. Get it while it's hot: https://github.com/frioux/Catalyst -- fREW Schmidt http://blog.afoolishmanifesto.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 Git Conversion
That's right. I just used github while converting repos as I can administer it easily as need be On Feb 15, 2011 2:30 PM, Kieren Diment dim...@gmail.com wrote: On 16/02/2011, at 7:14 AM, Christiaan Kras wrote: Just a small suggestion, but if the Git repositories for Catalyst are going to be hosted on GitHub wouldn't a single Organization on GitHub be neater to keep the repositories centralized? They'll be hosted by Shadowcat when the time comes to switch off/deprecate the svn hosting as far as I know. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst Git Conversion
On Mon, Feb 14, 2011 at 9:57 AM, Ronald J Kimball rkimb...@pangeamedia.comwrote: On Sat, Feb 12, 2011 at 3:45 AM, fREW Schmidt fri...@gmail.com wrote: #1: is it correct that the svn user rjk is Ronald J Kimball r...@linguist.dartmouth.edu ? That email address is no longer active. Please use rjk@tamias.netinstead. My github username is tamias. Yeah, I discovered that when I emailed it :-) Thanks! Just so everyone knows, the github mapping is done by email, so as long as you use the same email address on github as whatever project, you'll get credited by github's system. I'm excited to have Catalyst in git! Me too! Hopefully we can turn the switch by the end of this week! -- fREW Schmidt http://blog.afoolishmanifesto.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 Git Conversion
Ok, I've just re-exported the whole repo to fix the two author issues I've been notified of. I also ensured that the github users of those two authors were picked up correctly. If anyone else notices anything let me know. -- fREW Schmidt http://blog.afoolishmanifesto.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 Git Conversion
Also just converted the manual, see https://github.com/frioux/Catalyst-Manual Two issues I know of are we have no idea who u-foka is and we need confirmation that tome is Tom Eliaz -- fREW Schmidt http://blog.afoolishmanifesto.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] Catalyst Git Conversion
Hello All! Some of you already know that I am working on converting the Catalyst repository to git. I am happy to announce that I am closing in on completion! The current state of the git repo: https://github.com/frioux/Catalyst The script to convert it: https://github.com/frioux/Git-Conversions/blob/master/cat-convert The only things I know of that we must have before we finalize this conversion is: #1: is it correct that the svn user rjk is Ronald J Kimball r...@linguist.dartmouth.edu ? #2: who is svn user didls? Also, if you'd like to help ensure the sanity of the repo it would be great if you looked at it! Here are a few tools I use to try to get a feel for the quality of the final export: gitk --all Perusing the repo with gitk is good; another great thing to do is to View - Edit View and click Strictly sort by date. This is helpful for finding duplicate commits. Note that there are some commits that look duplicate in this repo but actually aren't; people decided it would be best to edit multiple branches in a single commit instead of just dealing with that at merge time. git shortlog -s This will make it clear if I misspelled your name. Also looking at blames of files can be handy. Hopefully this helps! -- fREW Schmidt http://blog.afoolishmanifesto.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] Jobs, jobs, jobs, and jobs (don't forget about jobs!)
Hello all! The company I am working for is hiring! Required: Experience with DBIx::Class and Catalyst We are In Richardson, TX and willingness to relocate and work onsite is highly preferred Preferred: Self starters Experience with Javascript Experience with ExtJS We have done perl web development for nearly 10 years and we currently have way too much work for our small shop (6~ developers) to handle. Except for one product (which we own and sell) all of our work is currently long term (1 year or more) contracts with a variety of customers. Since working here (almost 2 years) we have moved from vanilla CGI + DBI with IIS to Catalyst, DBIx::Class and mod_perl. If you are motivated and get results the people running the company listen to you, so if you are stuck in a giant company doing way too much PERL come join us! Send your resumes my direction and feel free to email me or if you are on IRC msg me (frew on perl, frooh on freenode) with any questions you might have. I look forward to hearing from you! -- fREW Schmidt http://blog.afoolishmanifesto.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] mod_fcgid on win32
Hey guys, So I'm trying to get us to go from mod_perl to mo_fcgid so that I can stop using ActivePerl and start using strawberry on our server (can't get mod_perl to build for the life of me.) Anyway, here's my current config: VirtualHost *:8080 DocumentRoot C:/aircraft_ducting/root/ Alias /static C:/aircraft_ducting/root/static Alias / C:/aircraft_ducting/script/acd_fastcgi.pl/ Location / AddHandler fcgid-script .pl Options ExecCGI SetOutputFilter DEFLATE /Location Location /static SetOutputFilter DEFLATE SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary SetHandler default-handler /Location /VirtualHost When I go to host:8080 I get: [Thu Jan 28 02:31:57 2010] [warn] [client 10.6.1.73] (OS 109)The pipe has been ended. : mod_fcgid: get overlap result error [Thu Jan 28 02:31:57 2010] [error] [client 10.6.1.73] Premature end of script headers: acd_fastcgi.pl In the error.log I'm afraid this might be a win32 issue :-/ Anyway, does anyone have any input on this? I'd really like to get this working. -- fREW Schmidt http://blog.afoolishmanifesto.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] mod_fcgid on win32
On Thu, Jan 28, 2010 at 8:56 AM, Tomas Doran bobtf...@bobtfish.net wrote: Alexander Hartmaier wrote: ARGH I've looked *multiple* times for it, but not in the non-free repo. Do you know why it is there? I think the clue is in the name :) It's not licensed such that debian include it in their 'normal' repositories.. Ah, is that why it's not officially blessed by apache like mod_fcgid? -- fREW Schmidt http://blog.afoolishmanifesto.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] mod_fcgid on win32
Ok, so I may be getting somewhere with this, but I can't tell. I installed the .dll found here: http://www.fastcgi.com/dist/ and now my config looks like the following: VirtualHost *:8080 DocumentRoot C:/aircraft_ducting/root/ Alias /static C:/aircraft_ducting/root/static FastCgiServer C:/aircraft_ducting/script/acd_fastcgi.fcgi -processes 3 #Alias / C:/aircraft_ducting/script/acd_fastcgi.fcgi Alias / C:/aircraft_ducting/script/acd_fastcgi.fcgi/ Location /static SetOutputFilter DEFLATE SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary SetHandler default-handler /Location /VirtualHost When I run the fastcgi script manually from the commandline it prints out our root page, which seems like a good sign. Yet when I go to host:8080 I get a 500 and the following is printed in the logs: [Thu Jan 28 21:10:07 2010] [warn] FastCGI: server C:/aircraft_ducting/script/acd_fastcgi.fcgi (pid 788) terminated with exit with status '0' [Thu Jan 28 21:10:07 2010] [warn] FastCGI: server C:/aircraft_ducting/script/acd_fastcgi.fcgi restarted (pid 944) [Thu Jan 28 21:10:12 2010] acd_fastcgi.fcgi: Use of uninitialized value $ENV{REMOTE_ADDR} in string ne at C:/usr/site/lib/Catalyst/Engine/CGI.pm line 61. [Thu Jan 28 21:10:12 2010] acd_fastcgi.fcgi: Use of uninitialized value $ENV{SERVER_PORT} in numeric eq (==) at C:/usr/site/lib/Catalyst/Engine/CGI.pm line 85. [Thu Jan 28 21:10:12 2010] acd_fastcgi.fcgi: Use of uninitialized value $host in pattern match (m//) at C:/usr/site/lib/Catalyst/Engine/CGI.pm line 136. [Thu Jan 28 21:10:12 2010] acd_fastcgi.fcgi: Use of uninitialized value $host in substitution (s///) at C:/usr/site/lib/Catalyst/Engine/CGI.pm line 185. [Thu Jan 28 21:10:12 2010] acd_fastcgi.fcgi: Use of uninitialized value $host in concatenation (.) or string at C:/usr/site/lib/Catalyst/Engine/CGI.pm line 196. [Thu Jan 28 21:10:12 2010] acd_fastcgi.fcgi: Use of uninitialized value $host in concatenation (.) or string at C:/usr/site/lib/Catalyst/Engine/CGI.pm line 204. [Thu Jan 28 21:10:12 2010] acd_fastcgi.fcgi: Use of uninitialized value in string eq at C:/usr/site/lib/Catalyst/Action/RenderView.pm line 52. [Thu Jan 28 21:10:12 2010] acd_fastcgi.fcgi: Use of uninitialized value in string eq at C:/usr/site/lib/Catalyst.pm line 1714. Any ideas on what I might try next? -- fREW Schmidt http://blog.afoolishmanifesto.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] Anyone want a little bit of contract work?
Hey guys, Some of you may have read my blog post about this ( http://blog.afoolishmanifesto.com/archives/1162). Basically I would really like if someone can help us make some PDF's or postscript templates or something. Please read the link above for more details on what I've tried and whatnot. I'm including a link of a couple of the pages we need defined. It's a screenshot of the data designer in vb6, the data designer file, and a scan of one of the printouts from one of the two examples. http://afoolishmanifesto.com/examples.zip If you are interested you can call me at (972) 231-6874 x108 We can discuss terms with my boss. It's friday and almost 2PM here, so you may want to wait to monday to call. You can always reach me by email. Hope to hear from someone! -- fREW Schmidt http://blog.afoolishmanifesto.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] Testing OpenID Logins + more
Hey guys, I'd really like to start testing my controllers, and I wished I'd started sooner, but oh well. The biggest barrier at this point is the login system. It uses OpenID for auth, which is where the hard stuff comes from. I *have* looked at the tests for the OpenID module for catalyst auth, and although I'll surely end up using something like that, it's pretty intimidating. Does anyone have any existing basic tests for OpenID stuff, to test their server, as opposed to the OpenID module, that they might be willing to share? I'd really appreciate it. In the meantime I'll be trying to look more at Ashley's stuff. Thanks! -- fREW Schmidt http://blog.afoolishmanifesto.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] Splitting up a large application: Shared config and templates for multiple applications
On Fri, Aug 28, 2009 at 9:08 AM, Bill Moseley mose...@hank.org wrote: On Fri, Aug 28, 2009 at 6:41 AM, Matt Whipple m...@mattwhipple.comwrote: Anyone building applications out of multiple small Catalyst applications like this? How do you set up the apps to share templates and a config? Anything more interesting than passing in paths? One downside of this approach is we end up with a handful of very similar looking applications (same set of plugins, etc.), not to mention have to be careful about how session data is shared, and so on. I wounder if it would be difficulst to customize the catalyst.pl script to include a standard set of plugins/roles that we use in every application -- e.g. have a skeleton app. Subclass. This could probably take care of sharing the template/config resources also, but otherwise I'd probably lean towards symlinking over modifying each app. Subclass what? I was thinking that I'd have to use an environment variable to point to the location of the base application (the one with the base tempates and app-wide config) and then add to the template INCLUDE_PATH. Or maybe have the applications look at $app_home/../$base_app/. Seems there was some discussion not too long ago of drop-in modules for application, similar to what many CMSs have. Interestingly, I think the Rails guys (or was it Merb?) made something kindav like this. Basically they made it so that you can drop a Rails app into an existing Rails app and things just work. I don't know enough about Rails to say how well it works and whatnot, and I know that because Catalyst is much more flexible it is unlikely that we could do anything to make it as convenient, but maybe we could look into something like this? I know Chained actions and our lack of a single location of routes ameliorates this enough that this is probably something not a lot of Cat teams would use. Anyway, just some thoughts in relation to this stuff... -- fREW Schmidt http://blog.afoolishmanifesto.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 flattening arrays in Catalyst/Helper/Model/DBIC/Schema
On Wed, Aug 26, 2009 at 4:30 AM, Will Hawes wdha...@gmail.com wrote: 2009/8/26 clive glew clive.proje...@gmail.com: so it appears that autobox causes problems. any ideas on how to fix it? Unrelated to Catalyst (but perhaps relevant to this problem), I've also seen issues with autobox on ActivePerl 5.8.8 build 822 - namely that it doesn't work at all, not even the minimal examples in the synopis, even though autobox and autobox::Core were sourced from the AS ppm repository. No problems on ActivePerl 5.10, perhaps someone at AS botched the creation of the 5.8 package? Sorry, I hadn't seen this already. I reported the but re ActivePerl Package here: http://bugs.activestate.com/show_bug.cgi?id=84155 The issue is probably the same for OP. Just rebuild autobox and you should be good. AP users follow directions in the link. -- fREW Schmidt http://blog.afoolishmanifesto.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] DB Functions in the Schema
I don't know the answer to this off the top of my head, but I do know that you mailed it to the wrong people :-) You are much more likey to get a good answer if you send this to the DBIC ML. Good luck! On Aug 17, 2009 3:13 AM, Trevor Phillips trevor.phill...@gmail.com wrote: Is there an easy way to represent a DB function call as a named column within a DBIx::Class schema? eg; If at the DB level I would do something like: select updated, from_unixtime(updated) as updated2 from mytable; ... can I have; __PACKAGE__-add_columns( updated, { data_type = TIMESTAMP } updated2, { something = from_unixtime(updated), etc...} ... ); Thanks. -- Trevor Phillips - http://dortamur.livejournal.com/ On nights such as this, evil deeds are done. And good deeds, of course. But mostly evil, on the whole. -- (Terry Pratchett, Wyrd Sisters) ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Loading template according to request path
On Tue, Aug 11, 2009 at 3:01 PM, Matt Whipple m...@mattwhipple.com wrote: J. Shirley wrote: On Tue, Aug 11, 2009 at 12:09 PM, Matt Whipple m...@mattwhipple.commailto: m...@mattwhipple.com wrote: Is there a presently existing mechanism which flexibly allows for template selection according to the request URI? For instance a request to www.myapp.com/somepage http://www.myapp.com/somepage would set something like stash(template = 'somepage.tt http://somepage.tt') if the file exists and continue to be processed by the appropriate or default action. I wrote something which does this which I'm about to spend some time cleaning up and optimizing but don't want to be reinventing any wheels (especially likely smoother ones). ___ List: Catalyst@lists.scsys.co.uk mailto:Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ This is the default behavior for View::TT, as it says in the POD: If a stash item isn't defined, then it instead uses the stringification of the action dispatched to (as defined by $c-action) in the above example, this would be |message|, but because the default is to append '.tt', it would load |root/message.tt http://message.tt|. Is that not what you wanted? -J That is matching according to action, I'm looking to match on path (without having to create logically redundant complementary actions). Well, you could be clever and do some kind of thing in an auto to do that -- fREW Schmidt http://blog.afoolishmanifesto.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] Chained, root action, with default sub present
On Mon, Aug 10, 2009 at 1:00 PM, Matija Grabnar mat...@serverflow.comwrote: J. Shirley wrote: On Sun, Aug 9, 2009 at 7:31 AM, Matija Grabnar mat...@serverflow.commailto: mat...@serverflow.com wrote: I think this may be either a bug or something I don't understand about specifying chained actions. Suppose I have a controller which has a defined default action (such as created by catalyst.pl by default, i.e. sub default :Path { my ( $self, $c ) = @_; $c-response-body( 'Page not found' ); $c-response-status(404); } To that I add a root action, the start of the chain, like so: sub index :Chained('/') PathPart('') :Args(0) { my ( $self, $c ) = @_; # Hello World $c-response-body( $c-welcome_message ); } Now, whenever I request '/' from that script, default action triggers, and the index action doesn't. If I comment out the default action, the index DOES get called. Is this a bug? If not, what do I have to change to have both index and default in my root controller? Hi Matija, If you change the default attributes to Private it will do what you expect. I think this may be a bug, though (thought this was fixed, but I may be remembering wrong). Ah, not quite. Setting private on default does cause index to be called when fetching /, but now default doesn't get called for unknown paths. The index action should match / (though, in this circumstance you aren't really chaining to anything, so it would make more sense to use sub index : Path, which would do what you expect) To demonstrate the bug, I tried to make a minimal script that still showed it. The original script, the one which led me to discover this bug, was considerably bigger, and did indeed need / as part of the chain. But there's no point in posting the whole, multi-controller beast if I can demonstrate the bug with the most basic, two subroutine controller. I think the problem is that you have it defined as Chained. Is that what you want? I think you just want index : Path Args(0) { ... } -- fREW Schmidt http://blog.afoolishmanifesto.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] Issues with Session::Store::DBIC + MSSQL
On Tue, Aug 4, 2009 at 4:12 PM, Daniel Westermann-Clark d...@pobox.comwrote: On 2009-08-04 10:20:22 -0500, fREW Schmidt wrote: I am trying to set up Session::Store::DBIC but I am getting no love. Here is all of the relevant (afaik) data: Error: [Tue Aug 4 09:54:25 2009] acd_server.pl: DBIx::Class::ResultSet::find_or_create(): DBI Exception: DBD::ODBC::st fetchrow_array failed: [Microsoft][SQL Native Client]String data, right truncation (SQL-01004) [for Statement SELECT me.id, me.session_data, me.expires FROM Session me WHERE ( me.id = ? ) with ParamValues: 1='session:c28d6383a2b334128738f4b70ee08ff7df5cd737'] at c:/strawberry/perl/site/lib/Catalyst/Plugin/Session/Store/DBIC/Delegate.pm line 73 That session ID is 48 characters long, but your table was created with a column length of 72 characters (as recommended in the docs). Could you try creating the table using a VARCHAR instead of CHAR? Perhaps MSSQL is being strict about the length of the input string. If this turns out to be the case, think you could throw together a doc patch? SQL Creation Script CREATE TABLE dbo.Session ( id char(72) NOT NULL, session_data text, expires int ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO Unfortunately I'm getting the same error. Any other ideas? -- fREW Schmidt http://blog.afoolishmanifesto.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] Issues with Session::Store::DBIC + MSSQL
Hey guys, I am trying to set up Session::Store::DBIC but I am getting no love. Here is all of the relevant (afaik) data: Error: [Tue Aug 4 09:54:25 2009] acd_server.pl: DBIx::Class::ResultSet::find_or_create(): DBI Exception: DBD::ODBC::st fetchrow_array failed: [Microsoft][SQL Native Client]String data, right truncation (SQL-01004) [for Statement SELECT me.id, me.session_data, me.expires FROM Session me WHERE ( me.id = ? ) with ParamValues: 1='session:c28d6383a2b334128738f4b70ee08ff7df5cd737'] at c:/strawberry/perl/site/lib/Catalyst/Plugin/Session/Store/DBIC/Delegate.pm line 73 SQL Creation Script CREATE TABLE dbo.Session ( id char(72) NOT NULL, session_data text, expires int ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO ALTER TABLE dbo.Session ADD CONSTRAINT PK_Session PRIMARY KEY CLUSTERED ( id ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO COMMIT DBIC Model: package ACD::Schema::Result::Session; use base DBIx::Class; use strict; use warnings; use Method::Signatures::Simple; use CLASS; CLASS-load_components(qw/Core/); CLASS-table('Session'); CLASS-add_columns(qw/ id session_data expires /); CLASS-set_primary_key('id'); 'Truth-fact!'; Configuration in ACD.pm session = { dbic_class = 'DB::Session', expires= 60*60, # one hour }, Does anyone have any ideas regarding this? -- fREW Schmidt http://blog.afoolishmanifesto.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/