Re: [Catalyst] Bug in uri_for()
Paul Makepeace scribbled on 7/13/06 7:44 AM: > Folks may already know about this, sorry I haven't checked RT etc: > > I've just upgraded from 5.66 to 5.70 and noticed a bug with uri_for - > it seems that if one of the final-arg hash ref parameters has a value > that is not something it's expecting it dies, for example, > > $c->uri_for($base, @args, { url => $c->req->base }); > # "Non-array reference (URI::http) passed to uri_for()" > > The $c->req->base is a URI::http. My solution was to force it to > stringify by appending a blank string (e.g. .'') > I don't think this is a bug. Had a similar problem this morning. I think the issue is how the URI::http object is overloaded. My solution was to do the same thing the overloading does: $c->uri_for( $c->req->base->as_string ) which is similar to what you're doing, but with the documented method rather than forcing the overload to occur. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] multiple row entry
Alan Humphrey scribbled on 8/22/06 11:37 AM: > > How to you handle the data entry of the tracks and artists? I’ve > thought about an “add” button that would open up a separate page for > each track, but that’s clunky. Is there a better way? Something Ajaxian? > I have a small JS lib built on Prototype that I am getting near to open sourcing. It does exactly this: spreadsheet-style editing of multiple rows of data. Let me know offlist if you'd like an alpha copy; I'd love to get some feedback on it. cheers, pek -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] patch: C::P::Compress::Deflate
Patch below allows Compress::Deflate plugin to play nicely with Static::Simple and to allow for skipping deflation based on browser. Specifically, we found issues with older versions of IE that claimed to deal with the deflate encoding but balked. I'm not sure if the way I detect presence of Static::Simple is the Right Way or not. Comments welcome. --- /usr/lib/perl5/site_perl/5.8.6/Catalyst/Plugin/Compress/Deflate.pm 2006-09-05 11:29:48.0 -0500 +++ Catalyst/Plugin/Compress/Deflate.pm 2006-09-19 10:15:16.0 -0500 @@ -2,6 +2,8 @@ use strict; +our $VERSION = '0.02'; + use Compress::Zlib (); sub finalize { @@ -29,6 +31,25 @@ return $c->NEXT::finalize; } +# skip if using Static::Simple +if ( $c->can('_serve_static') ) { +$c->log->debug("skipping Compress::Deflate due to Static::Simple") + if $c->debug; +return $c->NEXT::finalize; +} + +# skip if we have a particular browser type +if ($c->request->browser +and $c->request->browser->windows +and $c->request->browser->ie +and $c->request->browser->major() < +( $c->config->{compress}->{skip_ie} || 0 ) ) +{ +$c->log->debug("skipping Compress::Deflate due to skip_ie detection") + if $c->debug; +return $c->NEXT::finalize; +} + my ( $d, $out, $status, $deflated ); ( $d, $status ) = Compress::Zlib::deflateInit( @@ -80,6 +101,21 @@ Deflate compress response if client supports it. +=head1 CONFIGURATION + +The config key B can be used. If you need to skip deflation for IE +browsers, you can set the B key to the major version below which you +want to skip deflation. + +Example: + + __PACKAGE__->config( compress => { skip_ie => 6 } ) + +will skip deflation for all IE browsers below version 6. + +B The B feature requires the Catalyst::Plugin::Browser module. + + =head1 SEE ALSO L. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] patch: C::P::Compress::Deflate
Perrin Harkins scribbled on 9/19/06 10:34 AM: > Peter Karman wrote: >> Patch below allows Compress::Deflate plugin to play nicely with >> Static::Simple and to allow for skipping deflation based on browser. >> Specifically, we found issues with older versions of IE that claimed >> to deal with the deflate encoding but balked. > > Does this mean you are using Catalyst to serve static pages in > production? That's going to hurt your performance quite a bit. Static > pages are better left to your web server. For that matter, compressing > pages is also better left to your web server. > Thanks, Perrin. No, we don't use Catalyst to serve static pages in production. That's actually why I added the Static::Simple check. I like to be able to move code directly dev -> testing -> production with only changing config files. My problem was that Static::Simple messes with Deflate in devel (which is the only place I use S::S) for CSS and other files, since they have text/* mime types. I actually have a conditional in my base MyApp.pm file that checks if running under mod_perl and only loads S::S if not under mod_perl. I was doing the same thing with the Compress module (only loading if running under mod_perl) but I wanted to test deflation in dev under the dev server, and still use S::S. see http://article.gmane.org/gmane.comp.web.catalyst.general/2089/match=static+simple+compress I didn't see mention of any fix in the list archives, hence this patch. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] patch: C::P::Compress::Deflate
Perrin Harkins scribbled on 9/19/06 11:46 AM: > Since you use apache in production, have you considered using > mod_deflate for compression? It seems like a better solution than > something at the perl level. > I started to write a long response, then realized why I was having the whole compression/caching issue in the first place. I was caching compressed pages, which meant that browser headers were ignored, etc. doh! So now I need to implement mod_deflate. Since y'all have likely done this before, I'll ask here. We have a typical proxy frontend/mod_perl backend setup. Which server should handle the compression? Seems like maybe the backend could, since we are caching pages, but don't know if there are accepted best practices on this. Thanks. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] patch: C::P::Compress::Deflate
Peter Karman scribbled on 9/19/06 10:45 AM: see http://article.gmane.org/gmane.comp.web.catalyst.general/2089/match=static+simple+compress I didn't see mention of any fix in the list archives, hence this patch. To make some amends for my earlier bone-headedness, here's patches that actually address this particular issue. It adds a 'no_types' config option to exclude content types from compression that match 'text/' -- specifically CSS. It will skip text/css by default. I realize this doesn't address the question of best development practices, but it does fix the bug in the email thread above. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] --- /usr/lib/perl5/site_perl/5.8.6/Catalyst/Plugin/Compress/Deflate.pm 2006-09-05 11:29:48.0 -0500 +++ Catalyst/Plugin/Compress/Deflate.pm 2006-09-19 15:03:49.0 -0500 @@ -2,8 +2,19 @@ use strict; +our $VERSION = '0.02'; + use Compress::Zlib (); +sub setup +{ +my $c = shift; + +$c->NEXT::setup(@_); + +$c->config->{config}->{no_types} ||= [qw( text/css )]; +} + sub finalize { my $c = shift; @@ -23,6 +34,17 @@ return $c->NEXT::finalize; } +for my $type (@{$c->config->{compress}->{no_types}||[]}) +{ +if ($c->response->content_type eq $type) +{ +$c->log->debug("skipping Compress::Deflate due to match on type $type") +if $c->debug; + +return $c->NEXT::finalize; +} +} + my $accept = $c->request->header('Accept-Encoding') || ''; unless ( index( $accept, "deflate" ) >= 0 ) { @@ -80,6 +102,21 @@ Deflate compress response if client supports it. +=head1 CONFIGURATION + +The config key B stores all Compress Plugin options. + +=head2 Skip based on content type + +Not all B content types should be compressed. By default Compress::Deflate +will skip all B content types. You can configure more B types to skip +with the B option: + + __PACKAGE__->config( compress => { no_types => [qw( text/plain text/css )] } ); + +B If you must include B explicitly if you set the B option. +Otherwise it will be compressed. + =head1 SEE ALSO L. --- /usr/lib/perl5/site_perl/5.8.6/Catalyst/Plugin/Compress/Gzip.pm 2006-09-05 11:29:48.0 -0500 +++ Catalyst/Plugin/Compress/Gzip.pm2006-09-19 15:06:10.0 -0500 @@ -4,6 +4,16 @@ use Compress::Zlib (); +sub setup +{ +my $c = shift; + +$c->NEXT::setup(@_); + +$c->config->{config}->{no_types} ||= [qw( text/css )]; +} + + sub finalize { my $c = shift; @@ -23,6 +33,17 @@ return $c->NEXT::finalize; } +for my $type (@{$c->config->{compress}->{no_types}||[]}) +{ +if ($c->response->content_type eq $type) +{ +$c->log->debug("skipping Compress::Deflate due to match on type $type") +if $c->debug; + +return $c->NEXT::finalize; +} +} + my $accept = $c->request->header('Accept-Encoding') || ''; unless ( index( $accept, "gzip" ) >= 0 ) { @@ -54,6 +75,21 @@ Gzip compress response if client supports it. +=head1 CONFIGURATION + +The config key B stores all Compress Plugin options. + +=head2 Skip based on content type + +Not all B content types should be compressed. By default Compress::Deflate +will skip all B content types. You can configure more B types to skip +with the B option: + + __PACKAGE__->config( compress => { no_types => [qw( text/plain text/css )] } ); + +B If you must include B explicitly if you set the B option. +Otherwise it will be compressed. + =head1 SEE ALSO L. ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] patch: C::P::Compress::Deflate
Matt S Trout scribbled on 9/19/06 3:21 PM: > Actually, what I'd really like is somebody to volunteer to write a new > Catalyst::Plugin::Compress that handles all this crap once and allows > multiple compression backends to be used. Sadly, the ::Compress::* > plugins are owned by Sebastian Riedel so we have no way of getting > patches fed back and as such they shoul be considered entirely > unmaintained. > would it still be called C::P::Compress? Or would a new namespace be needed? -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Checking client browsers, best approach?
Ryan scribbled on 9/20/06 7:44 AM: > OK, here is what I need to do. I'm writing a reservation system for a > hotel and I have some cool features in mind for the process but they > require javascript and "newer" browsers. What I was planning on doing is > creating the bare-bones pages that work in any browser, no JS just all > server calls etc...then I want to go back and insert the new stuff where > it's appropriate but only for the people that can handle it. I was > thinking of having a landing page(default or something) that ran some > tests to see if that could fail. Then I thought it might be easier in the > begin function to just check browsers and set a variable in the stash if > they can handle the new stuff or not. What's the best way to go about > doing this, should I just scan the req variables that come in and make my > decision on that or does Catalyst have something better? I use C::Plugin::Browser and then check that in my templates for what fancy stuff to include. In TT: [% IF c.request.browser.windows && c.request.browser.ie %] # do something [% END %] I've also done similar to what you describe and set stash var in begin() method: if ($c->req->browser->windows && $c->req->browser.ie) { $c->stash->{ie_win_too_bad}++; } -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Plugin::Authentication::Store::LDAP settingsfor Microsoft Active Directory
Hermida, Leandro scribbled on 12/21/06 12:18 PM: Here are the errors shown in the Catalyst debug screen: Deep recursion on subroutine "Catalyst::Plugin::Authentication::Store::LDAP::User::stringify" at /usr/lib/perl5/site_perl/5.8.5/Catalyst/Plugin/Authentication/Store/LDAP /User.pm line 254. Deep recursion on subroutine "Catalyst::Plugin::Authentication::Store::LDAP::User::AUTOLOAD" at /usr/lib/perl5/site_perl/5.8.5/Catalyst/Plugin/Authentication/Store/LDAP /User.pm line 100. not sure if it's the same issue, but this might help: http://article.gmane.org/gmane.comp.web.catalyst.general/7523/match=ldap pek -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Plugin::Authentication::Store::LDAPsettingsfor Microsoft Active Directory
Hermida, Leandro scribbled on 12/22/06 10:11 AM: -Original Message- From: Peter Karman [mailto:[EMAIL PROTECTED] http://article.gmane.org/gmane.comp.web.catalyst.general/7523/ match=ldap It works! Thanks for this link! glad it helped. TLS or SSL don't seem to work when connecting to Active Directory so please do not set start_tls: 1 nor specify the ldap_server as a URI with ldaps://. If someone has managed to get this to work using Net::LDAP, I would really like to know. I had a similar issue (nearly a year ago now) with TLS/SSL and AD, and trying to get the (now deprecated) C::P::Auth::LDAP module working. I ended up just putting a simple CGI in front of the AD server under https as a web service. The CGI uses Net::LDAP across a LAN from the Linux/Apache CGi host to the AD server. It does the auth and returns a simple XML (or could be json or whatever) string indicating the auth status and roles/groups on success. Then I just cache the roles in the session. It was the easiest way to provide secure auth across the 'net using AD and Catalyst. Plus, now we use it outside of Catalyst since it's just a CGI. tmtowtdi, pek -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] HTML to plain text conversion
Xavier Robin scribbled on 1/8/07 11:14 AM: Do you know a (catalyst plugin|perl module|external tool) that converts HTML to plain text? I mean, keeping some formatting (especially lists and links...), not just stripping HTML tags... I use the w3m tool: % w3m -dump file.html > file.txt I like it because it preserves tables pretty well. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Recommend methods for form handling
Jim Spath scribbled on 1/17/07 12:09 PM: I was wondering what the current consensus among Catalyst users is about what the best way to approach forms is? I like Rose::HTML::Objects (specifically Rose::HTML::Form). Used along with Rose::DB::Object, my code is starting to get slimmer and slimmer. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Bread crumb
Jason Kohles scribbled on 2/6/07 8:33 AM: It still feels a little kludgy, but this is how I'm doing it currently... [...] fwiw, that is pretty close to how http://search.cpan.org/~tigris/Catalyst-Plugin-Breadcrumbs-5/lib/Catalyst/Plugin/Breadcrumbs.pm does it. I have been using a (modified) version of C::P::Breadcrumbs for a while and it works ok. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Performance
Robert 'phaylon' Sedlacek scribbled on 3/9/07 9:04 AM: Christopher H. Laco wrote: Sure, it they're that different. The goal still stands, don't use uri_for everywhere. Only use it when you really need it. Jep. But this is not getting easier if you start to have captures in your chains. I'm still having high hopes to build something fast(er) with URI::Template. http://search.cpan.org/~jsiracusa/Rose-URI-0.021/lib/Rose/URI.pm -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] PageCache and Apache
vti scribbled on 3/13/07 3:12 PM: Hi I have something strange happening while using PageCache plugin and Apache server. When plugin has cached a page the next request i get 550 error response, next time i refresh everything is ok, next time again 550. I have had this same error. It seems to happen especially with FireFox. My workaround was to explicitly set 'set_http_headers' to 0 in my page_cache config. That turns off the cache headers that tell your browser it's ok to cache the page locally, which means each request will get a fresh copy from the server. But since that fresh copy is cached on the server, it seemed a fair tradeoff to me if it solved the problem. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Rose::DB
Christian Storm scribbled on 3/19/07 6:15 PM: Is anyone working on a Rose::DB catalyst model plugin? I think you mean Rose::DB::Object, and yes, I have one I'd been considering contributing. If you're interested in collaborating, email me offlist. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Swish-e
Jim Spath scribbled on 3/22/07 2:44 PM: What about Xapian? I noticed that it has some Catalyst support in the form of Catalyst::Model::Xapian. Xapian also seems like a possible long term solution as it can handle more documents that Swish-e or KinoSeach. see also this recent thread: http://www.mail-archive.com/cgiapp@lists.erlbaum.net/msg06061.html -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Swish-e
Perrin Harkins scribbled on 3/22/07 2:52 PM: I noticed that it has some Catalyst support in the form of Catalyst::Model::Xapian. As long as a module has a decent perl API, you don't really need a Catalyst::Model class to use it. You should be able to use any of the ones you mentioned from Catalyst. In case you do end up wanting to try out Swish-e, I have uploaded my Swish-e Model class to CPAN. I have been using it in production for about 6 mos. It is modeled after the Catalyst::Model::Xapian API. http://search.cpan.org/~karman/Catalyst-Model-SWISH-0.01/ -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] HTML::FormFu and Rose::DB::Object?
Quinn Weaver scribbled on 4/3/07 12:40 PM: If so, will FormFu be compatible with Rose::DB::Object, or will it be tied to DBIC? (I know the Rose framework has its own way of handling forms, but I like FormFu better because of its clean separation of concerns.) Any words of wisdom from the FormFu masters? :) I'm no master, nor have I looked at FormFu. However, I'd suggest you look at the Catalyst::Controller::Rose stuff I posted to CPAN last week: http://search.cpan.org/~karman/Catalyst-Controller-Rose-0.01/ That has base Controllers for use with RDBO and RHTMLO, and I'd expect you might use it as a starting place for tying in FormFu instead of RHTMLO. See in particular: http://search.cpan.org/~karman/Catalyst-Controller-Rose-0.01/lib/Catalyst/Controller/Rose/CRUD.pm and the init_object() and init_form() methods. That said, what exactly is it about RHTMLO that strikes you as less than a "clear separation of concerns"? -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Can not start my apache with catalyst app under mod_perl
Paul Rudolf Seebacher scribbled on 4/3/07 3:57 PM: Hi, i want to run my catalyst application under mod_perl. So I made a Virtual Host: DocumentRoot /var/srv/sugo ServerName sugo.* PerlSwitches -I/var/srv/sugo/lib/ PerlModule sugo SetHandler modperl PerlResponseHandler sugo Put when I restart Apache, I get this error message in my error.log: [Tue Apr 03 22:51:01 2007] [error] Can't locate sugo.pm in @INC (@INC contains: /usr/lib/perl5/Apache2 /etc/perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl . /etc/apache2) at (eval 3) line 3.\n [Tue Apr 03 22:51:01 2007] [error] Can't load Perl module sugo for server sugo.seepaul.dyndns.org:0, exiting... How can I say Perl where to seek for this script? though the mod_perl docs claim that PerlSwitches can be inside a vhost, I had a similar experience the other day that was solved by putting that -I/path outside the vhost directive. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: HTML::FormFu and Rose::DB::Object?
Quinn Weaver scribbled on 4/4/07 1:12 AM: Bill Moseley wrote: On Tue, Apr 03, 2007 at 08:53:32PM -0700, Quinn Weaver wrote: In contrast to FormBuilder, RHTMLO wants you to write your HTML form by calling Perl methods, somewhat in the spirit of CGI.pm. This makes it hard for design people to edit the form. Maybe I'm not understanding that paragraph, but in RHTMLO (IIRC) you can do [% form.field('foo').xhtml %] in a template. What are you thinking would be easier for the design people? No, you're right. I didn't catch that possibility, though it's implicit in the documentation. Partly because the docs tell you the details of all the methods you can call, but not the big picture of what they're good for--in other words, they're etic, not emic. yes, the docs are often very exhaustive (exhausting) but sometimes lacking in more simple overviews. That's partly why I put together the CatRose example. Check out the example .tt files in the CatRose app in the C::C::Rose package, especially edit.tt and view.tt. You'll see that those are generic form templates, but in my apps I often override with specific form generation if it doesn't fit the generic model. Just like a real web designer would. ;) I find that defining the form in YAML is one level removed from the XHTML itself, so I just define a base RHTMLO class with default labels for all my fields, and then do whatever the business requirements demand in the actual .tt files. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] HOWTO reference config settings from template
Jeff Chimene scribbled on 4/12/07 9:29 AM: Hi, I'm not sure if this is a Catalyst question - How do I reference __PACKAGE__config settings from a Template Toolkit template? I'd like to use the config tool to set values outside the stash. [% c.config.yourconfigkeyhere %] -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: [EMAIL PROTECTED] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] HOWTO reference config settings from template
Jeff Chimene scribbled on 4/12/07 10:35 AM: and I don't see the TT2 configuration settings. When I try the similar experiment in the perl module, & dump __PACKAGE__->config, the TT2 configuration settings are displayed. that's because your TT config probably isn't getting set in the master config for your app, which is what c.config returns. Every M/V/C in Catalyst has a config() method (iirc -- please correct me, oh gurus), and the master MyApp class has a config() too, which is where you generally set values for the entire application. You can set your TT config there too. But looking at what you're trying to do, I wonder if what you really want is a TT type config file, which can set constants and other relevant TT stuff. CatRose has an example of how I do it: http://search.cpan.org/src/KARMAN/Catalyst-Controller-Rose-0.01/examples/CatRose/lib/CatRose/View/TT.pm cheers. pek -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: [EMAIL PROTECTED] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] little syntax
Will Smith scribbled on 4/12/07 11:43 AM: I have the following piece of code: # in controller ... while ( my $row = $file->read ) { push @record, { id => $row->{id}, name => $row->{name}, }; } $c->stash->{recs} = @records; . What is the syntax on the tt2 to access the id and name? Or please point me to somewhere that I could do some reading on the question. you want: $c->stash->{recs} = [EMAIL PROTECTED]; and then in tt: [% FOR rec IN recs; rec.id; rec.name; END %] -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: [EMAIL PROTECTED] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Handling slow uploads externally
Brian Kirkbride scribbled on 4/12/07 12:16 PM: Is there something like this in existence already? I searched Google and CPAN but didn't find anything promising. I'd appreciate any tips or suggestions. If I do implement it from scratch, would there be any interest in the CGI and a Catalyst base controller being released on CPAN? I'd be interested in collaborating on something if you end up rolling your own. We were looking at this recently: http://trac.lighttpd.net/trac/wiki/Docs%3AModUploadProgress and doing something similar to what you're describing. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: [EMAIL PROTECTED] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] MySQL server has gone away
Adeola Awoyemi scribbled on 4/19/07 7:54 AM: Hi all, I have problem that when I run my app via fastcgi I get an error where one of my models can't connect to the database with the message "MySQL server has gone away". When I start it using 'script/myapp_server.pl' it works fine. Has anyone come across this before? Any hints to fixing this would be greatly appreciated. http://perl.apache.org/docs/1.0/guide/databases.html#The_Morning_Bug I often experienced it with the Session::Store::DBI plugin; I think the latest version fixes that. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] [ANNOUNCE] Rose::* modules on CPAN
Cattle-lusters, As mentioned here in passing last month, I have uploaded some base components to CPAN for use with Rose::HTML::Objects, Rose::DB::Object and Catalyst. * http://search.cpan.org/dist/Catalyst-Model-RDBO/ (latest: 0.03) A Model base class for integrating RDBO with Catalyst. Mostly a thin convenience wrapper around Rose::DB::Object and Rose::DB::Object::Manager. * http://search.cpan.org/dist/Catalyst-Controller-Rose/ (latest: 0.02) A collection of Controller base classes for easing CRUD-style application development with RHTMLO and RDBO. Included with the C::C::R controllers is an entire example Catalyst app called CatRose. It's in the t/examples/ directory. It includes templates, in-place-editing with Javascript, and some other goodies. Comments/patches/tests welcome. cheers, pek -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] [ANNOUNCE] Rose::* modules on CPAN
Jeff Chimene scribbled on 4/23/07 1:06 PM: I've installed the Catalyst-Controller-Rose 0.02 and the examples stayed in the CPAN working directory. Is this the intended behavior? yup. They're just examples. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] many Views that may include common display fragments
Steve H scribbled on 4/25/07 8:43 AM: Please let me know if I'm missing something fundamental here... but at face value, I couldn't see any intrinsic capability for that sort of thing... much needed in enterprise (size/complexity) applications... to avoid going the WebSphere/Portal route. The app I'm working on is a CRM one... with various dashboard status, hot-list and other fragments that need displaying on many different pages. that sounds just like TT, which IIRC, you were avoiding because it seemed "less contemporary" ;) -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] How to make MyApp::B a part of MyApp::A ?
Oleg Pronin scribbled on 5/2/07 5:30 AM: Greetings! I want to make MyApp::B a part of MyApp::A under namespace for example /folder/ Both B and A are normal catalyst applications. (both do '__PACKAGE__->setup()' and etc. and therefore cannot work together). How to do this with minimal changes to application A (for example, using B as plugin) and any complex changes to application B ? I do not want to do this using apache features (setting MyApp::B's handler to location /folder/). I want this: if MyApp::A loads MyApp::B as plugin then all of functionalities of B goes under A/folder/. this sounds like a straightforward subclassing arrangement -- unless I'm missing something crucial? MyBaseClass.pm: package MyBaseClass; # all the stuff currently in MyApp::B here 1; MyApp/A.pm: package MyApp::A; use base qw( MyBaseClass ); 1; MyApp/B.pm: package MyApp::B; use base qw( MyBaseClass ); 1; then override and extend MyApp::A and MyApp::B for whatever application-specific reasons you have. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Shoot out -- Catalyst / RoR / Other MVC apps --
Christopher H. Laco scribbled on 5/9/07 7:56 AM: The best approach for me has been what mst has said before. Make your core stuff usable outside of the work of Catalyst. Seems like a no brainer, but when you're just learning Cat and following examples, it's easy to forget. yes, it took me a year of fulltime Catalyst to arrive at this same place. I there was probably decent documentation and mailing list advice out there that could have pointed me in that direction from the start, although my experience with Perl in general is that I (can) do things my own way for awhile until I figure out on my own what more experienced folks already know: * search CPAN thoroughly before rolling your own * subclass subclass subclass * a couple levels of indirection can increase re-usability immensely * etc. [snip] The main theme being...the models are just DB thingies...they're completely usable outside core classes (domains/business logic, etc)... The Catalyst::Model:RDBO model uses this approach. It's just a thin layer around a single RDBO class (which represents one table). Just a shim to get your extra-Catalyst classes available within the Catalyst Model feature. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Shoot out -- Catalyst / RoR / Other MVC apps --
Dave Rolsky scribbled on 5/9/07 8:57 AM: On Wed, 9 May 2007, Peter Karman wrote: * subclass subclass subclass I meant that as in 'pound this into my own brain' rather than 'always do this'. As in, 'remember that if an existing module does 90% of what you want, it is probably better to subclass and extend/override than re-invent the whole wheel.' unless of course it isn't. ;) My experience tells me that lots of subclassing is a bad smell. Delegation is often simpler and less fraught with possibility for name conflicts. What do you mean by delegation? Perl's inheritance mechanism is particularly egregious, of course. SUPER is broken, and without private methods or attributes of any sort, it's really easy to step on your parent's internals and break things. * a couple levels of indirection can increase re-usability immensely "All problems in computer science can be solved by another level of indirection" (Butler Lampson) ... except the problem of having too many levels of indirection. exactly. which is why I said 'a couple.' ;) Everything in Moderation. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Shoot out -- Catalyst / RoR / Other MVC apps --
Dave Rolsky scribbled on 5/9/07 10:02 AM: [snip] That's the subclassing piece. The delegation is that rather than implement the functionality of breadcrumbs in the response object, the breadcrumbs accessor simply returns a VegGuide::Breadcrumbs object. ah. that makes sense. Now I have a name for something I already do. :) On a side note, Catalyst plugins as a rule seem to jam _way_ too many methods into the things they extend (the session plugin is truly egregious). Some day I'd like to write a version of the session plugin that adds one method to the core Catalyst object, session(), and all the rest of the methods would be available via the object returned from session(). Yes, the Catalyst::Plugin::Cache system could work much the same way. There seem to be a lot of syntatically sweet methods in some plugins that just wrap around the core method. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Form validation in insert() and update()?
mla scribbled on 05/15/07 13:42: Perrin Harkins wrote: And where do you handle the validation? Only in the controller or in both the model and controller? Could you give a short example of taking an actual field from the request parameters, validating it, and updating a row with it? You can see an example of this with Rose::DB::Object, Rose::HTML::Objects and the db (sqlite in this case) at: http://search.cpan.org/src/KARMAN/Catalyst-Controller-Rose-0.02/t/examples/CatRose/ Basically, the form object validates and spits back friendly errors messages to the user. If for some reason the data makes it to the ORM (RDBO) level, the data is also validated there and 500 error returned to the user. Finally, the db itself has contraints on it that should validate in consistent ways with the form and the ORM. This pattern seems to be similar to what mst, Perrin and Bill are also describing. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst with apache, how to auto restart like run myapp_server.pl -r?
Cookie scribbled on 5/21/07 8:21 PM: Is there any way to configurate my apache configuration files to be available that I don't need to restart my apache server?(Like I run myapp_server.pl -r) no. all the -r option does for the dev server is automatically poll for file changes and restart the app. It's not a config option; it's a feature of the server. Apache has no such feature. My Second question is: When I visit my web site,the link in http://loalhost/catalyst becomes http://localhost/item,but the real link is http://localhost/catalyst/item. How can I solve this bug? My template like this: [% item %] [% item %] That second is a FAQ. Make sure you read the Catalyst advent calendars at: http://www.catalystframework.org/calendar/2005/ http://www.catalystframework.org/calendar/2006/ -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] ActiveRecord for Perl
Christopher H. Laco wrote on 5/22/07 2:47 PM: Well, to be fair to RDBO, I'm just not as familiar with it as I am with DBIC. When I was doing the storage layer for RDBO, what I missed (aside from deploy) was the *_related methods and the fact that resultsets are chainable. DBIC appears to take the approach that given object A, I can always get to related object B through object A accessors, helpers, *_related etc. RDBO seemed to tale take the opposite approach. Instead of working from one object to another, you went through *Manager classes when odd things are called for. Actually, RDBO works like you describe DBIC. The *Manager classes are for groups of objects. For one object to another, you use the fk and relationship Metadata definitions (1-1, 1-m, m-m, etc). $objectB = $objectA->objectB; -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst and CGI::Ajax
Petri Ruutikainen wrote on 5/23/07 3:59 PM: Hi! Is there anyhow possible to include CGI::Ajax to Catalyst using Template Toolkit (TTSite)? I know that using Prototype one can get Ajax functionality to Catalyst but I have been unable to initiate that. Or is there some more detailed tutorial about the matter (Ajax or Prototype used with Catalyst) besides the Catalyst tutorial and/or Cookbook? A big thanks to anybody who will be answering and setting me to the right (or left) track. IME using Ajax without any kind of Catalyst plugin or explicit view is pretty painless. Just include the relevant libraries in the .tt files, write the javascript to use them in your .tt files, and then write controller code to handle the requests. The pitfalls I have stumbled into have been more with the javascript itself rather than anything particularly Catalystic. Understanding the relationship between your js and your Cat code (the request and response cycle) is important when it comes time to debug, and using the wrappers can (IME) actually impede the learning because there's simply too much magic going on. See the example app here for how I do it with Prototype and Scriptaculous: http://search.cpan.org/src/KARMAN/Catalyst-Controller-Rose-0.02/t/examples/CatRose/ And yes Dojo/Mocha/YUI/lib-de-jour lovers, I know Prototype isn't cool anymore. ;) -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Link to file
Will Smith wrote on 5/24/07 10:43 AM: the error is : File Not Found. Yes, I have apache, and also tried on dev machine at localhost. Problem is when adding the file path to template, like: listen, and myvar = '/var/www/html/myfolder/myfile.wav'; when move the cursor over "listen" the link is : http://localhost:3000/var/www/html/myfolder/myfile.wav or http://www.mydomain.com/var/www/html/myfolder/myfile.wav Obviously, this is the wrong path to the file. How can I drop the http://... before the real path? Thank you Your browser is assuming the http:// scheme since href value is relative. If you want to serve via local fs, then you probably want file:// instead. if you want to serve the .wav via http, you need the http:// scheme on there, and you'll want to come up with a structure for serving static content that doesn't use your Cat app directly. The way I do it is to have all my static content served under a separate apache vhost, and then in my Cat code, set that static url base in my config. So my .tt files look like: thing The Static::Simple plugin lets you serve static content from Cat itself, but that's intended for devel only since tying up Cat time with static content is considered Not a Best Practice. So I just avoid it altogether and run a separate apache process on my dev box that serves my static content for me. That way moving from dev to production is as simple as changing the config definition for [% page.static %]. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] template toolkit caching
John Goulah wrote on 5/31/07 11:34 AM: Is there any way to override the file cache in the template toolkit, and use some other form of caching such as memcache? File cache really isn't that desirable when shared across many servers and I'd prefer not to have to write to disk. I believe Template::Plugin::Cache will do what you want. Perrin (the author) has a patch from me that lets you pass in the Cache object from Catalyst and use that, so any supported backend is available. If you bug him, I'll bet he'll get a new version up on CPAN. ;) -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] deploying a Catalyst app
On 06/01/07 15:00, mla wrote: I've always used cvs/svn for the app. Tagged it for staging/prod and pulled the changes to the appropriate servers. svn++ -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Auth plugin for mod_auth_tkt
Charlie Garrison wrote on 6/6/07 4:15 PM: Good morning, I am about to create a plugin to use mod_auth_tkt for authentication, but just wanted to check that no one else has done one before I start. And I'm still on my Catalyst learning curve, so if there are any HOWTOs or tutorials on writing authentication plugins, I would love to know about them. In case anyone wants to know why I'm using mod_auth_tkt, I'm porting an old app to Catalyst. And the app has apache frontend process (mod_perl backend) which needs to protect static content. If you have other suggestions for protecting static content in frontend apache that works well with Catalyst, I'm happy to look at alternatives to mod_auth_tkt. Thanks, Charlie PS. Is there any interest from others for this plugin? I will be happy to share if there is. I also use mod_auth_tkt. I submitted a patch to the author several weeks ago that makes it easier to get at the internal cookie values via Apache::AuthTkt. You might want to post to that list and nudge him to release a new version to CPAN. It'll probably make your plugin much easier to write. Are you planning this plugin to work with the existing Session::* stuff? -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] RFC for handling reverse proxies not deployed to standard ports.
Marlon Bailey wrote on 6/15/07 11:24 AM: I suggest adding the ability for Catalyst to set the host's port from a "X-Forwarded-Host-Port" header value. What do you guys think? I like. I have kludgy workarounds for this in my code that it be nice to see part of the core app. See also http://article.gmane.org/gmane.comp.web.catalyst.general/6703/match=moseley+port+http+backend -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] ANNOUNCE: new Catalyst::Controller::Rose and Catalyst::Model::RDBO on CPAN
I just uploaded Catalyst::Controller::Rose 0.04 and Catalyst::Model::RDBO to CPAN. They should hit your local mirror eventually. These modules provide glue between Rose::DB::Object, Rose::HTML::Objects and Catalyst. The changes include improved error handling and some internal refactoring. From the Changes files: Catalyst::Controller::Rose 0.04 * changed check_err() to has_errors() * moved has_errors() to base Rose class * added throw_error() to base Rose class * all controllers now inherit from Catalyst::Controller::Rose instead of simply Catalyst::Controller. * instead of setting 'error' value in stash(), CRUD methods now call throw_error(). Catalyst::Model::RDBO 0.05 * refactor fetch() and add new create() method. * fetch_all() and all() were doing exactly what search() does, so just aliased them to search(). * use Catalyst::Exception instead of Carp and added throw_error() method to allow for easy overriding. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Re: [RHTMLO] RDBO/RHTMLO integration with Catalyst - work in progress
check out Catalyst::Controller::Rose on cpan. It has a different philosophy than what you've described. But if you find features missing that you think would make it more useful, please send me patches/tests/docs etc. You might consider writing a new Catalyst::Controller::Rose::SomeThing to implement what you're describing with YAML. Alexandre Jousset wrote on 7/21/07 7:56 AM: Hello lists, Since I haven't seen any work like this before (if I'm wrong please give me pointers!) I started to write a Catalyst Controller called "Catalyst::Controller::RHTMLO" to integrate RHTMLO (and a few bits of RDBO) to Catalyst the same way "Catalyst::Controller::FormBuilder" do. In fact my work is originally based on it. For the moment the only thing one can do with it is to define a form in YAML (or any config file recognized by "Config::Loader") and have it displayed in the template (TT2 for the moment, but others are planned). The module also defines, like the FormBuilder one, a 'Form' method attribute. The plan is to have forms automagically validated and, if no errors, give the user (developper) the ability to save them as objects in the db. Else, the error messages are set for user convenience. Here is an example of a YAML file for the action "/user/create", located in .../root/forms/user/create.yaml: name: UserCreateForm # optional, automatically computed method: post rdbo: User # class of the rdbo object, used to load/save objects and also for field init (see below, types are sometimes missing, but it works) fields_order: - login - disp_name - mail - disp_mail - home_page - pass - pass2 - submit fields: login: label:Login validate: /^.{4\,40}$/, /^\w*$/ message: Between 4 and 40 characters, Only alphanumeric characters required: 1 disp_name: label:Real name (public) validate: /^.{0\,50}$/, /^[\w\.-\(\)]*$/ message: Max 50 characters, Forbidden character(s) mail: label:Real Email type: email message: Invalid Email required: 1 disp_mail: label:Displayed Email (public) validate: /^.{0\,80}$/ message: Max 80 characters home_page: label:URL validate: /^.{0\,100}$/ message: Invalid URL pass: label:Password type: password validate: /^.{4\,40}$/ required: 1 message: Between 4 and 40 characters pass2: label:Password confirmation type: password validate: /^.{4\,40}$/ message: Between 4 and 40 characters required: 1 submit: type: submit I haven't packaged it yet and I think it is too early (despite the "release early, release often" moto) so I can't upload it to CPAN but I have some question to ask to you all: - Is the name I gave a good name? I don't think so. I think it should mention the fact that it also concerns RDBO. - Are you interested in a module like this? I'm pretty sure somebody is ;-) I'm the first ;-) - What are your requests / suggestions about a module like this? Feel free to ask questions if my explanation wasn't enough. - Should I keep the validation system like this, or should I create validation classes (better IMHO)? For the moment the error messages are localized in the template with a macro. Thank you for your attention. Regards, -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: [RHTMLO] RDBO/RHTMLO integration with Catalyst - work in progress
Alexandre Jousset wrote on 7/21/07 1:12 PM: Peter Karman a écrit : check out Catalyst::Controller::Rose on cpan. It has a different philosophy than what you've described. But if you find features missing that you think would make it more useful, please send me patches/tests/docs etc. You might consider writing a new Catalyst::Controller::Rose::SomeThing to implement what you're describing with YAML. I've had seen your modules but I did not check them enough to understand what they do exactly. Now I did... I'm still studying them to be sure what is the right thing to do... But any advice is welcome... C::C::Rose takes the "thin controller/fat model" approach. Look at the example app in the t/examples dir to see one implementation. I prefer to follow the RHTMLO convention of a Perl class for each form, rather than YAML magic, etc. So C::C::Rose basically is a thin glue between a Rose::HTML::Form subclass and a Rose::DB::Object subclass (via Catalyst::Model::RDBO, which is also thin glue). My approach has been to write just enough code to get RHTMLO and RDBO working in a Catalyst context, in a generic CRUD fashion. The idea is that my RHTMLO and RDBO subclasses can exist happily on their own, or pulled into Catalyst with the thin glue of the C::C::Rose and C::M::RDBO base classes. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: [RHTMLO] RDBO/RHTMLO integration with Catalyst - work in progress
Matt S Trout wrote on 7/22/07 12:48 PM: On Sat, Jul 21, 2007 at 08:02:24AM -0500, Peter Karman wrote: check out Catalyst::Controller::Rose on cpan. It has a different philosophy than what you've described. But if you find features missing that you think would make it more useful, please send me patches/tests/docs etc. You might consider writing a new Catalyst::Controller::Rose::SomeThing to implement what you're describing with YAML. Do you have any plans to split the dependencies a bit on this? I hadn't any plans, but since you've raised the issue, I'd be happy to discuss it. I've always been quite fond of RHTMLO and have been on a couple projects now where we considered Controller::Rose and had to pass on it because it assumed you wanted RDBO as well. C::C::Rose assumes that you are going to override methods in your subclasses, so it should be able to work with just about any model, I would think. All that is required is that the model class returned by model_name() implement the same methods as C::M::RDBO. C::M::RDBO is intentionally agnostic w.r.t. method names. I.e., it doesn't use the same method names as RDBO or RDBO::Manager. So a model needs to implement: * create() - make an object (i.e. MyObject->new()) * fetch()- load an object's data * search() - return an arrayref of objects * count()- return a count of matches * iterator() - return an iterator instead of arrayref of objects fetch_all() and all() are just aliased to search() right now. C::C::Rose::CRUD just needs fetch() and create() to work, and for the returned object to implement a save() and delete() method. Even save() is optional -- just override save_obj() and make the object do whatever you want. C::C::Rose::Search is a little trickier since rose_query() and setup() assume RDBO::QueryBuilder is the target SQL generator. But again, those can be overridden to adapt to whatever your model's search() method can accept. So if (for example) you wanted to use DBIC with C::C::Rose, you'd need a model that implements the methods above. But grok C::M::RDBO -- with the execption of fetch(), there's really not much going on in there. I wouldn't think it would be hard to write a DBIC-compatible model than implements the C::M::RDBO API. How do you imagine C::C::R::CRUD and ::Search could play friendlier with other models? Catalyst stuff should really be as non-opinionated as possible - people might want to use RDBO with a different form library too, and it'd be nice for the glue to elegantly support that case as well. Hm. Catalyst stuff should be non-opinionated, but I don't see how one Controller can be all things to all users. C::C::Rose assumes RHTMLO but can be flexible with the Model. And you can use C::M::RDBO with any kind of controllers you want. But if folks wanted to use a different form library with C::M::RDBO, and their form library doesn't have an API remotely close to RHTMLO's, then they should probably be using a different package. We don't ask Catalyst::Controller::FormBuilder to support RHTMLO do we? ;) -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Problems forwarding to view
Adeola Awoyemi wrote on 8/2/07 6:12 AM: Hi all, I'm trying to use Catayst::View::XSLT and my end sub looks like this: # from MyApp::Controller::Root sub end : Private { my ( $c, $self ) = @_; $c->forward( $c->view('XSLT') ); } my ($self, $c) = @_; you got 'em reversed. -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst + RHTMLO
On 9/4/07 5:16 AM, Matt S Trout wrote: On Tue, Sep 04, 2007 at 11:31:57AM +0200, Tobias Kremer wrote: Is anybody here using Catalyst + RHTMLO, especially Rose::HTML::Form, to handle forms? If yes, I'd like to know what your glue code (init forms from db, re-fill from $c->req->params etc.) looks like because RHTMLO has a somewhat different approach to handling things and I have the feeling that I'm doing things overly complicated. Other than that, I really like the way RHTMLO works and would love to see something like a Catalyst::Controller::RHTMLO module which works similar to the other form controllers out there. The existing C::C::Rose module is tied to RDBO and thus of no use for me because I very much prefer DBIC. The ::Rose author seemed perfectly willing to make it work with DBIC, but since he doesn't use DBIC he doesn't know what you'd need (just like I couldn't write it due to not using RHTMLO :). Maybe if you try and outline what you'd like from an API POV something could be done? Matt's correct. I'd be happy to make C::C::Rose::* controllers play nicely with non-RDBO models. I just need someone familiar with DBIC (or others) to help define an API. I outlined the existing requirements here: http://thread.gmane.org/gmane.comp.web.catalyst.general/14116/focus=14133 -- Peter Karman . [EMAIL PROTECTED] . http://www.peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Controller::Rose::Simple
Alexandre Jousset wrote on 9/20/07 11:41 AM: Hello Matt, Matt S Trout wrote: Feel free to ask me any question you want. Why haven't you submitted patches to the existing C-C-Rose? Any module called '-Simple' usually means "there was an existing module that worked but I'm too lazy to patch it" - please justify why that isn't the case here :) Well, I wasn't meaning that kind of question but hey, I said "any question you want" ;-)... Seriously, this is of course a good question, so here is my answer. I'm sure I haven't your experience but for me (and also for Peter Karman, C::C::Rose author), the suffix "::Simple" (suggested by him) means "Take all that [what already exists, i.e. Catalyst and Rose] and make it simpler to use together". Alexandre, Actually, I had suggested you use ::Simple because in your original email to me, (a) you had indicated you intended to use C::C::Rose, but with an API similar to the FormBuilder philosophy, and (b) you had a working title of C::C::Rose::FormManager, which I thought would be misleading, since all the existing C::C::Rose::* classes also manage forms. As you indicate below, you don't use any of the C::C::Rose code, design or philosophy, so sharing the namespace seems misleading at the very least. So I'd prefer it if you used a difference namespace altogether. I believe the latest best practice recommendation is to use the CatalystX top-level space. Perhaps something like CatalystX::RHTMLOManager or similar. In fact I don't even use its modules in mine since the goals are not the same and the functionalities don't overlap. The key point is that you can see it as the C::C::FormBuilder module reimplemented for Rose (and that was really the case). At first, on Peter's advice, I looked at C::C::Rose::* but I did not found anything relevant for what I was trying to do. I'd like to encourage you in your efforts at making the Rose projects easier to use with Catalyst. Since you've got a different approach to what "easy" means than I do, starting with a namespace that clearly delineates your project from mine seems to be in your best interest. pek -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Controller::Rose::Simple
On 09/21/2007 01:29 AM, Alexandre Jousset wrote: > > My only concern is that a search on CPAN with "Catalyst" and "Rose" > should make it show up. I believe that search.cpan.org will search the content of all POD, so if you have 'catalyst' and 'rose' in your POD anywhere, you'd get hits. Try searching for 'brown fox' to see what I mean. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] Catalyst::Model::Search
I see Catalyst::Model::Search on CPAN now. As the maintainer of Catalyst::Model::SWISH, I'd love to get in on that namespace action. Is Catalyst::Model::Search intentionally undocumented? Are there plans for a formal API to which subclasses of Catalyst::Model::Search must adhere? signed, a search junkie -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] CatalystX::CRUD
I've been thinking the last couple days about ways to expand Catalyst::Controller::Rose to play more nicely with other models besides C::M::RDBO. This is per mst's request to open up the RHTMLO goodness to non-RDBO users, and because I now find myself wanting the same thing. I have a model that isn't RDBO that I'd like to use in a project. So I'm proposing the following -- comments/criticism welcome. * CatalystX::CRUD::Model (CXCM) A base class for CRUD-like models. CXCM isa Catalyst::Model. Any CXCM subclass could be used with the C::C::Rose classes (or any other controller that decided to adhere to the CXCM API). C::M::RDBO would become a CXCM subclass. CXCM subclasses would need to implement at least the following methods: * new_object - returns CatalystX::CRUD::Object->new() * fetch - returns CatalystX::CRUD::Object->new()->read() * search - returns zero or more CXCO instances as an arrayref * interator - like search() but returns an iterator * count - like search() but returns an integer (For those following along at home, you'll notice that's basically the C::M::RDBO API.) * CatalystX::CRUD::Object (CXCO) A base class for objects returned by CatalystX::CRUD::Model subclasses. In the case of RDBO, this would just be a thin wrapper class that 'hasa' RDBO object. So e.g. calling create() or update() on a CatalystX::CRUD::Object::RDBO object would just look something like: sub create { my $self = shift; # CXCO object $self->rdbo->save(@_); } # same thing for update() CXCO subclasses would need to implement at least the following methods: * create- write a new object to store * read - load a new object from store * update- save an existing object to store * delete- remove an existing object from store (How original! CRUD!) You'll notice that the required CXCO methods are intentionally few. I assume that subclasses would want to also provide accessors to any underlying objects so that controllers could act directly on them (e.g., the rdbo() method in the above create example). I imagine that there could then be classes like: CatalystX::CRUD::Model::DBIC CatalystX::CRUD::Object::DBIC CatalystX::CRUD::Model::CDBI CatalystX::CRUD::Object::CDBI etc., that would all play nicely with C::C::Rose. Thoughts? -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Model::Search
On 09/21/2007 09:39 AM, Jonathan Rockway wrote: > Peter Karman wrote: >> I see Catalyst::Model::Search on CPAN now. As the maintainer of >> Catalyst::Model::SWISH, I'd love to get in on that namespace action. Is >> Catalyst::Model::Search intentionally undocumented? Are there plans for a >> formal API to which subclasses of Catalyst::Model::Search must adhere? >> > > People can upload whatever they want to CPAN for any reason with any > name :) Please mail the maintainer directly and collaborate with him. > If there's something seriously wrong with the module (no docs for an > important namespace like "Search" is a good reason), please let the core > team know on the dev list, and we'll do what we can to make sure the > users of the module have the best experience possible. The C::M::Search package is under Marcus Ramberg's acct, though the author listed in the POD is Andy Grundman. Since both those gentlemen are core devs, I figured this list was as good as any, especially since the resulting conversation might be of interest to all Catalyst users. But I'll write to them directly as you suggest. > > Collaboration is the key. Modules that one guy uploads to the CPAN on a > whim are rarely useful. amen. That's why I asked. :) > > Finally, what do you envision for the ::Search namespace? A common > interface to various search mechanisms? > Exactly. My original question, though, was more along the lines of "what do the *maintainers* envision for the namespace." 'Search' is (as you point out) an important namespace, and the idea of a uniform API for writing models seems like a Good Idea. The lack of documentation was what piqued me. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] New auth stuff and LDAP store...
On 07/21/2007 10:02 PM, Jay K wrote: > For the benefit of the list: > > This issue has been resolved. It turned out to be a disagreement > between what C::P::Authenticaiton was trying to place in $user->store > () and what LDAP was trying to place in $user->store() > > LDAP was correct, and C::P::Authentication should keep it's grubby > little hands off of $user->store() - I am pushing a maintenance > release of C::P::Authentication to CPAN now. Should be available > from CPAN in a few hours. > I am now trying to use ::Store::LDAP 0.04 with ::Authentication 0.10002 and I cannot seem to get the config right. I just asked about this on #catalyst and was advised to use the older pre-0.1 base Authentication plugin. I have a feeling I'm just not getting the config right. But if it is is more systemic than that, and the LDAP plugins need some help getting up to the latest Authentication API, I have tuits to spend on it and would gladly contribute code/tests/docs if I was told those were needed, and given a pointer to where to start. TIA -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] CatalystX::CRUD
On 09/23/2007 11:24 AM, Matt S Trout wrote: > On Fri, Sep 21, 2007 at 08:57:35AM -0500, Peter Karman wrote: >> CXCM subclasses would need to implement at least the following methods: >> >> * new_object - returns CatalystX::CRUD::Object->new() >> * fetch - returns CatalystX::CRUD::Object->new()->read() >> * search - returns zero or more CXCO instances as an arrayref >> * interator - like search() but returns an iterator >> * count - like search() but returns an integer > > Have you looked at the way the Handel storage stuff works? That already > supports both DBIC and RDBO so might be an interesting start. > I have looked through it (I had to figure out that Handel-Storage-RDBO is packaged separately...) and it looks like the base Storage API is much more complex and full-featured than what I am suggesting. But all the methods I mention are there in one or another. I'll probably dig in to the DBIC implementation when/if I need help with that part of CXCM (/me hoping not write that all by myself...). > Do you have any thoughts on how to paper over DBIC's ability to chain searches > vs. the lack of that feature in RDBO? I know most RDBO users don't feel > they're deprived not having it but DBIC users are generally fairly addicted :) > I've read about that feature difference in the mail archives, but since I haven't used DBIC myself, other than to just play for about an hour, I'm not sure what the equivalent RDBO code would look like. I do all kinds of multiple relationships in my RDBO code, where I chain together method calls to get at related data. Is the difference that RDBO might be making multiple db calls, whereas DBIC doesn't? For example, in your reply to Perrin you used this example: > This sort of thing in DBIC just becomes > $posts_rs = $users_rs->search_related('posts'); In RDBO, if I wanted all the posts for a given user, I might just say: $posts = $user->posts; So how is that different? Because $users_rs might represent multiple users? If so, yes RDBO would require something a little longer, like: map { push @posts, $_->posts } @$users; Which, depending on if I pre-fetched the posts when creating $users, might end up being lots more trips to the db. And it doesn't give me $posts_iterator, which might be preferable to @posts. But I think for the purposes of this CatalystX::CRUD proposal, the harder issues are going to be abstracting the conversion of $c->params() to what gets passed to search(), iterator(), count(), etc. Right now that is all very RDBO-specific in CCR::Search. Couldn't the whole DBIC search_related issue just be resolved by pushing the issue out into the controller and/or view space? In your CCR::Search subclass: my $results = $c->model('My::CatX::CRUD::Model::DBIC') ->search(@params)->search_related('foo'); -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Controller::Rose::Simple => CatalystX::RoseIntegrator
On 09/23/2007 10:36 AM, Alexandre Jousset wrote: > Hello list, > > Following the preceding discussion, I scheduled > Catalyst::Controller::Rose::Simple for deletion on CPAN and uploaded the > same module under the name CatalystX::RoseIntegrator. Please wait the > time required for it to show up. Thank you. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst::Model::Search
On 09/23/2007 11:28 AM, Marcus Ramberg wrote: > Catalyst::Model::Search is a quite old module which have been living > in Catalyst trunk for quite a while. It's being used by MojoMojo, and > it just happened to work, so I pushed it to CPAN so that MojoMojo > could depend on it. If anyone want to clean it up or document the > Search base class, patches are more than welcome. > See attached. I'd like to also suggest that C::M::Search, C::M::Search::Results and C::M::Search::Item be de-coupled from all the Lucene and Plucene classes that are currently bundled with them. That way someone could install C::M::Search and get all they need to implement a new subclass, without also needing to satisfy all the Plucene dependencies. cheers, pek -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ --- Search.pm.orig 2007-09-24 10:33:51.534326000 -0500 +++ Search.pm 2007-09-24 10:56:49.088527000 -0500 @@ -4,69 +4,151 @@ use NEXT; use base qw/Catalyst::Base/; -our $VERSION = '0.01'; +our $VERSION = '0.02'; -sub new { +sub new { my ( $self, $c ) = @_; - -return $self->NEXT::new( $c ); +$self->init($c); +return $self->NEXT::new($c); } sub init { my $self = shift; - +my $c= shift; + Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement init()' -); +message => ( ref $self || $self ) . ' does not implement init()' ); } sub add { my $self = shift; - +my $data = shift; + Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement add()' -); +message => ( ref $self || $self ) . ' does not implement add()' ); } sub update { my $self = shift; - +my $data = shift; + Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement update()' -); +message => ( ref $self || $self ) . ' does not implement update()' ); } sub remove { my $self = shift; - +my $data = shift; + Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement remove()' -); +message => ( ref $self || $self ) . ' does not implement remove()' ); } sub query { -my $self = shift; - +my $self = shift; +my $query = shift; + Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement query()' -); +message => ( ref $self || $self ) . ' does not implement query()' ); } sub is_indexed { my $self = shift; - -Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement is_indexed()' -); +my $key = shift; + +Catalyst::Exception->throw( message => ( ref $self || $self ) +. ' does not implement is_indexed()' ); } sub optimize { my $self = shift; - -Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement optimize()' -); + +Catalyst::Exception->throw( message => ( ref $self || $self ) +. ' does not implement optimize()' ); } 1; __END__ + + +=head1 NAME + +Catalyst::Model::Search - base class for Catalyst search models + +=head1 SYNOPSIS + + package Catalyst::Model::MySearchApp; + use base qw(Catalyst::Model::Search); + + # must implement all the following methods + sub init {} + sub add{} + sub update {} + sub remove {} + sub query {} + sub is_indexed {} + sub optimize {} + +=head1 DESCRIPTION + +Catalyst::Model::Search is a base class for providing full-text search +to a Catalyst application. The premise is that existing search projects +can be integrated with Catalyst's Model framework using a common API, allowing +you to swap in Xapian or KinoSearch or Plucene or Swish-e or +I without needing to change any Controller or View code. + +=head1 METHODS + +The following methods are implemented. Those methods +that must be overridden in your subclass are marked as such. + +=head2 new + +The basic boilerplate new() required by Catalyst::Model subclasses. +The init() method is called by new(). + +=head2 init + +Setup your search indexes or any other initialization required. +B + +=head2 add( I ) + +Add I to an index. + +=head2 update( I ) + +Update I in an index. + +=head2 remove( I ) + +Remove I from an index. + +=head2 query ( I ) + +Search an index for I. In scalar context should return +a Catalyst::Model::Search::Results object. In array context should +return the value of a Results object's get_items() method. + +=head2 is_indexed( I ) + +Test the index for the presence of a record identified by I +Returns true if the record is in the index. +
Re: [Catalyst] Catalyst::Model::Search
On 09/24/2007 11:02 AM, Peter Karman wrote: > > On 09/23/2007 11:28 AM, Marcus Ramberg wrote: >> Catalyst::Model::Search is a quite old module which have been living >> in Catalyst trunk for quite a while. It's being used by MojoMojo, and >> it just happened to work, so I pushed it to CPAN so that MojoMojo >> could depend on it. If anyone want to clean it up or document the >> Search base class, patches are more than welcome. >> > > See attached. > oops. Forgot to include the 'required' boilerplate. new version attached. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ --- Search.pm.orig 2007-09-24 10:33:51.534326000 -0500 +++ Search.pm 2007-09-24 11:16:11.646096000 -0500 @@ -4,69 +4,157 @@ use NEXT; use base qw/Catalyst::Base/; -our $VERSION = '0.01'; +our $VERSION = '0.02'; -sub new { +sub new { my ( $self, $c ) = @_; - -return $self->NEXT::new( $c ); +$self->init($c); +return $self->NEXT::new($c); } sub init { my $self = shift; - +my $c= shift; + Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement init()' -); +message => ( ref $self || $self ) . ' does not implement init()' ); } sub add { my $self = shift; - +my $data = shift; + Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement add()' -); +message => ( ref $self || $self ) . ' does not implement add()' ); } sub update { my $self = shift; - +my $data = shift; + Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement update()' -); +message => ( ref $self || $self ) . ' does not implement update()' ); } sub remove { my $self = shift; - +my $data = shift; + Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement remove()' -); +message => ( ref $self || $self ) . ' does not implement remove()' ); } sub query { -my $self = shift; - +my $self = shift; +my $query = shift; + Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement query()' -); +message => ( ref $self || $self ) . ' does not implement query()' ); } sub is_indexed { my $self = shift; - -Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement is_indexed()' -); +my $key = shift; + +Catalyst::Exception->throw( message => ( ref $self || $self ) +. ' does not implement is_indexed()' ); } sub optimize { my $self = shift; - -Catalyst::Exception->throw( -message => ( ref $self || $self ) . ' does not implement optimize()' -); + +Catalyst::Exception->throw( message => ( ref $self || $self ) +. ' does not implement optimize()' ); } 1; __END__ + + +=head1 NAME + +Catalyst::Model::Search - base class for Catalyst search models + +=head1 SYNOPSIS + + package Catalyst::Model::MySearchApp; + use base qw(Catalyst::Model::Search); + + # must implement all the following methods + sub init {} + sub add{} + sub update {} + sub remove {} + sub query {} + sub is_indexed {} + sub optimize {} + +=head1 DESCRIPTION + +Catalyst::Model::Search is a base class for providing full-text search +to a Catalyst application. The premise is that existing search projects +can be integrated with Catalyst's Model framework using a common API, allowing +you to swap in Xapian or KinoSearch or Plucene or Swish-e or +I without needing to change any Controller or View code. + +=head1 METHODS + +The following methods are implemented. Those methods +that must be overridden in your subclass are marked as such. + +=head2 new + +The basic boilerplate new() required by Catalyst::Model subclasses. +The init() method is called by new(). + +=head2 init + +Setup your search indexes or any other initialization required. +B + +=head2 add( I ) + +Add I to an index. +B + +=head2 update( I ) + +Update I in an index. +B + +=head2 remove( I ) + +Remove I from an index. +B + +=head2 query ( I ) + +Search an index for I. In scalar context should return +a Catalyst::Model::Search::Results object. In array context should +return the value of a Results object's get_items() method. +B + +=head2 is_indexed( I ) + +Test the index for the presence of a record identified by I +Returns true if the record is in the index. +B + +=head2 optimize + +Perform optimizing magic on the index. +B + +=head1 AUTHOR + +Andy Grundman, <[EMAIL PROTECTED]> +Marcus Ramberg, <[EMAIL P
RE: [Catalyst] New auth stuff and LDAP store...
On 09/24/2007 09:55 AM, Alan Humphrey wrote: > Here's what's working for me: > > > authentication: >default_realm: users >realms: > users: > credential: > class: 'Password' > password_type: 'self_check' > > store: > class: LDAP::Backend > ldap_server: 'ldap://localhost:389' > user_basedn: 'dc=birdwebdev,dc=dnsalias,dc=org' > binddn: 'cn=admin,dc=birdwebdev,dc=dnsalias,dc=org' > bindpw: 'x' > > > Note in particular the store class name. > > FWIW, I'm using OpenLDAP. > Thanks. That works. I'm using OpenLDAP too. However, I'm concerned about a few things. (1) the LDAP documentation is wrong. (2) in grokking the Authentication.pm code, I see that the LDAP modules are still working by virtue of a lot of code labeled 'BACKWARDS COMPATABILITY' and 'old-style' and warnings about the interface eventually disappearing. These include get_user() instead of the newer find_user() et al. As I have the time (and who knows how long that will last...), I'd still like to bring the LDAP plugins up to speed. I'll hack on it a bit today and see where I get. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] New auth stuff and LDAP store...
On 09/24/2007 11:55 AM, Peter Karman wrote: > As I have the time (and who knows how long that will last...), I'd still like > to bring the LDAP plugins up to speed. I'll hack on it a bit today and see > where I get. > These patches seem to bring the LDAP plugins up the latest Authentication API, to support realms, etc. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ --- /home/msi/pek/perl/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/Authentication/Store/LDAP/Backend.pm 2006-03-21 17:31:19.0 -0600 +++ lib/Catalyst/Plugin/Authentication/Store/LDAP/Backend.pm 2007-09-24 12:19:06.36691 -0500 @@ -75,6 +75,8 @@ use strict; use warnings; +our $VERSION = '0.02'; + use Catalyst::Plugin::Authentication::Store::LDAP::User; use Net::LDAP; @@ -115,10 +117,24 @@ return $self; } +=head2 find_user($id) + +Creates a L object +for the given User ID. This is the preferred deprecated mechanism for getting a +given User out of the Store. + +=cut + +sub find_user { +my ( $self, $authinfo, $c ) = @_; +return $self->get_user( $authinfo->{id} || $authinfo->{username} ); +} + + =head2 get_user($id) Creates a L object -for the given User ID. This is the preferred mechanism for getting a +for the given User ID. This is the old deprecated mechanism for getting a given User out of the Store. =cut --- /home/msi/pek/perl/lib/perl5/site_perl/5.8.8/Catalyst/Plugin/Authentication/Store/LDAP.pm 2006-03-21 17:31:39.0 -0600 +++ lib/Catalyst/Plugin/Authentication/Store/LDAP.pm 2007-09-24 12:09:49.138025000 -0500 @@ -5,28 +5,14 @@ use strict; use warnings; -our $VERSION = '0.04'; +our $VERSION = '0.05'; use Catalyst::Plugin::Authentication::Store::LDAP::Backend; -sub setup { -my $c = shift; - -if (exists($c->config->{'authentication'})) { -unless (exists($c->config->{'authentication'}->{'ldap'})) { -Catalyst::Exception->throw("I require \$c->config->{'authentication'}->{'ldap'} to be configured."); -} -} else { -Catalyst::Exception->throw("I require \$c->config->{'authentication'}->{'ldap'} to be configured."); -} - -$c->default_auth_store( -Catalyst::Plugin::Authentication::Store::LDAP::Backend->new( -$c->config->{'authentication'}->{'ldap'} -) -); - - $c->NEXT::setup(@_); +sub new { +my ( $class, $config, $app ) = @_; +return Catalyst::Plugin::Authentication::Store::LDAP::Backend->new( +$config); } __PACKAGE__; @@ -84,7 +70,10 @@ sub login : Global { my ( $self, $c ) = @_; -$c->login( $c->req->param("login"), $c->req->param("password"), ); +$c->authenticate({ +id => $c->req->param("login"), +password=> $c->req->param("password") + }); $c->res->body("Welcome " . $c->user->username . "!"); } @@ -122,29 +111,37 @@ # Config for Store::LDAP authentication: -ldap: -ldap_server: ldap.yourcompany.com -ldap_server_options: -timeout: 30 -binddn: anonymous -bindpw: dontcarehow -start_tls: 1 -start_tls_options: -verify: none -user_basedn: ou=people,dc=yourcompany,dc=com -user_filter: (&(objectClass=posixAccount)(uid=%s)) -user_scope: one -user_field: uid -user_search_options: -deref: always -use_roles: 1 -role_basedn: ou=groups,ou=OxObjects,dc=yourcompany,dc=com -role_filter: (&(objectClass=posixGroup)(memberUid=%s)) -role_scope: one -role_field: uid -role_value: dn -role_search_options: -deref: always +default_realm: ldap +realms: +ldap: +credential: +class: Password +password_field: password +password_type: self_check +store: +class: LDAP +ldap_server: ldap.yourcompany.com +ldap_server_options: +timeout: 30 +binddn: anonymous +bindpw: dontcarehow +start_tls: 1 +start_tls_options: +verify: none +user_basedn: ou=people,dc=yourcompany,dc=com +user_filter: (&(objectClass=posixAccount)(uid=%s)) +user_sco
Re: [Catalyst] New auth stuff and LDAP store...
On 09/24/2007 12:22 PM, Peter Karman wrote: > > On 09/24/2007 11:55 AM, Peter Karman wrote: > >> As I have the time (and who knows how long that will last...), I'd still like >> to bring the LDAP plugins up to speed. I'll hack on it a bit today and see >> where I get. >> > > These patches seem to bring the LDAP plugins up the latest Authentication API, > to support realms, etc. heh. that should be 'preferred' not 'preferred deprecated'. :/ +=head2 find_user($id) + +Creates a L object +for the given User ID. This is the preferred deprecated mechanism for getting a +given User out of the Store. -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Re: Announce: CatalystX::Controller::reCAPTCHA
Kieren Diment wrote on 9/24/07 7:17 PM: Thanks to mst clarifying what the CatalystX namespace is for [snip] I, for one, would benefit from that clarification. Matt, can you fill me [us] in? -- Peter Karman . http://peknet.com/ . [EMAIL PROTECTED] ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] CMS
On 08/24/2007 10:41 AM, Matt Rosin wrote: > 2b. This reduces templates to a list of assets (snippets) called by > name interspersed with HTML tags and TT directives. Text snippets > would reside in a database and could be edited in a CMS, at least like > the utility of 1a/b above. Image pathnames or a single DIV's HTML > could also all be stored in the db. The template would just pull the > snippets out with a simple $c method like loc in the above I18N > modules. A standard facility for editing these things (a module and TT > templates) would also be useful. > I'm working on such an app right now, except that snippets are kept in SVN instead of a database. The idea is to allow .tt files to be edited via web UI, storing metadata in each .tt file in a special reserved hash. Still deciding on which JS UI toolkit to use. Leaning toward TinyMCE. Hardest part (right now) is figuring out how to provide real-time re-use of other .tt files (via PROCESS) within the .tt file being edited. So a user could (e.g.) pick a snippet from a dropdown list and insert it, and then see the rendered text immediately. But on save, only the [% PROCESS foo %] gets written. Oh, and images. :) -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] get the path to the home
On 09/28/2007 07:30 AM, Octavian Rasnita wrote: > Hi, > > I have a I18N module in my Catalyst application and I want to get the > path to the home directory of the application. Is it possible to get it > without hard codding it in that module? > $c->path_to() -- Peter Karman . [EMAIL PROTECTED] . http://peknet.com/ ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/ Dev site: http://dev.catalyst.perl.org/