[Catalyst] (Beginner) Plugins
Hi, I know this has been discussed before (I rememeber a therad about this) but this URL does not work with Frefox 1.0.7 in Linux (I can't type anything in the search box): http://www.mail-archive.com/catalyst@lists.rawmode.org/ So I am forced to ask this: I want to work with Image::Magick with Catalyst and I wondering if I need to build a plugin or can I just use the Image::Magick module as-is. What are the advantages, disadvantages or limitations I will find if I just use the CPAN module as-is? If the answer is that I _have_ to build a module, is there a simple how-to I can follow? Thanks beforehand and I hope to be asking more interesting questions in the future. Alejandro Imass ___ 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] (Beginner) Plugins
Wow, that was a prompt reply! I saw many of your plugins on CPAN! I just want to manipulate some images on the backend before I send them to the page. From just one base image I want to generate images of several sizes, and do some fancy stuff like making a degradation to black on the right side of an image (probably by layering a black degradation on top with ImageMagick). In any case, it's just some server-side image processing before I use them on the page. The cache will be handled by me, I mean each processed image will have a special name (extending the base image's name) and will reside in the orignal's image directory. I will be responsible for checking time-stamps and all that (in case the original image changed I will re-generate with the first request). Any ideas welcome, and thanks again for your help. On 10/23/06, Yuval Kogman <[EMAIL PROTECTED]> wrote: On Mon, Oct 23, 2006 at 21:01:08 -0400, Alejandro Imass wrote:> I want to work with Image::Magick with Catalyst and I wondering if I need to> build a plugin or can I just use the Image::Magick module as-is. What are > the advantages, disadvantages or limitations I will find if I just use the> CPAN module as-is?What are you trying to achieve?90% chance the answer you're looking for is to use it as-is. If you need to e.g. cache thumbnails, Catalyst::Plugin::Cache shouldhelp. Aside from that i don't see any reason why image manipulationsof any sort would need catalyst app specific info/config.-- Yuval Kogman < [EMAIL PROTECTED]>http://nothingmuch.woobling.org 0xEBD27418___ List: Catalyst@lists.rawmode.orgListinfo: http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: http://dev.catalyst.perl.org/ ___ 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] (Beginner) Plugins
Thanks for your ideas... The issue is that the client specified that images be kept proportional no matter the size of the browser, so if I resize the browser I have to regenerate the image so it keeps in proportion with the new window size. One would think this could be easily done just by changing the size with _javascript_ but: a) Browser resizing distorts the images b) The anchor for our images is the lower right hand corner and we have to crop the top-left. This is because images can be of many different proportions and the final layout has a fixed proportion. c) The client wants the images to degrade to black on the right edge. Obviously this requires server-side processing. I agree with you on dynamically generating the images. In fact, I was thinking of using AJAX with the Dojo plugin. Now, regarding my original question on the use of plugins or not. Can you tell me, like for dummies, what are the advantages or disadvantages of using a Catalyst plugin or using the CPAN modules with a simple use. For example, if I decide to dynamically generate the images would I need or have any advantages or problems to make a plugin for Image::Magick? Thanks again, Alejandro. On 10/24/06, Yuval Kogman <[EMAIL PROTECTED]> wrote: On Mon, Oct 23, 2006 at 21:35:03 -0400, Alejandro Imass wrote:> Wow, that was a prompt reply! I saw many of your plugins on CPAN!>> I just want to manipulate some images on the backend before I send them to > the page. From just one base image I want to generate images of several> sizes, and do some fancy stuff like making a degradation to black on the> right side of an image (probably by layering a black degradation on top with > ImageMagick). In any case, it's just some server-side image processing> before I use them on the page. The cache will be handled by me, I mean each> processed image will have a special name (extending the base image's name) > and will reside in the orignal's image directory. I will be responsible for> checking time-stamps and all that (in case the original image changed I will> re-generate with the first request). The only problem I see is with transformed images being cached, andthen the client rerequesting the image without going to the pagethat generates the image.If this is a problem then you should make the transformed images dynamically generated, but I doubt this matters at all.I would make sure to do something likefoo/images/bah.jpg # originalfoo/transformed/bah.jpgand notfoo/images/bah.jpg foo/images/bah.transformed.jpgsince it's easier to delete the transformed images this way.Good luck =)-- Yuval Kogman <[EMAIL PROTECTED] >http://nothingmuch.woobling.org 0xEBD27418___List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: http://dev.catalyst.perl.org/ ___ 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] (Beginner) Plugins
On 10/24/06, Yuval Kogman <[EMAIL PROTECTED]> wrote: Ouch, what an insane client...I hope you're charging them $$$ ;-) Not really. But they gave me the opportunity to use whatever I wanted so it was perfect for my first Catalyst project. You now must think that it is I who is insane! Use ImageMagic/Imager/GD or whatever to dump out a scalar, and thenput that in $c->response->body, and set the content type appropriately, in something like Yes, I was thinking along these lines. I had done something similar with MapServer several years ago, but used random number image files. sub images : Local {my ( $self, $c, $image ) = @_; [...] # make sure to set the caching control headers, like# expires, cache-control, last-modified, etc} Thanks for the example! and make sure that $scaled can behave nicely with Storable. Ok.The reason I suggest doing this and not adjacent files is that thekey space cardinality ( image * width * height ) is very big. If you only need width that's better, i guess, but there's still apotential to easily have several hundred versions of a single image. Yeah well. In either case I have to generate the image, so unless, the images are re-used it makes no sense to store them on disk. If the image name had the dimentions I could check if that particular image was already generated, but it looks like too much trouble. I think I will use AJAX to request the generation of the image. Besides, all this trouble is _only_ for the main page news image and a few other places. The site itself is actually quite simple. When I finish this site I will make the code available so you can shoot at it :-D Using one of the Cache modules on the CPAN you can constrain thecache to say 200MB and still get decent performance. I hope this helpsThere are two more categories of plugins - ones that act on the webspecific data structures (e.g. C::P::Browser, C::P::Session), and [...] controller just using caching services, and the configurationproviding all the know-how for choosing the right cache, etc. It doesn't sound like any of these scenarios coincide with yours. Thanks! -- Yuval Kogman <[EMAIL PROTECTED] >http://nothingmuch.woobling.org 0xEBD27418___List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: http://dev.catalyst.perl.org/ ___ 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] (Beginner) Plugins
On 10/24/06, Jonathan Rockway <[EMAIL PROTECTED]> wrote: You can do all of this with CSS (other than pick the algorithm thebrowser uses to resize the image). Look at the CSS for HTML Slidy tosee how this is done:http://www.w3.org/Talks/Tools/Slidy/ Cool. Thanks for this lead! The fade to black is a bit less obvious, but all you need to do isoverlay a PNG with an alpha channel. MS IE does not support transparency on PNGs and GIF would mess up the fade badly. This is basically why I opted for server-side processing in order to overlay the shadow using ImageMagik. But perhaps, if I can handle the resizing all in the client, I could generate the faded images only once in the server when the images are first uploaded. nothingmuch mentions that you might end up with a lot of images, andthis is certainly true. However, if you constrain the aspect ratio, you won't have nearly as many files. Yes, true. If you don't want to constrain the aspect ratio, then you can still bespace efficient (or at least use a constant amount of space for an infinite number of sizes). There's an algorithm (whose name I can'trecall right now) that can generate good-looking images quickly if youcache images of size (p,q), (p/2,q/2), (p/4, q/4), etc. (for each aspect ratio you desire, of course).I'll let you know if I find a reference online. I was planning onimplementing a catalyst model or controller for storing cached imagesanyway, but haven't gotten around to it yet. Ok, anything that you can think of helps! For now, I will stick to the resizing strictly on the client (CSS, JS, etc.) and generate the faded image only once on the server. Since the proprtion is fixed, I can generate a larger proprotional and already cropped image that will scale well with client side coding. I have a time constraint so I think I will go down this path. Again, any ideas are very welcome. As I said to Yuval, when we finish we will release the code to the Catalyst community for evaluation/learning if anyone would be interested. Thanks, Alejandro Regards,Jonathan Rockway--package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do { $,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;___List: Catalyst@lists.rawmode.orgListinfo: http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: http://dev.catalyst.perl.org/ ___ 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] (Beginner) Plugins
Yes, sorry, I was lazy in my answer. I meant that this whole thing seemed too much trouble. It seems that by setting the proportion fixed (fixing the w/h ratio) I can generate the image only once on the server and the resize with CSS and JS. Thanks for pointing this out though. On 10/24/06, Jonathan Rockway <[EMAIL PROTECTED]> wrote: > If the image name had the dimensions I could check if that particular> image was already generated, but it looks like too much trouble.That's what this code does:my $key = join(":", $width, $height, $image ); my $scaled = $cache->get($key);unless ( defined $scaled ) { ... $scaled = scale_the_image() ... }If the image was in cache, the unless(){} block is skipped, and thecached version is stored. If the image wasn't in cache, it's scaled and then stored in the cache. The $c->cache handles expiration, eliminationof duplicate entries, etc.Regards,Jonathan Rockway--package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do { $,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;___List: Catalyst@lists.rawmode.orgListinfo: http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: http://dev.catalyst.perl.org/ ___ 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] (Beginner) Plugins
Thank you very much! I haven't used Windoze for a long time so I wasn't even aware of the fact until I tried to demo my first take on this site to the client, you can imagine the disaster!On 10/24/06, Nilson Santos Figueiredo Junior <[EMAIL PROTECTED]> wrote: On 10/24/06, Alejandro Imass <[EMAIL PROTECTED] > wrote:> MS IE does not support transparency on PNGs and GIF would mess up the fade> badly.Actually IE does support PNG transparency. You just need to coerce itinto supporting it. ;-) Google for "IE PNG Transparency" and the first results should be useful.-Nilson Santos F. Jr.___List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalystSearchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/Dev site: http://dev.catalyst.perl.org/ ___ 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] Newbie needs help with tutorial
The error says near the require. He may be missing a simple ; or he may not even have DBIx::Class On 11/3/06, John Napiorkowski <[EMAIL PROTECTED]> wrote: --- [EMAIL PROTECTED] wrote: > I'm also returning to Perl programming after > (joyfully) finding an > MVC that's based on a language I've already learned. > > However, in going through the tutorial, I know I've > screwed up > something, somewhere. When I try to run the server, > here's what I get: > > $ script/myapp_server.pl > Couldn't instantiate component > "MyApp::Model::MyAppDB", "Cannot load > schema class 'MyAppDB': syntax error at (eval 99) > line 1, near > "require DBIx::Class:" > ...propagated at > /opt/local/lib/perl5/5.8.8/base.pm line 85. > BEGIN failed--compilation aborted at > /Volumes/SHARED/Projects/ > Learning/Catalyst/MyApp/script/../lib/MyAppDB.pm > line 10. > Compilation failed in require at > /opt/local/lib/perl5/site_perl/5.8.8/ > Catalyst/Model/DBIC/Schema.pm line 272. > at script/myapp_server.pl line 53" at > script/myapp_server.pl line 53 > Compilation failed in require at > script/myapp_server.pl line 53. > > > The part that confuses me is "syntax error at (eval > 99) line 1". > What's "(eval 99)" mean? And if anyone has a clue > on what's wrong > (or even just what files to look at and for what), > I'd be grateful. You'll find that a lot of dispatched methods in Catalyst are wrapped in an eval so that it can catch errors for you. 'eval 99' is referring to spot in the evaled code. I've found that it can be a bit hard to debug what's going wrong when the DBIx schema classes have errors. Try checking that all the required modules are loaded and so forth. Use 'perl -c ...' to to a sanity check on the syntax. Try paring down the components you are loading to see if you can ID the missing or troubled part. Start with the DBIx schemas you created, looks like that is the core of the issue. --john > > Thanks, > > Conan. > > > > On Nov 1, 2006, at 3:36 PM, JT Justman - > [EMAIL PROTECTED] wrote: > > > Richard Wolfe wrote: > >> Hello all- > >> > >> I've been writing (bad) Perl/CGI scripts for > years, but am just now > >> trying to get my head around Catalyst (and MVC in > general). I > >> managed to > >> get Catalyst installed on my little Linux box > here, and I'm busily > >> working my way through > Catalyst::Manual::Tutorial. > >> > >> In working my way through Part 2 (Catalyst > Basics) of the tutorial, I > >> create my new Catalyst project and start up the > server and can > >> browse to > >> it no problem. But after I step through all the > other tasks on this > >> portion of the tutorial (create a database, > MyAppDB.pm, the "result > >> source" files, the controller, etc.) the server > throws an error > >> when I > >> try to start it: > >> > >> [EMAIL PROTECTED] MyApp]$ script/myapp_server.pl > >> Couldn't instantiate component > "MyApp::Model::MyAppDB", "Cannot load > >> schema class 'MyAppDB': Recursive inheritance > detected while > >> looking for > >> method 'can' in package > 'DBIx::Class::Componentised' at > >> > /usr/lib/perl5/site_perl/5.8.8/DBIx/Class/Componentised.pm > line 76. > >> Compilation failed in require at > >> > /usr/lib/perl5/site_perl/5.8.8/Catalyst/Model/DBIC/Schema.pm > line > >> 272. > >> at script/myapp_server.pl line 53" at > script/myapp_server.pl line 53 > >> Compilation failed in require at > script/myapp_server.pl line 53. > >> > > > > Well, it sort of looks to my untrained eye like > some component of your > > schema is loading either the main Schema class or > something else. > > > > In your MyAppDB.pm file, what do you have in > load_classes? If it's > > blank, IIRC it will automatically load all the > modules in the MyAppDB > > directory. Perhaps you have something in there you > didn't mean to > > have, > > such as a copy of MyAppDB.pm? Look carefully at > each of those classes, > > and try disabling them one at a time. > > > > It may help to check out a copy of the finished > app from svn to have > > something to compare to. > > > > JT > > > > ___ > > 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/ > > ___ > 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/ > Get your email and see which of your friends are online - Right on the New Yahoo.com (http://www.yahoo.com/preview) ___ List: Catalyst@lists.rawmode.org Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail
[Catalyst] How to use HTML::Widget::Constraint::Date
Hi, I was wondering if someone would kindly show me an example on how to use this. I searched the list archives and could not find any references to this. Say I have two date fields from a form how do I create the constraints? I tried this: $w->constraint(Date => qw/ fecha_nacimiento fecha_muerte/) ->message('Formato -MM-DD'); But it obviously does not work becaus the doc says this: HTML::Widget::Constraint::Date my $c = $widget->constraint( 'Date', 'year', 'month', 'day' ); There are no examples with dates in the tutorial nor the HTML::Widget docs, and the above left me a bit confused :-] Thanks beforehand, Alejandro Imass ___ 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] Where did the tutorials go?
perldoc Catalyst::Manual::Tutorial perldoc Catalyst::Manual::Tutorial::Intro perldoc Catalyst::Manual::Tutorial::CatalystBasics and so forth... all names are exact without spaces except for Introduction that is abreviated to Intro as shown above On 11/9/06, Kieren Diment <[EMAIL PROTECTED]> wrote: http://search.cpan.org/search?m=module&q=catalyst%3A%3Amanual%3A%3Atutorial On 09/11/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I finally got through the problems I was having with the MyApp > tutorial, but now it seems to be missing from CPAN. > > Anyone know what happened to them and where they are? > > > Thanks, > > Conan. > > ___ > 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/ > ___ 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/ ___ 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] HTML::Widget and Unicode
Hi, HTML::Widget is translating my UTF-8 characters into presumably ISO LATIN-1. Can I stop HTML::Widget from doing this? I looked into enctype but I don't think is for that, and if it is could someone kindly offer an example? if so (supposing that enctyle is the answer) what happens to filenames that use Unicode characters in an upload field? Thanks, Alejandro Imass ___ 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 use HTML::Widget::Constraint::Date
Thanks! But how do I use this constraint if I have several date fields in my form? Suppose I have two dates which would mean 6 fields on the form (per your explanation above). Do I just pass all 6 in order to the constraint? or am I missing the point entirely? On 11/26/06, Michele Beltrame <[EMAIL PROTECTED]> wrote: Hello! > my $c = $widget->constraint( 'Date', 'year', 'month', 'day' ); > This constraint requirtes you to have three fields: one with day, one with month, one with years. This a common thing, as in many cases there are three select boxes which allow the user to select a date. Others (including me) use a single text field maybe with some help such as JSCalendar. In this case you might be better off defining a filter which creates a DateTime and then work with that. This is also handy if you need to store the data in a database, as you can define an inflater for DateTime objects. Michele. -- Michele Beltrame http://www.varlogarthas.net/ ICQ# 76660101 Informativa privacy: http://www.italpro.net/em.html ___ 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/ ___ 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::Widget and Unicode
On 11/26/06, Carl Franks <[EMAIL PROTECTED]> wrote: On 26/11/06, Alejandro Imass <[EMAIL PROTECTED]> wrote: > Hi, > > HTML::Widget is translating my UTF-8 characters into presumably ISO > LATIN-1. Can I stop HTML::Widget from doing this? I looked into > enctype but I don't think is for that, and if it is could someone > kindly offer an example? if so (supposing that enctyle is the answer) > what happens to filenames that use Unicode characters in an upload > field? Can you give an example of what's actually happening and when? If you're talking about the output of $result->as_xml, the characters are being HTML-encoded. yes Upgrade to the latest cpan release of HTML::Element to fix it. Yes. That was it. I upgraded to HTML-Tree-3.23 and it fixed the problem . Wow! thank you *very* much. I decided to use HTML::Widget to speed up part of an application I have to deliver by tomorrow and was completely stuck on this issue. If that's not the problem, can you post more details to the HTML::Widget mailing list: http://lists.rawmode.org/cgi-bin/mailman/listinfo/html-widget Thanks. I checked the archives before posting and there was _one_ reference to this problem posted in June and it talked about HTML::Element::_xml_escape() being broken but I could not find that sub in the version I had installed. Anyway, thanks again because this simple upgrade fixed the issue apparently. Best, Alejandro Cheers, Carl ___ 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/ ___ 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 use HTML::Widget::Constraint::Date
Hi Carl! Thank you again for such a wonderful idea! I decided to create my own class in my controller namespace but I think it can be contributed to HTML::Widget::Constraint namespace if anyone here has acces to that. Here is the class code just in case anyone here wants to use it or forward it to the HTML::Widget people. I am really beaten up by this project I am working on so I can't time at the momento to contrib with a formal patch... bewarned though: it's a quick an dirty patch to solve my problem and it works only for ISO type date (-mm-dd). To anyone interested in using it just create it in your controller namespace and ajust the package name accordingly. Then in your code just do something like: $w->constraint("+vdc::Controller::DateField" => qw/ fecha_nacimiento fecha_muerte /) ->message('Formato: -MM-DD'); package vdc::Controller::DateField; use warnings; use strict; use base 'HTML::Widget::Constraint'; use Date::Calc; =head1 NAME vdc::Controller::DateField - Date Field Constraint (in just one field) =head1 SYNOPSIS my $c = $widget->constraint( 'DateField', @field_names ); =head1 DESCRIPTION Much like 'Date' Constraint but in just one field. It ONLY supports ISO format -mm-dd. But it's easier to deal with if you just have single date fields. =head1 METHODS =head2 process =cut sub process { my ( $self, $w, $params ) = @_; return [] unless ( $self->names && @{ $self->names } > 0 ); my @names = @{ $self->names }; my $results = []; foreach my $name (@names){ my ($y,$m,$d) = split /\-/,$params->{$name}; unless ( $y =~ /^\d+$/ && $m =~ /^\d+$/ && $d =~ /^\d+$/ && Date::Calc::check_date( $y, $m, $d ) ) { push @$results, HTML::Widget::Error->new( { name => $name, message => $self->mk_message } ); } } return $results; } =head1 AUTHOR DateField Constraint by Alejandro Imass <[EMAIL PROTECTED]> Hacked directly from Original Date by Sebastian Riedel, C<[EMAIL PROTECTED]> =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; On 11/26/06, Carl Franks <[EMAIL PROTECTED]> wrote: On 26/11/06, Alejandro Imass <[EMAIL PROTECTED]> wrote: > Thanks! > > But how do I use this constraint if I have several date fields in my > form? Suppose I have two dates which would mean 6 fields on the form > (per your explanation above). Do I just pass all 6 in order to the > constraint? or am I missing the point entirely? You would add 2 constraints - something like: $form->constraint( Date => 'start_year', 'start_month', 'start_day' ); $form->constraint( Date => 'end_year', 'end_month', 'end_day' ); If your data already has the date in a single field, rather than 3, create a Callback constraint, and base the code on the check in HTML/Widget/Constraint/Date.pm Carl ___ 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/ ___ 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] question from tutorial - does creating HTML in a controller using HTML::Widget violate MVC?
just my $.02: After reading this thread, I would like to give a word of support for HTML::Widget In my particular case, I built a complete set of admin apps, simple CRUD screens very, very fast using HTML::Widget and I did not find it _that_ bad at all. I combined the power of TT for some things and the RAD capabilities of HTML::Widget with the forms to very quickly cook up these admin apps I think that HTML::Widget or something like it in the future should always exist in Catalyst and does not necessarily break the MVC. The ability to quickly develop XML forms from the Controller that can be processed with CSS should not be lost in the future IMHO, so if it's not HTML::Widget we should standardize something else that does a similar job. Alejandro On 12/6/06, Eden Cardim <[EMAIL PROTECTED]> wrote: On 12/6/06, Michael Reece <[EMAIL PROTECTED]> wrote: > what about implicit data retrieval via method calls on objects passed > to templates? > > <% $thing->owner->name %> Well, if the view shouldn't have access to the implicit data via some object, the controller shouldn't have passed that object to the view in the first place. An object is still an object, whether it's stored in a database or not. -- Eden Cardim Instituto Baiano de Biotecnologia Núcleo de Biologia Computacional e Gestão de Informações Biotecnológicas Laboratório de Bioinformática -- "you seem to think that 'close enough' is close enough... please learn to be 'literal' around programming." merlyn - on irc.freenode.net#perl ___ 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/ ___ 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] question from tutorial - does creating HTML in acontroller using HTML::Widget violate MVC?
I'm just a newbie like you in Catalyst but I think that HTML::Widget is probably good enough for most simple (and perhaps not so simple) CRUD screens that are usually a pain after you finish your main app. I usually leave the admin apps for last and HTML::Widget saved my particular day so even if the original author recommends not using it, I would recommend that you try it and if it's good for you leave it at that. If something better comes along, learn it and use it. The important thing is to get the job done and HTML::Widget does that, IMHO it's not at all as broken as some have stated here. On 12/6/06, Hermida, Leandro <[EMAIL PROTECTED]> wrote: > > > On Wed, 6 Dec 2006, Matt S Trout wrote: > > > > > I wouldn't use HTML::Widget at all. The people who took over maint > > > after sebastian gave up on it have struggled valiantly to make it > > > useful and production quality and so far as I'm concerned > > > failed. Not one of his better experiments :) > > > > So what's considered best practice in this area, is it still > > Data::FormValidator or should we be looking at something else ? > > I hate that, the ::Simple variety and CGI::FormBuilder least > out of the current CPAN-able options. > Sorry my lack of English understanding today - but does the above mean that Data::FormValidator, Data::FormValidator::Simple and CGI::FormBuilder are NOT good choices? What do experienced Catalyst users think are the best CPAN choices for: 1) Form validation and processing 2) Form building I guess it should be noted that if HTML::Widget shouldn't be used in the ways that it was in the tutorial than it should be completely replaced with the CPAN module that most Catalyst users think should be there. Thanks in advance, Leandro ___ 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/ ___ 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] Couldn't forward to "vdc::View::tt". Does not implement "process"
Hi, I developed a Catalyst app in 5.7001 and am trying to deploy on a server with 5.7007 I am getting this error: Couldn't forward to "vdc::View::tt". Does not implement "process" Couldn't forward to command "vdc::View::tt": Invalid action or component. Perhaps is something obvious and stupid but I can't seem to find the problem. Up to now I have had this set-up and it was running a previous version of _this same application_ so it does not seem to making much sense. I checked the list archives and found a similar problem tha recommended an upgrade of Catalyst::View:TT; mine is the lates CPAN version. I also checked the class itself and it of course has the process method. Any ideas or help greatly appreciated. Thanks, Alejandro Imass ___ 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] Couldn't forward to "vdc::View::tt". Does not implement "process"
Actually, all controllers are failing at the time of rendering the template. I have now attached startup debug log, other relevant files. I can put the whole app for download if required. The complete Catalyst debug screen can be seen at: http://vdc.cc.com.ve/piloto On 12/17/06, Matt S Trout <[EMAIL PROTECTED]> wrote: On 17 Dec 2006, at 18:33, Alejandro Imass wrote: > Hi, > > I developed a Catalyst app in 5.7001 and am trying to deploy on a > server with 5.7007 > > I am getting this error: > > Couldn't forward to "vdc::View::tt". Does not implement "process" > > Couldn't forward to command "vdc::View::tt": Invalid action or > component. The attachment with the startup debug logs and the relevant controller and view class files seems to have gone missing; could you re-send please? -- Matt S Trout, Technical Director, Shadowcat Systems Ltd. Offering custom development, consultancy and support contracts for Catalyst, DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for details. + Help us build a better perl ORM: http://dbix- class.shadowcatsystems.co.uk/ + ___ 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/ lib.tgz Description: GNU Zip compressed data root-src.tgz Description: GNU Zip compressed data vdc_debug_log.tgz Description: GNU Zip compressed data ___ 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] Couldn't forward to "vdc::View::tt". Does not implement "process"
Thank You! That was the problem. I created a soft link with capital TT and it is now working. Can anyone explain why this has happened Is this a version problem? The application is working fine in my development laptop and _was_ working fine on this server also. Then all of a sudden it stopped working on the server! How is this possible? The only thing that changed is that I added the Authentication, Authorization and HTML::Widget modules among others. could this have triggered the capitalization scheme difference or is it a difference between 5.7001 and 5.7007. Note that the application is still working on the laptop with 5.7001 !!! On 12/18/06, John Beppu <[EMAIL PROTECTED]> wrote: vdc::View::tt doesn't seem to exist in the files you attached. However, you do have a vdc::View::TT -- note the capital "T"s. ___ 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/ ___ 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] Couldn't forward to "vdc::View::tt". Does not implement "process"
Well, I did transfer from Linux ext3 to a USB drive that is in FAT32 and then onto the server back into ext3 [1]. This was something that I had not done before and as Chris and Juan Miguel have mentioned I have also been a victim of case-change by the USB Drive. In my case, it's because I created the drive in VFAT to have compatibility with Windoze machines, but made the apparent mistake of using UTF-8 encoding in that partition. I should have noticed the warning every time I mounted the drive, but since I have gotten used to mounting and unmounting using Gnome I had never noticed this particular message: "FAT: utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!" Of course, the message is misleading as it should say case IN-sensitive, or "you may experience very bad and broken case sensitive problems!". Anyway, thanks a lot for your replies, sometimes we need several eyes to see something so obvious! And of course, my USB drive is going to ext3 or reiserfs immediately! Warm regards, Alejandro Imass [1] Without tarballing. USB 2 drives are so fast that many times it's much faster to copy the whole directory. It turned out to be a very bad idea :-( On 12/18/06, Christopher H. Laco <[EMAIL PROTECTED]> wrote: Juan Miguel Paredes wrote: > Well, just to laugh at myself, I had the same problem after > transferring the application from laptop to another machine via usb > flash drive (only directories and files containing all uppercase names > where copied in lowercase... in my case, it was > MyApp::View::HTML::Template) Yeah, me too. What os were you on? For me, copying things over to my FAT formatted USB stick in Unbuntu lowercaed a version of CatInABox for me. That sucked ass. I have to go through and fix everything. :-/ -=Chris ___ 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/ ___ 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] Again: Lighttpd deployment problems as non root
Hi, I understand that your problem is very specific to fastcgi but many, many times I may be testing something as root using the server script and then when I try to run with CGI or mod_perl I get a server error. In my particular case it's because /tmp/appname gets created with root and then the httpd user can't write to it. I just thought I'd share this because many times we overlook the obvious when we are under pressure. I broke my head for several hours one day with this stupid mistake. Regards, Alejandro Imass On 3/9/07, Kieren Diment <[EMAIL PROTECTED]> wrote: On 09/03/07, Ferruccio Zamuner <[EMAIL PROTECTED]> wrote: > Kieren Diment wrote: > > When I deploy my application at /fastcgi with lighttpd, the url > > http://my.site.com/fastcgi gives a 404 error, and > > http://my.site.com/fastcgi/ returns an internal server error handled by > > catalyst (with unknown resource fastcgi). This happens for every url > > without a trailing slash. > > > > If I try http://my.site.com/fastcgi/content/, it redirects to > > http://my.site.com/fastcgi/content/content/ which outputs what should > > be at > > the first /fastcgi/content > > > I've found the same problem yesterday. I've lost a lot of time thinking > about my mistake > on lighttpd config. > Thank you Kieren to have address me to your post here. > > No worries. The problems are a bit of a showstopper for me at the moment, so I have to work on them. I'm just making sure that all the issues I have identified are fixed, but expect a point release when that happens. ___ 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/ ___ 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] Problems in make tests of Catalyst::Controller::FormBuilder 0.03
I also tried with the version on svn and the same thing happens. I tried several things before writing to the list but without any luck. Just out of curiosity, how does this my $page = "books/basic"; $mech->get_ok( "http://localhost/$page";, "GET /$page" ); know if it's goint to use the mason, template or tt2 version of books/basic? and also, if I have another http server running on localhost should this test pass? (I shut down my local apache just in case, again without luck): Oh and BTW, even though the error is in: ok( $form, "Form found" ) or BAIL_OUT("Can't do anything without a form"); there is a warning on the $mech->get_ok() that I could not figire out. Where could I have gotten more info on this 'fieldsubs' option mentiones on the warning? I looked at the doc for many of the modules involved and could not find any info on this. Running make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/00-load.t t/01-basic.t t/02-edit.t t/03-attr_param.t t/00-load..ok 1/1# Testing Catalyst::Controller::FormBuilder 0.03 t/00-load..ok t/01-basic.[Test::WWW::Mechanize::get_ok] Warning: Possible field access via $form->prepare() - see 'fieldsubs' option at t/01-basic.t line 11 t/01-basic.NOK 2 # Failed test 'Form found' # in t/01-basic.t at line 14. FAILED--Further testing stopped: Can't do anything without a form make: *** [test_dynamic] Error 9 /usr/bin/make test -- NOT OK Running make install make test had returned bad status, won't install without force Running catalyst 5.7006 installed from CPAN on Debian Linux. Any help greatly appreciated! Alejandro ___ 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 in make tests of Catalyst::Controller::FormBuilder 0.03
Yeap! That surely did the trick! Thank you VERY much! (BTW, just for general culture, how did you originally arive at that conclusion when you had the problem?) Thanks again, Alejandro On 3/22/07, Bogdan Lucaciu <[EMAIL PROTECTED]> wrote: On Thursday 22 March 2007 01:34, Alejandro Imass wrote: > Running make test > PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" > "test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/00-load.t > t/01-basic.t t/02-edit.t t/03-attr_param.t > t/00-load..ok 1/1# Testing Catalyst::Controller::FormBuilder 0.03 > t/00-load..ok > t/01-basic.[Test::WWW::Mechanize::get_ok] Warning: Possible > field access via $form->prepare() - see 'fieldsubs' option at > t/01-basic.t line 11 > t/01-basic.NOK 2 > # Failed test 'Form found' > # in t/01-basic.t at line 14. > FAILED--Further testing stopped: Can't do anything without a form > make: *** [test_dynamic] Error 9 > /usr/bin/make test -- NOT OK make sure you have the latest CGI::FormBuilder (3.0501) i had the same problem with 3.03 -- Bogdan Lucaciu http://www.wiz.ro ___ 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/ ___ 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] Form Module Dichotomy
Hello, I wrote a complete backend in HTML::Widget a couple of months ago, and now I'm adding new functionallity to another part of the site. The question is: a - Stick with HTML::Widget and wait for FormFu ? b - use C::C::FormBuilder ? I am inclined for option b, but would like some feedback from others before going down this path. Thanks in advance for any comments. Alejandro ___ 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 Module Dichotomy
FormFu is a soon to come alternative (replacement?) for HTML::Widget On 3/22/07, Doran L. Barton <[EMAIL PROTECTED]> wrote: Not long ago, Alejandro Imass proclaimed... > I wrote a complete backend in HTML::Widget a couple of months ago, and > now I'm adding new functionallity to another part of the site. The > question is: > > a - Stick with HTML::Widget and wait for FormFu ? > b - use C::C::FormBuilder ? > > I am inclined for option b, but would like some feedback from others > before going down this path. I am currently developing my first app using C:C:FormBuilder too, having done previous Catalyst projects with HTML::Widget. I think FormBuilder may become the de facto way to develop Catalyst apps in the future, especially seeing there is a DBIx::Class::FormBuilder module on the horizon that will marry FormBuilder to DBIx::Class like DBIx::Class::HTMLWidget does for HTML::Widget. Have I missed something? What's FormFu? -=Fozz -- [EMAIL PROTECTED] is Doran L. Barton, president/CTO, Iodynamics LLC Iodynamics: IT and Web services by Linux/Open Source specialists "I sick and stay in bed with a clod." -- Memo sent inside Japanese company in London ___ 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/ ___ 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 Module Dichotomy
Thank you all for the valuable input to this thread. From the comments, my conclusion is that if you already developed with HTML::Widget it would probably be better to stick with it and wait for FormFu (or use FormFu from svn), because it's more backward compatible with legacy HTML::Widget code. For new developments, both FormFu and FormBuilder seem to be valid options, and if you have developed with FormBuilder in the past it, would probably make sense to use C::C::FormBuilder. Nevertheless, FormFu seems to be a fresh, KISS powerful alternative to C::C::FormBuilder, and probably be more effective for Catalyst developers because it has been thought to work with Catalyst from the start. Just MHO and interpretation. In my case, I will try both before deciding, and leave the back-end apps with HTML::Widget at the moment. I confess to be inclined for FormFu after Carl's comments because it seems that it would be easier to homologue the back-end apps to one standard in the near future. On the other hand, the little devil on left tells me that CGI::FormBuilder is a very powerful and proven system that would certainly have advantages over FormFu in certain scenarios. Again, IMHO. As to which one becomes the de-facto way, I will just say one thing: Hail TIMTOWTDI ! Best, Alejandro On 3/23/07, Carl Franks <[EMAIL PROTECTED]> wrote: On 22/03/07, Doran L. Barton <[EMAIL PROTECTED]> wrote: > I am currently developing my first app using C:C:FormBuilder too, having > done previous Catalyst projects with HTML::Widget. I think FormBuilder may > become the de facto way to develop Catalyst apps in the future, especially > seeing there is a DBIx::Class::FormBuilder module on the horizon that will > marry FormBuilder to DBIx::Class like DBIx::Class::HTMLWidget does for > HTML::Widget. Well, if mts has anything to say about it, it'll be Reaction that becomes the Cat de-facto ;) > Have I missed something? What's FormFu? Discussion of FormFu has generally been limited to the html-widget mailing list so far. FormFu is similar to html-widget, but tries to get everything right this time ;) It's main selling points are: * You can define your forms using external config files (using any format supported by Config::Any) * Instead of having a simple idea of 'constraint' - it has several stages that can process each form field. Filters -> Constraints -> Inflators -> Validators -> Transformers. Filters are intended to do basic cleanup of data input, such as removing trailing whitespace, or removing spaces in a creditcard number. Constraints are low-level data validation, such as, is this an integer, is this in bounds, etc. Inflators are similar to DBIC's - they expand the input into an object of some sort, so there's one which creates a DateTime object, and there's one which turns a file upload into an Imager object. Validators are for 'business logic' - more complex validation, possibly relating multiple fields, which will usually require a custom class created for each check. The only validator written as of yet is Imager::Size which checks a picture's pixel size is within bounds. And Transformers are to manipulate the (possible inflated) input data before using it. The ony transformer written so far is Imager, to edit Imager objects (scale, crop, etc). There are also Deflators, so you can pass $field->default($value) an object and make sure its value is printed properly. * Instead of using HTML::Element to generate the xhtml, it uses TT templates. Every project will have it's own copy of the template files, so you can customise them if you wish. * It's gotten rid of html-widget's seperate $result object - simplifying usage greatly. * Integration with Catalst and DBIx::Class See `svn log` for more - there's lot's there! The code is currently available from: http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu/ http://html-formfu.googlecode.com/svn/trunk/DBIx-Class-FormFu/ http://html-formfu.googlecode.com/svn/trunk/Catalyst-Controller-HTML-FormFu/ http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-Dojo/ http://html-formfu.googlecode.com/svn/trunk/HTML-FormFu-Imager/ I've started adding some TODO's to the issue tracker: http://code.google.com/p/html-formfu/issues/list What would be most helpful though for anyone wishing to help, would be documentation, as what's there is quite out-of-date. Cheers, Carl ___ 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/ ___ 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::DBIC::Schema or not?
Just my $.02 IMHO, the M is correctly defined as is in Catalyst, and you should definitively keep the Model. Depending on which "business logic" you are refering to, the code should go in any of Controller, Model (aka the ORM layer) or the Database. Furthermore, I think that ORM is just that: clean, powerful, maintainable access to your database, in fact, anything that pushes the ORM a bit too far should go IN the database. In practice, you will find that many of the procedures stored in the model classes will probably wind up in the databse for performance issues, so what I have done is set the boundary right there from the beggining (the point where you feel that you are pushing the ORM a bit too far). Any complex business logic should always be in the DB (if you are using a decent database such as PostgreSql, Oracle). The power, encapsulation and performance gains of using views and rules on a RDBMS like PostgreSql is without question. Unless you _really_, _really_ have serious portability issues, and not willing to maintain several sets of DB code, always consider programming the complex stuff in the DB. Cheers, Alejandro On 3/23/07, Brian Kirkbride <[EMAIL PROTECTED]> wrote: Jason Gottshall wrote: > Catalysters: > > I'm developing a new app using Catalyst, with DBIC as the db persistence > layer. I intend to build Models that encapsulate the business logic and > that will use DBIC to interact with the database as necessary, instead > of using DBIC as a "model" itself. > > So if I'm not using DBIC from the controller directly, is there any > reason for me to use Catalyst::Model::DBIC::Schema? It seems like I'm > just adding an unnecessary layer of code. > > Comments from any of you who have a similar setup would be especially > welcome. > > Jason > I only have Model classes for my business logic and have never had a problem with that. A bonus is that it forces you to say: $c->model('MyLogic')->_get_schema->resultset('Users') instead of: $c->model('Schema::Users') and that makes you think about ugly hacks that circumvent your business logic. ___ 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/ ___ 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::DBIC::Schema or not?
Brian, I understood your answer, I was responding the orinial post fo Jason Gottshall, but followed the thread from your post. Sorry for the confusion! Best, Alejandro On 3/23/07, Brian Kirkbride <[EMAIL PROTECTED]> wrote: Alejandro Imass wrote: > Just my $.02 > > IMHO, the M is correctly defined as is in Catalyst, and you should > definitively keep the Model. Depending on which "business logic" you > are refering to, the code should go in any of Controller, Model (aka > the ORM layer) or the Database. > > Furthermore, I think that ORM is just that: clean, powerful, > maintainable access to your database, in fact, anything that pushes > the ORM a bit too far should go IN the database. In practice, you will > find that many of the procedures stored in the model classes will > probably wind up in the databse for performance issues, so what I have > done is set the boundary right there from the beggining (the point > where you feel that you are pushing the ORM a bit too far). Any > complex business logic should always be in the DB (if you are using a > decent database such as PostgreSql, Oracle). The power, encapsulation > and performance gains of using views and rules on a RDBMS like > PostgreSql is without question. Unless you _really_, _really_ have > serious portability issues, and not willing to maintain several sets > of DB code, always consider programming the complex stuff in the DB. > > Cheers, > Alejandro I think maybe I didn't explain myself very well in the early email. I definitely have Models, but they are a higher-level abstraction than the ORM layer. If I understand your argument, you are advocating that data constraints imposed by your business logic be enforced by the the DB rather than the ORM. That's all fine and good, but MUCH lower level than what I have in my Catalyst Models. I usually have an architecture like this: Client -> Controller -> Model -> ORM -> Database The ORM is usually just vanilla (as you suggested), the Database enforces simple data constraints (foreign keys, etc) and the Model makes sure that the complex business logic constraints are met. Some things are simply not enforceable by a stored procedure - this might involve validation of image files for example. The beauty of Catalyst is that it's up to you how to handle separation of concerns and Catalyst is helpful no matter how you do. Best, Brian ___ 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/ ___ 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] Serving server-dependent static content
IMHO you should let each component do what it does best. Web servers are specialized for static content so le IT do this work. Your app is specialized in dyn content so let IT do the work. Here is an example apache2 conf to handle cat / static content. In this app, both standard cat static content _and_ a file system folder-based document library (biblioteca in the example) are viewed through cat but served by Apache. This setup yields GREAT performance gains, besides all the other benefits like taking advantage of other apache plug-in for specific content, security, etc. For example this site, has mp3 content which is served in streaming mode directly by an apache module SPECIALIZED for this. # Sample Aliases Alias /estadisticas /var/www/vdc/root/static/usage/ Alias /static /var/www/vdc/root/static Alias /biblioteca /var/vdc/biblioteca Alias / /var/www/vdc/script/vdc_cgi.pl # They cat part via mod_perl SetHandler modperl PerlResponseHandler vdc # static docs served by apache directly SetHandler default-handler SetHandler default-handler For the curious, the application can be browsed in the link below (even though it may seem so, there is 0% Flash, very little JS and mostly TT tricks and CSS (and cat of course)). All back-end apps were built with HTML::Widget, believe it or not ;-) http://vozdeloscreadores.gob.ve On 8/13/07, Pedro Melo <[EMAIL PROTECTED]> wrote: > Hi, > > On Aug 12, 2007, at 8:59 PM, [EMAIL PROTECTED] wrote: > > >> On 8/12/07, Peter Lytle <[EMAIL PROTECTED]> wrote: > >>> If someone has a solution from the Apache side, that's fine but I > >>> suspect that it might be > >>> easier to do this with Catalyst::Plugin::Static::Simple > >> > >> Don't serve static content through perl. Let your webserver do it. > >> Usually people just set up virtual hosts with different > >> DOCUMENT_ROOTs. Is there a reason that won't work for you? > >> > >> - Perrin > > > > a lot of times, 'static' content is found via database queries. and > > sometimes that content needs to be protected from unauthorized > > viewers, > > and your authorization mechanisms are already built into your > > application, > > so you can't just use Alias/Rewrite directives to still have apache > > serve > > up that tree. > > In those cases, pick a server that understands Reproxy: > > 1. hit goes through webserver into cat; > 2. cat does all the authorization stuff > 3. cat sends back header saying "Ok, webserver, send this static > file": Reproxying > 4. webserver spoon feeds slow clients. > > Both lighttpd and perlbal support this. I don't know if latest apache > also does. > > Best regards, > -- > Pedro Melo > Blog: http://www.simplicidade.org/notes/ > XMPP ID: [EMAIL PROTECTED] > Use XMPP! > > > > ___ > 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/ > ___ 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: [Catalyst-dev] Ignoring Emacs temp files
if you are methodic enough you can just create a script in /usr/bin that cleans temps, backs and other rotten files. Or easier yet, you can alias to something like clean_emacs to something like: find . -name "*~" | xargs rm -f find . -name "#*#" | xargs rm -f of course you can make this more efficient but it does the work and it's simple. just before submitting the day's work in SVN I just run this script and make sure I have pruned all these files. On 8/28/07, Jonathan Rockway <[EMAIL PROTECTED]> wrote: > Kieren Diment wrote: > > Applied (changeset 6741 and 6742 - don't ask) , thanks :-) > > > > On 27/08/07, Dave Rolsky <[EMAIL PROTECTED]> wrote: > > > >> When you're editing a buffer in emacs, it will create a temporary symlink > >> in the same directory of the file in the form ".#". > Thanks kd++ and autarch++ :) This has been an open issue for over a > year because we've been waiting for users to compile a list for every > editor and patch MPO accordingly. I only use emacs, so all I could > provide was similar to Dave's patch. With this applied, I am happy :) > > Users of other editors: we weren't kidding when we asked you for regexes > that exclude your editor's cruft files. They all do it, but I don't > have any of them so I don't know what the files are. Please send data. > > Regards, > Jonathan Rockway > > > ___ > 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/ > > > ___ 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/