Re: [Catalyst] Web hosting?
G'day! Jumpline are offering 12 months free VDS hosting at the moment using this coupon: https://ssl.jumpline.com/order/?c=3UFWOTHC I'm just about to have a go setting up my first hosted Catalyst app on there to see if it works. I figure if I can't get it going in their environment at least I'm not out of pocket. On Sun, 2007-12-16 at 12:07 +0800, Martin Ellison wrote: Can anyone recommend a web hosting provider for Catalyst applications? Or for that matter, warn us off any providers that you have had bad experiences with? -- Shane McEwan Don't anthropomorphise computers, they don't like it! ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] sending email with attachment
How are others out there doing this? My application serves a .pdf file directly, but I'd like to send as an email attachment to the account as well. Looking at Catalyst/View/Email/Template.pm in the 'TO DO' section, There needs to be a method to support attachments... So, are there any recommendations for how to proceed? Generally I'd use MIME::Lite for this outside of Catalyst, but I'd like to stay in the Plugin:: space, and word is MIME::Lite isn't the best way currently. Cheers, -- |\ /|| | ~ ~ | \/ ||---| `|` ? ||ichael | |iggins\^ / michael.higgins[at]evolone[dot]org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [OT] ASP.NET MVC
The chained thing is probably the single most useful thing in cat IMO (if it's possible to even make such a dumb call ;) The way I have come to see it (it took a while, reading discussions here helped me grasp this) is that the way you design your URI space is very very fundamental to design of a web app. Chained helps you to remember this and try to get it right at the start. It also makes the decision about what actions go in what controllers separate from decisions about URI namespace. (I haven't really figured out if that is entirely a good thing or not, but it seems helpful.) The syntax *is* a bit hard to get used to at first - I find that the important thing is to remember that Args() defines an endpoint (hope I am remembering that right), other than that take a good look at what the debug server tells you when it starts up. (Without that info it'd be a royal PITA) Centralised routing stuff might be nice to have, but the way Chained flies now is pretty darn neat, once you get used to it. For me, I think I might prefer to be able to see the routing info right there in the action definition - where you need it. There isn't much cause to use anything other than Chained, as far as I can see (except the odd private helper method). BTW I talked about this a bit at the (first) Brussels Perl Mongers group a month or two back, and I have someone coming round for a beer later this evening - they have been wanting to port their Mason app to Catalyst, and I'm gonna see if I can help them get started. cheers Daniel ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Create and store new cookie
Hi list, I would like to be able to create and store new cookie(s) for user display options for my application. I am currently using C::P::Session::Store::Cooke to store the user session but I would like to add a new cookie. I am trying by setting in one of my Controller sub a cookie like that: $c-res-cookies-{my_options} = { foo = 1, bar = 2 }; $c-res-redirect($c-uri_for('some_url')); If I dump $c-res I can see the cookie freshly created. However if I come back to the options page later, I don't have this cookie anymore. I check with this : unless($c-req-cookie($c-config-{my_cookie_name})){ $c-log()-info(New cookie to create...); } Then I can see this message each time I go the options page. Also, I can see that my session cookie 'myapp_session' is well stored but as a CGI::Simple::Cookie object, not a hash reference as mentioned in the response 'cookie' doc (http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7011/lib/Catalyst/Response.pm#$res-%3Ecookies) Does anyone has a clue about this? Does the redirect causes the reset of the cookies? Thanks a lot Regards Emmanuel -- - Emmanuel Quevillon Biological Software and Databases Group Institut Pasteur +33 1 44 38 95 98 tuco at_ pasteur dot fr - ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] sending email with attachment
It's a view, not a plugin! View::Email can send attachments, for View::Email::Template you need to create the MIME part with MIME::Creator yourself atm. Patches are welcome ;-) -Alex -Original Message- From: Ash Berlin [mailto:[EMAIL PROTECTED] Sent: Monday, December 17, 2007 4:48 PM To: The elegant MVC web framework Subject: Re: [Catalyst] sending email with attachment On 17 Dec 2007, at 15:25, Michael Higgins wrote: How are others out there doing this? My application serves a .pdf file directly, but I'd like to send as an email attachment to the account as well. Looking at Catalyst/View/Email/Template.pm in the 'TO DO' section, There needs to be a method to support attachments... So, are there any recommendations for how to proceed? Generally I'd use MIME::Lite for this outside of Catalyst, but I'd like to stay in the Plugin:: space, and word is MIME::Lite isn't the best way currently. Cheers, I just use MIME::Lite in my cat app. And I've never understood the desire to use plugins for everything under the sun... but thats just me. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/ smime.p7s Description: S/MIME cryptographic signature ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] sending email with attachment
On Dec 17, 2007 8:44 AM, Hartmaier Alexander [EMAIL PROTECTED] wrote: It's a view, not a plugin! View::Email can send attachments, for View::Email::Template you need to create the MIME part with MIME::Creator yourself atm. Patches are welcome ;-) -Alex -Original Message- From: Ash Berlin [mailto:[EMAIL PROTECTED] Sent: Monday, December 17, 2007 4:48 PM To: The elegant MVC web framework Subject: Re: [Catalyst] sending email with attachment On 17 Dec 2007, at 15:25, Michael Higgins wrote: How are others out there doing this? My application serves a .pdf file directly, but I'd like to send as an email attachment to the account as well. Looking at Catalyst/View/Email/Template.pm in the 'TO DO' section, There needs to be a method to support attachments... So, are there any recommendations for how to proceed? Generally I'd use MIME::Lite for this outside of Catalyst, but I'd like to stay in the Plugin:: space, and word is MIME::Lite isn't the best way currently. Cheers, I just use MIME::Lite in my cat app. And I've never understood the desire to use plugins for everything under the sun... but thats just me. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/ Patches very welcome. I'll probably get this functionality in place in the next 6 weeks though, so if you want to collab just holler at me directly. -J -- J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one bird... http://www.toeat.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Permission Denied??
Hi, I have an instance of an object in my Catalyst application called $MP_Model. I have been using it successfully to call its methods until today, when I received a 'permission denied' message: Caught exception in Play::Controller::Maths-m_summarypg Cannot open file:Permission denied and from Stack Trace: Play::Controller::Maths 65: # Get ProteinName data structure through Protein Summary Data from Model.pm in MP. 66: my $summarydata = $MP_Model-ProteinSummaryData({ProteinName = [$param]}); 67: my $structuredata = $MP_Model-GetAllStructureData({ProteinName = [$param]}); I added line 67, and that is when I get the error. Line 66 works fine, and the GetAllStructureData method works fine in the application that it is part of, but that is what is causing the 'permission denied' error. Why 'permission denied'?? What file could it be saying cannot be opened? Emily ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] no role configuration found -- authorization: dbic and DBI::Schema::Loader
I backed up to a simple test script, got easier to find errors, and found the trouble with what I was doing. __PACKAGE__-many_to_many(roles = 'user_roles', 'name'); needed to be __PACKAGE__-many_to_many(roles = 'user_roles', 'role'); and a corresponding many_to_many in Role.pm __PACKAGE__-many_to_many(users = 'user_roles', 'user'); So, I'm all good now but still a bit mystified about the silent failure(?). Thanks again, -Ashley On Dec 16, 2007, at 10:49 PM, Ashley Pond V wrote: Thanks for still looking at this, Jay. This is the top of the method with some die decoration: Take 1: my ( $self, $c ) = @_; die This will die; $c-assert_user_roles(no such role); Take 2: my ( $self, $c ) = @_; $c-assert_user_roles(no such role); die This will not fire; I can put the assert in an eval block but $@ is not set so it doesn't help to see what's happening. There is no information in the logs at the point the code fails. I guess I'll ask our admin to pull Catalyst::Plugin::Authentication::Store::DBIx::Class, yeah? Authentication is working fine, by the by. It's just Authorization that's wonky right now. Pasting my setup stuff below. -Ashley -- use Catalyst qw/ ConfigLoader -Debug Unicode StackTrace Static::Simple Authentication Authorization::Roles Session Session::Store::FastMmap Session::State::Cookie /; ...User.pm __PACKAGE__-has_many( user_roles, MyApp::Schema::UserRole, { foreign.user = self.id }, ); # Created by DBIx::Class::Schema::Loader v0.04004 @ 2007-12-16 13:36:55 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:qroNdEXQL4pOH80kVPQquw __PACKAGE__-many_to_many(roles = 'user_roles', 'name'); --- yml authentication: default_realm: users realms: users: credential: class: Password password_type: hashed password_hash_type: SHA-1 store: class: DBIx::Class user_class: User role_relation: roles role_field: name # doesn't matter whether or not the authorization stuff is there but this is what i've played with (and *many* permutations of the arguments) authorization: dbic: role_class: Role role_field: name user_class: User user_field: user user_role_user_field: user user_role_role_field: role role_rel: user_roles user_role_class: UserRole On Dec 16, 2007, at 9:20 PM, Jay K wrote: Hi Ashley, The log message you see is a result of the recent move away from the Catalyst::Plugin::Authentication namespace for stores / credentials. It falls back to the old naming and warns if it can't find the new module.. It should, however, have no effect on the functionality of the code. It's not a bad idea to update the DBIx::Class store - but be sure to remove the Catalyst::Plugin::Authentication::Store::DBIx::Class module first - just to avoid conflicts. Nothing has changed related to roles in the update, so it shouldn't make any difference. I don't know why the assert is failing, it should not - what do you get if you use $c-check_user_roles() - valid results? Jay On Dec 16, 2007, at 4:27 PM, Ashley Pond V wrote: Continuing saga. So I set up the many_to_many and lo! It worked. But it worked with *any* role, even fake ones, so obviously something was bad. Turned out that it was silently failing instead of throwing an access exception (but there was a template set by the namespace so the page rendered as expected). # failed silently (as far as Cat was concerned) $c-assert_user_roles(there is no role called this); So, dug into the log: [Sun Dec 16 16:13:20 2007] [error] [client 67.170.68.172] [warn] Store class Catalyst::Authentication::Store::DBIx::Class not found, trying deprecated ::Plugin:: style naming. , referer: [...] Would love to have more, rather than fewer exceptions thrown. I think the missing class was the cause of a couple of red herrings I followed down the rabbit hole trying to get this running yesterday [I'm entitled to mix metaphors, I pay an annual fee]. After I get an admin to install the missing package in the morning I'll regale you with my next series of missteps and annoying language. Live free or die early, die often, -Ashley On Dec 15, 2007, at 9:52 PM, Jay K wrote: Hi There Ashley, The DBIx::Class module expects to use the relation provided in the role_relation config element to retrieve one or more rows, which must contain a field called by whatever you provide in role_field. My guess is that your user_roles table is a cross-ref table - userid and roleid essentially. In order to solve this you need to use a many_to_many relationship mapping to the textual role names. The DBIx::Class module expects you are going to route it to the information it needs using the role_relation. So what you really need to do is create the schema class and just define the many-to-many
Re: [Catalyst] [OT] ASP.NET MVC
I'm still holding hopes for: Chained('../') -=Chris signature.asc Description: OpenPGP digital signature ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [OT] ASP.NET MVC
On Dec 17, 2007 4:03 PM, Daniel McBrearty [EMAIL PROTECTED] wrote: The chained thing is probably the single most useful thing in cat IMO (if it's possible to even make such a dumb call ;) The way I have come to see it (it took a while, reading discussions here helped me grasp this) is that the way you design your URI space is very very fundamental to design of a web app. Chained helps you to remember this and try to get it right at the start. It also makes the decision about what actions go in what controllers separate from decisions about URI namespace. (I haven't really figured out if that is entirely a good thing or not, but it seems helpful.) The syntax *is* a bit hard to get used to at first - I find that the important thing is to remember that Args() defines an endpoint (hope I am remembering that right), other than that take a good look at what Yeah - some time ago I proposed to add an EndPoint attribute and get rid of the CaptureArgs one that is not very intuitive (and use Args in both cases). -- Zbigniew Lukasiak http://brudnopis.blogspot.com/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [OT] ASP.NET MVC
On Mon, Dec 17, 2007 at 07:31:21AM -0800, John Napiorkowski wrote: Yeah, the main configuration is definitely the right place to be maintain centralized routing and to more cleanly separate the URI namespace. Just that as you say, it's not clear to people when they first start probably because there isn't a lot of people saying that and the documentation and quick start guides don't seem to promote that idea. No, it's absolutely and horribly the wrong place - that's why nobody uses the feature even though it's supported. It basically turns your main mapping into a god object; why does the mapping info for the admin interface need to be related in any way shape or form to the mapping for the user interface, for example? Self-contained URI mapping info for controllers is essential to encapsulated code re-use. The one time I tend to use the main app config to supply such info is to rename a particular part of a site for a specific deployment - for e.g. if I have MyApp::Controller::Blog::base :Chained('/') :PathPart('blog') :CaptureArgs(0) I might do Controller Blog Action base PathPart news /Action /Controller to rename that URI segment to /news instead of /blog. If you give me a template to start with, either as an advent article or other I will definitely try to expand it out, as long as you don't me giving it the once or twice over. I was offering to provide an example of how to use base classes in ways that are entirely impossible with a crappy central routing system - the Reaction CRUD controller is a good example of this, it provides $base/ $base/create $base/id/*/view $base/id/*/edit $base/id/*/delete actions, where $base is the chain part leading up to 'sub base' So to bind that in you do package MyApp::Controller::Admin::Foo use base qw(Reaction::UI::Controller::CRUD); __PACKAGE__-config( actions = { base = { Chained = '/admin/base', PathPart = 'foo' } }, ... # model name etc. here ); and assuming you have MyApp::Controller::Admin::base :Chained('/') :PathPart('admin') :CaptureArgs(0) /admin/foo/ /admin/foo/create /admin/foo/id/*/view /admin/foo/id/*/edit /admin/foo/id/*/delete actions all immediately appear ready to go. This sort of thing simply isn't possible with a central routing system, which is why in spite of people periodically claiming they're easier I've always been against the concept. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Directorhttp://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] RE: Permission Denied??
On Mon, Dec 17, 2007 at 10:32:55AM -0800, Emily Heureux wrote: Never mind, it doesn't have to do with Catalyst. You also forgot to start a new threaad so nobody saw the original message anyway. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Directorhttp://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] retrieving multiple values from forms
On Monday 17 December 2007 03:01:53 pm Matt S Trout wrote: On Sat, Dec 15, 2007 at 01:10:52PM -0600, Andrew Rodland wrote: See the perldoc for Catalyst::Request -- the 'param' method comes in handy here. @values = $c-req-param('whatever'); No it doesn't. That method is there for CGI.pm compatibility. Don't use it in new code. It's also the only one that has a sensible semantic. Might be an unblessed scalar or an arrayref is silly for something that's naturally a _list_. If param wasn't there I would have to write a method that did the same thing, and use that. Andrew ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [OT] ASP.NET MVC
--- Matt S Trout [EMAIL PROTECTED] wrote: On Mon, Dec 17, 2007 at 07:31:21AM -0800, John Napiorkowski wrote: Yeah, the main configuration is definitely the right place to be maintain centralized routing and to more cleanly separate the URI namespace. Just that as you say, it's not clear to people when they first start probably because there isn't a lot of people saying that and the documentation and quick start guides don't seem to promote that idea. No, it's absolutely and horribly the wrong place - that's why nobody uses the feature even though it's supported. It basically turns your main mapping into a god object; why does the mapping info for the admin interface need to be related in any way shape or form to the mapping for the user interface, for example? Self-contained URI mapping info for controllers is essential to encapsulated code re-use. The one time I tend to use the main app config to supply such info is to rename a particular part of a site for a specific deployment - for e.g. if I have MyApp::Controller::Blog::base :Chained('/') :PathPart('blog') :CaptureArgs(0) I might do Controller Blog Action base PathPart news /Action /Controller to rename that URI segment to /news instead of /blog. If you give me a template to start with, either as an advent article or other I will definitely try to expand it out, as long as you don't me giving it the once or twice over. I was offering to provide an example of how to use base classes in ways that are entirely impossible with a crappy central routing system - the Reaction CRUD controller is a good example of this, it provides $base/ $base/create $base/id/*/view $base/id/*/edit $base/id/*/delete actions, where $base is the chain part leading up to 'sub base' So to bind that in you do package MyApp::Controller::Admin::Foo use base qw(Reaction::UI::Controller::CRUD); __PACKAGE__-config( actions = { base = { Chained = '/admin/base', PathPart = 'foo' } }, ... # model name etc. here ); and assuming you have MyApp::Controller::Admin::base :Chained('/') :PathPart('admin') :CaptureArgs(0) /admin/foo/ /admin/foo/create /admin/foo/id/*/view /admin/foo/id/*/edit /admin/foo/id/*/delete actions all immediately appear ready to go. This sort of thing simply isn't possible with a central routing system, which is why in spite of people periodically claiming they're easier I've always been against the concept. Hi, Thanks for clarifying your thoughts for me. I went and looked at the Reaction repo to get a better idea of what you are talking about. I may not have properly explained what I was thinking regarding mapping and configuration. However I found what you wrote to be very elucidating. I guess what you are saying is that it's not such a good idea to put all the URI mapping information, (such as controller namespace, action path or pathpart, etc) in your global configuration, since as you say it improperly couples things that are not related and it also prevents you from using base controller classes in the way you've describe. However I am sure you can understand that it's not obvious to many people to do their development this way, particularly without any examples (and with all the examples commonly tossed around not doing this at all). I still think a solid and well documented example will help here. We should choose something that would suck if it wasn't developed in Catalyst. I guess what I am shooting for is a clear and understandable reason why Catalyst's de-centralized routing can lead to more flexible and more robust designs, since as you say things more less tightly coupled, among other reasons. Having such an explanation would be very useful in articulating what's great about Catalyst and also offer guidance to beginners as to the best way to structure their projects. As I mentioned in an earlier post, this is a big point of confusion for all the new Catalyst developers I've run into. I know of at least two people that decided to just use :Default everywhere and stop trying to understand what to do. This system is a major plus for Catalyst, especially with the way it can play so well with Chaining (as the Reaction example you gave showed). To my eyes it makes Catalyst development beautiful and I'd like to make that more obvious to people when choosing a development framework. --John -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Director http://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive:
Re: [Catalyst] [OT] ASP.NET MVC
I'd love to *get* reaction, but last time I tried (admittedly a long time back) I had to scrape my brains off the ceiling ... (and I don't really have enough to go round for that kind of thing) ... ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Re: retrieving multiple values from forms
* Andrew Rodland [EMAIL PROTECTED] [2007-12-17 22:40]: On Monday 17 December 2007 03:01:53 pm Matt S Trout wrote: On Sat, Dec 15, 2007 at 01:10:52PM -0600, Andrew Rodland wrote: See the perldoc for Catalyst::Request -- the 'param' method comes in handy here. @values = $c-req-param('whatever'); No it doesn't. That method is there for CGI.pm compatibility. Don't use it in new code. It's also the only one that has a sensible semantic. Might be an unblessed scalar or an arrayref is silly for something that's naturally a _list_. If param wasn't there I would have to write a method that did the same thing, and use that. None of these interfaces is sane. The problem with CGI.pm’s interface is this: Foo-new( bar = $q-param( 'bar' ), baz = $q-param( 'baz' ), ); Now if someone sends you this query string: ?bar=1;baz=2;baz=is_admin;baz=1 the call evaluates to Foo-new( bar = 1, baz = 2, 'is_admin', 1, ); Woops. So CGI.pm forces you to pepper your code with `scalar`s to make it safe: Foo-new( bar = scalar $q-param( 'bar' ), baz = scalar $q-param( 'baz' ), ); Catalyst’s interface avoids that. However, Catalyst’s way of “either you get an arrayref or a scalar” isn’t sane either since it forces you to pepper your code just as much if not more, if you want it to react predictably regardless of how many arguments were passed. The *sane* thing is neither. The sane thing is to have *TWO* methods, one that *always* returns a scalar, and one that *always* returns a list. (Or rather, an arrayref, because if it’s just a list, it is easy to improperly treat it like a scalar, whereas if it’s an arrayref it’s impossible to forget to unpack the array when you meant to do that.) Then you can say what you mean, you can say it *easily* either way, and the result is always completely determined by what the code says and not at all by what the data looks like. Sanity. -- *AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1} Just-another-Perl-hack; #Aristotle Pagaltzis // http://plasmasturm.org/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: retrieving multiple values from forms
On Monday 17 December 2007 05:27:46 pm A. Pagaltzis wrote: The *sane* thing is neither. The sane thing is to have *TWO* methods, one that *always* returns a scalar, and one that *always* returns a list. (Or rather, an arrayref, because if it’s just a list, it is easy to improperly treat it like a scalar, whereas if it’s an arrayref it’s impossible to forget to unpack the array when you meant to do that.) Then you can say what you mean, you can say it *easily* either way, and the result is always completely determined by what the code says and not at all by what the data looks like. Sanity. Yeah, I can agree with this. I realized the same thing myself... after posting my original message of course. Teach me to wait a bit longer before hitting send in the future. Anyway yeah, what I really want is param_list or param_aref, without any of the actual CGI compat of param -- param just comes closer to my goal than params. Not sure what the ideal behavior for the only one version would be, but params is at least practical. If you see ARRAY(0xbadfad) where you expected useful data it's not that hard to trace back and see what you did wrong. Andrew ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [OT] ASP.NET MVC#
On Mon, Dec 17, 2007 at 08:39:29PM +, Zbigniew Lukasiak wrote: Yeah - some time ago I proposed to add an EndPoint attribute and get rid of the CaptureArgs one that is not very intuitive (and use Args in both cases). I don't remember seeing the code - if you update your patch to work against 5.80 trunk we can have a look ... -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical Directorhttp://www.shadowcat.co.uk/catalyst/ Shadowcat Systems Ltd. Want a managed development or deployment platform? http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/ ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Can't locate Catalyst/Plugin/Authentication/Store/DBIC.pm
PANIC!!! So, the gentoo overlay installation is altered like: dev-perl/Catalyst-Authentication-Store-DBIx-Class !dev-perl/Catalyst-Plugin-Authentication-Store-DBIx-Class !dev-perl/Catalyst-Plugin-Authentication-Store-DBIC Okay... no more 'Plugin' or 'DBIC' anymore, it seems. Then I did find this: http://cpan.uwinnipeg.ca/htdocs/Catalyst-Authentication-Store-DBIx-Class/Catalyst/Authentication/Store/DBIx/Class.html And, I try to change a couple of items in the configs, like so: authentication = { default_realm = 'members', realms = { members = { credential = { class = 'Password', password_field = 'password', password_type = 'clear' }, store = { class = 'DBIx::Class', user_class = 'MyAppDB::Users', id_field = 'user_id', role_relation = 'userroles', role_field = 'role_name', } ... to mimic what is in that doco. Caught exception in BanTrace::Controller::Login-index The user object Catalyst::Authentication::Store::DBIx::Class::User=HASH(0x9469e70) does not support any known password authentication mechanism.,, ...here: 35: if ($username $password) { 36: 37: # Attempt to log the user in 38: if ($c-login($username, $password)) { WTF My application is configured exactly like the tutorial... used to be written?? No. It still looks like: Authentication::Store::DBIC And that Plugin:: isn't part of the installation now... this _can't_ be okay, no? Alright, so this is the new 'login' method, 'authenticate'? 37: # Attempt to log the user in 38: # if ($c-login($username, $password)) { 39: if ($c-authenticate($username, $password)) { Caught exception in BanTrace::Controller::Login-index authenticate called with nonexistant realm: 'MYPASSWORD'? Ouch! Oh, with a hashref, now: # if ($c-login($username, $password)) { if ($c-authenticate({username = $username, password = $password})) So now I'm in... sort of. Other parts are broken... if ($c-check_user_roles('admin')) { ... didn't seem to fly. Now, I'm stuck. That method comes from, I think, ::DBIC ... what's the new way? Fortunately, in this app, if you are not 'admin' you must be a user... but I'd like to have my ROLE back!!! Any help really, really appreciated. '-) Cheers, -- |\ /|| | ~ ~ | \/ ||---| `|` ? ||ichael | |iggins\^ / michael.higgins[at]evolone[dot]org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Can't locate Catalyst/Plugin/Authentication/Store/DBIC.pm
On Mon, 17 Dec 2007 21:03:52 -0800 Michael Higgins [EMAIL PROTECTED] wrote: On Mon, 17 Dec 2007 20:09:23 -0800 Michael Higgins [EMAIL PROTECTED] wrote: On Mon, 17 Dec 2007 20:47:20 -0700 Jay K [EMAIL PROTECTED] wrote: Hi Michael, Unfortunately the Tutorial is a bit out of date. [8] Do I go about redefining my 'roles' as '1', '2', '3'?? Or do I have to change my database configuration? . . . [reply to self again] Okay, it appears as if the join table is no longer needed? (I don't know why it was needed before, but it's part of the tutorial, IIRC.) So, I have a table users and user_roles. First table is user information with a user_id. Second table is user_id and role_name. My role_id column and 'roles' table are probably both superfluous now? __PACKAGE__-belongs_to(user = 'MyAppDB::Users', 'user_id'); __PACKAGE__-has_many(map_user_roles = 'MyAppDB::UserRoles', 'user_id'); Is that _really_ all that's required? Anyway, I -- perhaps prematurely asserted -- think I've figured this out. Cheers, -- |\ /|| | ~ ~ | \/ ||---| `|` ? ||ichael | |iggins\^ / michael.higgins[at]evolone[dot]org ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/