Re: [Catalyst] Re: Redispatching actions
You said absolutely nothing to address the “wrong URL” problem Matt mentioned, btw. What wrong URL? My example showed that http://example.com/data/update is virtually equal to http://example.com/data/view if not posted from a form. Of course they are virtually equal – after all they are equally terrible. If you lay out your URI space in that manner, it’s no wonder that you can’t understand why redirects are good. Why do you say this? what do you propose for a better URI layout? Mark ___ 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: Redispatching actions
Matt S Trout wrote: Engage in the technical debate or be removed from this list just as quickly as a $religion extremist who refused to justify -their- position would be. This is your final warning. Cool down Tony^H^H^H^H^HMatt. -- Bernhard Graf ___ 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
I'm considering trying to port Ruby's ActiveRecord to Perl as a lightweight ORM option (with some small changes maybe, like composite PKs). If anyone's interested, toss me a message privately and we'll coordinate. What I found missing in DBIx::Class is AR method find_by_sql(sql). We use catalystdbix for months (kind of data-warehouse project), but rewriting complex, read-only SQL statements to dbix/perl notation is for me a waste of time (when editing updating tables with ORM is so fast to code and intuitive). However is it worth to build just-another-orm for perl when DBIx::Class is not so far to be really good one? -- [EMAIL PROTECTED] http://www.hurra-communications.com/ $ o m et e a m . d e v e l o p e r Hurra Communications, Krakow/Stuttgart/London/Paris/Madrid ___ 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
Adam Bartosik wrote: I'm considering trying to port Ruby's ActiveRecord to Perl as a lightweight ORM option (with some small changes maybe, like composite PKs). If anyone's interested, toss me a message privately and we'll coordinate. What I found missing in DBIx::Class is AR method find_by_sql(sql). We use catalystdbix for months (kind of data-warehouse project), but rewriting complex, read-only SQL statements to dbix/perl notation is for me a waste of time (when editing updating tables with ORM is so fast to code and intuitive). However is it worth to build just-another-orm for perl when DBIx::Class is not so far to be really good one? Maybe not. Or maybe we could write a wrapper to give more of an AR interface. I'm currently trying to decide on Catalyst or Rails for a new project. I like the flexibility of Catalyst (and love Perl), but I'm attracted to a lot of the design decisions in Rails (I like the fact, for example, that ActiveRecord::Validations supports data validation in the model, just like we were discussing in a previous thread). So part of me would like to see a more Rails-like layer on top of Catalyst. Maurice ___ 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] Setting time zone and locale on dates.
On Tue, May 22, 2007 at 01:55:23AM +0100, Matt S Trout wrote: DBIx::Class::InflateColumn::DateTime will do this part for you these days. I'd noticed that floating around but never found the tuits to investigate. Maybe I should install the tinker on my laptop and investigate on my next commute. C. -- Chisel Wright e: [EMAIL PROTECTED] w: http://www.herlpacker.co.uk/ For this and the answers to many other questions don't ask me. ___ 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] Setting time zone and locale on dates.
Hi, On May 21, 2007, at 9:54 PM, Bill Moseley wrote: This likely falls into one of the many how do I get $c into the model threads. My session has the locale and timezone fetched from the user's preferences at login. It's not really locale, but a language tag which is also used by Locale::Maketext, but should work for DateTime's locale setting. I use timestamp with time zone on my Postgresql timestamps and the model inflates to DataTime objects. Most if not all dates should be localized for the user. I'm tempted to use model class data to pass this to the model. So at the start of every request do something like: My::Model-current_timezone( $c-session-{timezone} ); My::Model-current_locale( $c-session-{locale} ); And then have the model use those (if set) when inflating. Any better ideas for dealing with this? I ask because (besides not having that much I18N experience) I think this is something that really belongs in the view. [% c.local_date( user.last_updated_time ) | html %] But, setting the locale and time_zone in the inflator would be handy since it's all one place instead of every time I use a date in the view. What do you do? I always do my model datetime stuff in UTC. Formatting according to user prefs belongs in the view, IMHO. I understand your wish to format in only one place, but IMHO, thats whar BLOCKs or PROCESSed files are for. Just do a date.tt and use it every where. Or write a Template::Plugin that takes in account your user preferences and just do [% my.date_field | user_pref_date %] Best regards, -- Pedro Melo Blog: http://www.simplicidade.org/notes/ Jabber ID: [EMAIL PROTECTED] Use Jabber! ___ 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] Setting time zone and locale on dates.
On Tue, May 22, 2007 at 10:20:26AM +0100, Pedro Melo wrote: I always do my model datetime stuff in UTC. After many years of painful date-work thanks to decisions made by others, this is how I prefer to work. Store everything in UTC (with time zome, just to be clear). After that, formatting and TZ tweaking is just eye candy in the template -- Chisel Wright e: [EMAIL PROTECTED] w: http://www.herlpacker.co.uk/ Atheism is a religion, provided you also accept that NOT collecting stamps is a hobby. ___ 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
I'm considering trying to port Ruby's ActiveRecord to Perl as a lightweight ORM option (with some small changes maybe, like composite PKs). If anyone's interested, toss me a message privately and we'll coordinate. Why not simply colaborate to extend DBIx? -- Eduard Giménez CAPSiDE Systems Engineer [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] Using a custom TT filter
Hi, I am trying to use a custom TT filter in a Catalyst app. In MyApp.pm I use: 'View::TT' = { PLUGIN_BASE = __PACKAGE__-path_to('lib'), }, In the lib dir I have a Diverse/NoDia.pm module that looks like this: package Diverse::NoDia; use Template::Plugin::Filter; use base 'Template::Plugin::Filter'; sub filter { my ($self, $text) = @_; $text =~ tr/ăşţîâĂŞŢÎÂ/astiaASTIA/; return $text; } 1; In the template I use: [% USE NoDia = Diverse.NoDia -%] [% FILTER $NoDia -%] ... [% END %] But it gives the following error: Couldn't render template plugin error - Can't locate object method load via package D:\web\TranzactiiBursiere\lib::Diverse::NoDia (perhaps you forgot to load D:\web\TranzactiiBursiere\lib::Diverse::NoDia?) at D:/usr/site/lib/Template/Plugins.pm line 215. How can I define a custom TT filter in a Catalyst app? (I need to filter a text depending on a condition, and I don't know if I can use another method for doing this.) Thank you. Octavian ___ 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] SubRequest and template recursion
Hi all, I have a template (page.tt2) that uses TT's VIEW directive, where I'm making a sub-request: [% BLOCK feed; data = Catalyst.subreq(/feed/$feed_url); data; END; %] In my controller: sub get_feed : LocalRegex('^(.*$) ) { my ( $self, $c ); my $src_url = $c-request-captures-[0]; my $content = get($src_url); # already USE(ing) LWP::Simple above $c-stash-{source_string} = $content; $c-stash-{template} = 'feed.tt2'; } But instead of a return of the results of running the source through the feed.tt2 template I get an error file error - recursion into 'page.tt2'. Any help, hints would be gratefully appreciated. Adeola. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ 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] Using a custom TT filter
On Tue, May 22, 2007 at 01:20:46PM +0300, Octavian Rasnita wrote: Hi, I am trying to use a custom TT filter in a Catalyst app. In MyApp.pm I use: 'View::TT' = { PLUGIN_BASE = __PACKAGE__-path_to('lib'), }, Not strictly a Catalyst question, but my guess is you're using PLUGIN_BASE incorrectly. According to 'perldoc Template::Plugin' (which of course you've already read): Use the PLUGIN_BASE option to specify the namespace that you use. e.g. use Template; my $template = Template-new({ PLUGIN_BASE = ’MyOrg::Template::Plugin’, }); You're not specifying a namespace, you're giving a path ... -- Chisel Wright e: [EMAIL PROTECTED] w: http://www.herlpacker.co.uk/ My computer's so fast it finishes an infinite loop in 5 minutes. ___ 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
I'm currently trying to decide on Catalyst or Rails for a new project. I like the flexibility of Catalyst (and love Perl), but I'm attracted to a lot of the design decisions in Rails (I like the fact, for example, that ActiveRecord::Validations supports data validation in the model, just like we were discussing in a previous thread). Months ago I gave a try for ROR. What is good compared to Catalyst? - documentation. It is easy to start, good doc, there are many books, tutos about it. Catalyst doc is... nothing interesting, sometimes inconsistent, sometimes broken links. Even less popular frameworks in Python like Pylons have better doc, are easier to start with. Because of flexibility, Catalyst could be very difficult at start (many chooses) - various web-related libs are better, up to date in Ror, eg. prototype My problems with ROR: - composite keys not out of the box - quoting names (I didn't find any workaround, maybe 2h of googling and trying to fix it is too less?) - much fighting to use for existing DB Sometimes you need to use something from CPAN and gems are not so solution-full. I think when you start a new agile project, ROR can be very helpful - especially when you need some rules (for project team), some design constraints, it is simple - do it our way. There is no such religious approach with Catalyst, you can do what you want typically the way you want. -- [EMAIL PROTECTED] http://www.hurra-communications.com/ $ o m et e a m . d e v e l o p e r Hurra Communications, Krakow/Stuttgart/London/Paris/Madrid ___ 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] Using a custom TT filter
Hello, In your TT::View you could add: use base 'Catalyst::View::TT'; sub noDia { my $text = shift; $text =~ tr/ăşţîâĂŞŢÎÂ/astiaASTIA/; return $text; } __PACKAGE__-config({ FILTERS = { 'noDia' = \noDia, }, }); So, in your template you should be able to use: [% FILTER noDia -%] data to parse [% END %] I hope this helps. This is just form my knowledge of TT. I'm still getting used to Catalyst so someone else might have a better idea but its worth a try ;) Adeola On 22 May 2007, at 11:20, Octavian Rasnita wrote: Hi, I am trying to use a custom TT filter in a Catalyst app. In MyApp.pm I use: 'View::TT' = { PLUGIN_BASE = __PACKAGE__-path_to('lib'), }, In the lib dir I have a Diverse/NoDia.pm module that looks like this: package Diverse::NoDia; use Template::Plugin::Filter; use base 'Template::Plugin::Filter'; sub filter { my ($self, $text) = @_; $text =~ tr/ăşţîâĂŞŢÎÂ/astiaASTIA/; return $text; } 1; In the template I use: [% USE NoDia = Diverse.NoDia -%] [% FILTER $NoDia -%] ... [% END %] But it gives the following error: Couldn't render template plugin error - Can't locate object method load via package D:\web\TranzactiiBursiere \lib::Diverse::NoDia (perhaps you forgot to load D:\web\TranzactiiBursiere\lib::Diverse::NoDia?) at D:/usr/ site/lib/Template/Plugins.pm line 215. How can I define a custom TT filter in a Catalyst app? (I need to filter a text depending on a condition, and I don't know if I can use another method for doing this.) Thank you. Octavian ___ 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/ -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ 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] Creating a thin Model
Matt S Trout wrote: If you get stuck, could you start a fresh thread, please? I think this one has officially got confused now :) Ok. Just for the record though, this seems to be working fine so far: package MySite::Model::Widget; use strict; use warnings; use base qw/Catalyst::Model/; use MySite::Widget; __PACKAGE__-config( connect_info = [ 'dbi:Pg:mysite', 'username', 'password', { AutoCommit = 1 }, ], ); sub new { my ( $class, $c, $args ) = @_; return MySite::Widget-new( Catalyst::Utils::merge_hashes( $args, $class-config ) ); } 1; package MySite::Widget; use warnings; use strict; use base qw/Class::Accessor/; use MySite::Schema::DB; use Carp; __PACKAGE__-mk_accessors(qw/schema/); sub new { my $self = shift-next::method(@_); croak -connect_info must be defined unless $self-{connect_info}; # Clone and connect to schema $self-{'schema'} = MySite::Schema::DB-connect( @{ $self-{connect_info} } ); return $self; } sub find { my ( $self, $id ) = @_; return $self-{'schema'}-resultset('Widgets')-find($id); } ... package MySite::Controller::Widget; ... # Get widget my $widget = $c-model('Widget')-find($id); $c-stash-{'widget'} = $widget; ... -- Jamie Neil | [EMAIL PROTECTED] | 0870 454 Versado I.T. Services Ltd. | http://versado.net/ | 0845 450 1254 ___ 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] equivalent of the CGI::Formbuilder::Multi
Do you know if there is equivalent of the CGI::Formbuilder::Multi. Or what easy kind of way do you suggest for creating multi-page form (web wizard)? Cheers hiedra ___ 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: ActiveRecord for Perl
* Adam Bartosik [EMAIL PROTECTED] [2007-05-22 13:05]: Because of flexibility, Catalyst could be very difficult at start (many chooses) I hear that a lot. I don’t get it, though. The tutorial tells you to use TT and DBIC. If you install the Catalyst glue for them, you get helper support for both. It doesn’t seem to me like you have to make any choices, unless you feel a need to question the community. Regards, -- Aristotle Pagaltzis // http://plasmasturm.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] Re: Using a custom TT filter
Hi Octavian, * Octavian Rasnita [EMAIL PROTECTED] [2007-05-22 12:30]: I am trying to use a custom TT filter in a Catalyst app. my answer has nothing to do with that – but: sub filter { my ($self, $text) = @_; $text =~ tr/ăşţîâĂŞŢÎÂ/astiaASTIA/; return $text; } Have you seen Text::Unidecode? Regards, -- Aristotle Pagaltzis // http://plasmasturm.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] ActiveRecord for Perl
On Tue, May 22, 2007 at 09:33:37AM +0200, Adam Bartosik wrote: I'm considering trying to port Ruby's ActiveRecord to Perl as a lightweight ORM option (with some small changes maybe, like composite PKs). If anyone's interested, toss me a message privately and we'll coordinate. What I found missing in DBIx::Class is AR method find_by_sql(sql). We use catalystdbix for months (kind of data-warehouse project), but rewriting complex, read-only SQL statements to dbix/perl notation is for me a waste of time (when editing updating tables with ORM is so fast to code and intuitive). What would that achieve that passing literal SQL chunks for SELECT, FROM, WHERE etc. wouldn't? -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
Re: [Catalyst] ActiveRecord for Perl
On 5/22/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: one thing i really like about AR is the association proxies, where relationships themselves are objects you can call methods (ie, find) on class User ActiveRecord::Base has_many :items end class Item ActiveRecord::Base belongs_to :user end items = user.items item = user.items.find(params[:id]) new_item = user.items.create!(params[:item]) you can get close to that with RDBO's $user-find_items() (and maybe DBIC has something similarish) but the ruby way here feels so much better! ruby way? That's exactly how DBIC works. -- Eden Cardim Instituto Baiano de Biotecnologia Núcleo de Biologia Computacional e Gestão de Informações Biotecnológicas Laboratório de Bioinformática ___ 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
On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote: I doubt there's anything worth porting in ActiveRecord that one of the many Perl options (DBIx::Class, Rose::DB::Object, Class::DBI, Tangram, Alzabo) doesn't provide. - Perrin one thing i really like about AR is the association proxies, where relationships themselves are objects you can call methods (ie, find) on class User ActiveRecord::Base has_many :items end class Item ActiveRecord::Base belongs_to :user end items = user.items item = user.items.find(params[:id]) new_item = user.items.create!(params[:item]) you can get close to that with RDBO's $user-find_items() (and maybe DBIC has something similarish) but the ruby way here feels so much better! ___ 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: Redispatching actions
On Tue, May 22, 2007 at 09:11:01AM +0200, Bernhard Graf wrote: Matt S Trout wrote: Engage in the technical debate or be removed from this list just as quickly as a $religion extremist who refused to justify -their- position would be. This is your final warning. Cool down Tony^H^H^H^H^HMatt. Ha, fair point. But you're driving a fair few people nuts not engaging, especially because you often present arguments that are technically competent and well-thought-out in other areas. Your religion over this one thus seems far worse in comparison - which is why I'm finding it extremely frustrating. Apologies for my disproportionate response. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
Re: [Catalyst] Re: Redispatching actions
This is your final warning. Cool down Tony^H^H^H^H^HMatt. Ha, fair point. But you're driving a fair few people nuts not engaging, especially because you often present arguments that are technically competent and well- thought-out in other areas. Your religion over this one thus seems far worse in comparison - which is why I'm finding it extremely frustrating. Apologies for my disproportionate response. Matt meant to say No more Catalyst CPAN releases, that system is the junk. Seriously funny when the mention of a name can kill a heated debate. =) -Wade ___ 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
-Original Message- From: mla [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 22, 2007 4:25 AM To: The elegant MVC web framework So part of me would like to see a more Rails-like layer on top of Catalyst. Sounds like you really want to write a Rails-like layer for Catalyst! Disclaimer: This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. The above information has been prepared for information purposes only. The above does not constitute an offer, recommendation or solicitation to buy or sell, nor is it an official confirmation of terms. While the information herein has been obtained from sources believed to be reliable, Landesbank Baden-Württemberg makes no representation that it is accurate or complete and it should not be relied upon as such. Neither Landesbank Baden-Württemberg nor any employee herein guarantees the information contained in this message. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You are not entitled to, directly or indirectly, use, disclose, distribute,print, or copy any part of this message if you are not the intended recipient.Any views expressed in this message are those of the individual sender, except where the sender specifies and with authority, states them to be the views of Landesbank Baden-Wurttemberg. ___ 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] SubRequest and template recursion
Thanks. That seemed to work :) Now I'm getting File not found error with XML::XPath not lining the fact that I'm passing it a string rather than a file :( Adeola. On 22 May 2007, at 15:04, Matt S Trout wrote: Add RECURSION = 1 to your View::TT config. -- Creative Developer - Digital Craftsmen Ltd Exmouth House, 3 Pine Street London, EC1R 0JH t: +44 20 7183 1410 f: +44 20 7099 5140 m: +44 79 3952 0786 w: http://www.digitalcraftsmen.net/ ___ 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
On Tue, May 22, 2007 at 06:53:00AM -0700, [EMAIL PROTECTED] wrote: On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote: I doubt there's anything worth porting in ActiveRecord that one of the many Perl options (DBIx::Class, Rose::DB::Object, Class::DBI, Tangram, Alzabo) doesn't provide. - Perrin one thing i really like about AR is the association proxies, where relationships themselves are objects you can call methods (ie, find) on DBIC relationships return resultset objects in scalar context: class User ActiveRecord::Base has_many :items __PACKAGE__-has_many('items', 'MyApp::DB::Item'); end class Item ActiveRecord::Base belongs_to :user __PACKAGE__-belongs_to('user', 'MyApp::DB::User'); end items = user.items my @items = $user-items; or my $items_rs = $user-items; item = user.items.find(params[:id]) my $item = $user-items-find($item_id); new_item = user.items.create!(params[:item]) my $new_item = $user-items-create(\%item_info); you can get close to that with RDBO's $user-find_items() (and maybe DBIC has something similarish) but the ruby way here feels so much better! How? -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
Re: [Catalyst] SubRequest and template recursion
On 22 May 2007, at 15:57, Dave Howorth wrote: Adeola Awoyemi wrote: Thanks. That seemed to work :) Now I'm getting File not found error with XML::XPath not lining the fact that I'm passing it a string rather than a file :( From TFM: new() This constructor follows the often seen named parameter method call. Parameters you can use are: filename, parser, xml, ioref and context. The filename parameter specifies an XML file to parse. The xml parameter specifies a string to parse ^ Dave, In my Template I already have that: [% USE doc = XML.XPath( xml = source_string ); node = doc.findnodes('/rss'); adaptation.print(node); -%] I also tried using 'text' as in Template::Plugin::XML::XPath docs, with no luck. Adeola. ___ 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
What would that achieve that passing literal SQL chunks for SELECT, FROM, WHERE etc. wouldn't? Readability. Complex SQL statements are more clear to understand than complex dbix statements when you are not an author of DBIX ;) I can also test it with simple copypaste to sql console to see how it works, how it is planned / optimized. I know it is ORM and database abstraction, I'm theoretically independent from my DB vendor and so on, but it doesn't change the fact it is more complicated, more noise, more strange -opt { qw[col1 col2] } than pure SQL statement. And when all this Catalyst/Dbix stuff is so flexible - why I should fight with such approach? -- [EMAIL PROTECTED] http://www.hurra-communications.com/ $ o m et e a m . d e v e l o p e r Hurra Communications, Krakow/Stuttgart/London/Paris/Madrid ___ 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
On Tue, May 22, 2007 at 05:36:18PM +0200, Adam Bartosik wrote: What would that achieve that passing literal SQL chunks for SELECT, FROM, WHERE etc. wouldn't? Readability. Complex SQL statements are more clear to understand than complex dbix statements when you are not an author of DBIX ;) I can also test it with simple copypaste to sql console to see how it works, how it is planned / optimized. I know it is ORM and database abstraction, I'm theoretically independent from my DB vendor and so on, but it doesn't change the fact it is more complicated, more noise, more strange -opt { qw[col1 col2] } than pure SQL statement. And when all this Catalyst/Dbix stuff is so flexible - why I should fight with such approach? Ok, I can see all of those arguments. So here's the one big remaining question - why haven't you worked out what syntax you'd like to see for this feature and started a thread on the dbix-class list to discuss it? :) -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
Re: [Catalyst] ActiveRecord for Perl
I agree with you, using DBIx for simple stuff is fine, but after a while raw SQL is sometimes nice to have. I cant figure out how to return the data in object form, but this will at least give you some data: __PACKAGE__-load_components(qw/ ResultSetManager PK::Auto Core /); sub get_data : ResultSet { my ($self) = @_; my $dbh = $self-result_source-schema-storage-dbh; ## use the handle, return data } http://search.cpan.org/~JROBINSON/DBIx-Class-0.07005/lib/DBIx/Class/Manual/Cookbook.pod#Predefined_searches_without_writing_a_ResultSet_class But this is not so useful if you cant return it in object form. (Want to be able to call functions/associations on that object). CDBI does it with sth_to_objects, and there is a CDBI compatibility layer, but I cant seem to get it working correctly. John On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote: What would that achieve that passing literal SQL chunks for SELECT, FROM, WHERE etc. wouldn't? Readability. Complex SQL statements are more clear to understand than complex dbix statements when you are not an author of DBIX ;) I can also test it with simple copypaste to sql console to see how it works, how it is planned / optimized. I know it is ORM and database abstraction, I'm theoretically independent from my DB vendor and so on, but it doesn't change the fact it is more complicated, more noise, more strange -opt { qw[col1 col2] } than pure SQL statement. And when all this Catalyst/Dbix stuff is so flexible - why I should fight with such approach? -- [EMAIL PROTECTED] http://www.hurra-communications.com/ $ o m et e a m . d e v e l o p e r Hurra Communications, Krakow/Stuttgart/London/Paris/Madrid ___ 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] ActiveRecord for Perl
So here's the one big remaining question - why haven't you worked out what syntax you'd like to see for this feature and started a thread on the dbix-class list to discuss it? :) Good point. To be honest - I need to dig deeply into dbix structure to propose something in the dbix way. The main feature I would like to get from dbix as a wrapper for SQL statement is pagination. Ok, see you on dbix list ;) -- [EMAIL PROTECTED] http://www.hurra-communications.com/ $ o m et e a m . d e v e l o p e r Hurra Communications, Krakow/Stuttgart/London/Paris/Madrid ___ 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
On Tue, May 22, 2007 at 11:52:22AM -0400, John Goulah wrote: I agree with you, using DBIx for simple stuff is fine, but after a while raw SQL is sometimes nice to have. Personally I find it worthwhile to reformulate queries in DBIC form - I find complex queries are usually there for reporting purposes and being able to filter, page etc. reports using the usual DBIC syntax is worth the effort of doing the conversion. But that may just be me :) - and what I'd really love to see is somebody use one of the SQL parser modules on CPAN to allow a standalone query to be backtracked into a resultset so you can get the best of both these approaches; however nobody's stepped up to do it and there are things I consider more of a priority for my own development time. But this is not so useful if you cant return it in object form. (Want to be able to call functions/associations on that object). CDBI does it with sth_to_objects, and there is a CDBI compatibility layer, but I cant seem to get it working correctly. I've actually replied on the dbix-class list showing you how to do this in pure DBIC - the CDBICompat layer should only ever be used for its intended purpose, there are too many hacks in it to make the 'compatibility' part work. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
Re: [Catalyst] ActiveRecord for Perl
On Tue, May 22, 2007 at 01:14:31PM -0300, Eden Cardim wrote: On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote: Good point. To be honest - I need to dig deeply into dbix structure to propose something in the dbix way. The main feature I would like to get from dbix as a wrapper for SQL statement is pagination. DBIC::RS has paging, just use the 'rows' and 'page' attrs. That's where we start to run into trouble - DBIC can provide all this stuff but it needs the metadata, which means it needs the query in DBIC form. Anyway, we'll discuss on't appropriate list :) -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
Re: [Catalyst] ActiveRecord for Perl
On May 22, 2007, at 7:58 AM, Matt S Trout wrote: item = user.items.find(params[:id]) my $item = $user-items-find($item_id); new_item = user.items.create!(params[:item]) my $new_item = $user-items-create(\%item_info); that's great; i thought i had recalled something similar, but couldn't find it again in my quick skim of DBIx::Class::Manual::* you can get close to that with RDBO's $user-find_items() (and maybe DBIC has something similarish) but the ruby way here feels so much better! How? personal satisfaction. ___ 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
On Tue, May 22, 2007 at 09:29:25AM -0700, Michael Reece wrote: On May 22, 2007, at 7:58 AM, Matt S Trout wrote: item = user.items.find(params[:id]) my $item = $user-items-find($item_id); new_item = user.items.create!(params[:item]) my $new_item = $user-items-create(\%item_info); that's great; i thought i had recalled something similar, but couldn't find it again in my quick skim of DBIx::Class::Manual::* you can get close to that with RDBO's $user-find_items() (and maybe DBIC has something similarish) but the ruby way here feels so much better! How? personal satisfaction. Right, but the DBIC code involved is almost identical. Given that you now know that, would you be willing to consider contributing any features you consider missing in DBIx::Class rather than writing another implementation of essentially the same API? (DBIC is intentionally not opinionated to let people do things their way with it - there are more than enough perl ORM projects already and I wanted to provide something people could subclass/extend rather than have to re-invent again :) -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
Re: [Catalyst] Re: ActiveRecord for Perl
On Tue, May 22, 2007 at 10:00:53AM -0700, Quinn Weaver wrote: In our case, the choice of form validators is what really took time. I started with Catalyst::Plugin::FormValidator, as suggested in the tutorial, but found it inadequate. Then we tried Catalyst::Controller::FormBuilder. Now we're using Form::Processor. Form libraries are -hard-. I'm hoping the Reaction::UI system's form support will be a good general solution, at least for complex projects, and it's taken me, what, pushing two years to get a design I'm -mostly- happy with and the implementation still isn't complete. -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
Re: [Catalyst] ActiveRecord for Perl
John Napiorkowski wrote: --- Eduard Giménez [EMAIL PROTECTED] wrote: I'm considering trying to port Ruby's ActiveRecord to Perl as a lightweight ORM option (with some small changes maybe, like composite PKs). If anyone's interested, toss me a message privately and we'll coordinate. Why not simply colaborate to extend DBIx? Just as a followup to that, you should really try to write a list of everything you think is missing from DBIx and discuss it over on the project mailing list. The framework is designed around a component architecture so it's straightforward to add or alter features. I find it unlikely you will be able to match it's features without more than a year of consistent effort. Okay, thanks. I will do that. I'm mainly looking to strip features, not match them. Some of the validation stuff that AR does for you could be handled by some hacking on DBIC::Validation although to be honest good design would preclude wanted to put all your validation in the physical model class. Agreed. Maurice ___ 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
Perrin Harkins wrote: On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote: What I found missing in DBIx::Class is AR method find_by_sql(sql). Did you ask about it on the mailing list? Nearly all of the Perl ORMs have support for direct SQL. I don't know DBIx::Class, but search_literal sounds like what you want. I doubt there's anything worth porting in ActiveRecord that one of the many Perl options (DBIx::Class, Rose::DB::Object, Class::DBI, Tangram, Alzabo) doesn't provide. If I may ask, Perrin, what do you use? Maurice ___ 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
mla wrote: Christopher H. Laco wrote: mla wrote: Perrin Harkins wrote: On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote: What I found missing in DBIx::Class is AR method find_by_sql(sql). Did you ask about it on the mailing list? Nearly all of the Perl ORMs have support for direct SQL. I don't know DBIx::Class, but search_literal sounds like what you want. I doubt there's anything worth porting in ActiveRecord that one of the many Perl options (DBIx::Class, Rose::DB::Object, Class::DBI, Tangram, Alzabo) doesn't provide. If I may ask, Perrin, what do you use? Maurice I'm one of those odd birds that's used CDBI, DBIC and RDBO. I've converted from CDBI to DBIC and also written an RDBO layer for a project. /CDBI smart ass comments deleted/ :-) They all have their quirks. DBIC does a great job of getting out of your way. If there's an option, chances are you can set it at the class and/or object instance level, allowing fair amounts of evil to be accomplished. :-) RDBO tickles my fancy if I'm really into triggers at the various stages of data usage. What I really really missed from DBIC when writing RDBO was deploy(). The ability to just kick out a db schema into a DB from a DBIC schema totally rocks. Thanks for sharing your experiences. Other than the the deploy() stuff, any other criticisms of RDBO? Now that I'm looking at it again, I'm liking the design very much. I found this thread that compared some of the differences (might be outdated now): http://www.gossamer-threads.com/lists/catalyst/users/3095 What would cause you to *not* use RDBO on a new project? Maurice Just for giggles, you can compare the two sets of glue: http://search.cpan.org/src/CLACO/Handel-Storage-RDBO-0.01_02/lib/Handel/Storage/RDBO.pm http://search.cpan.org/src/CLACO/Handel-0.99_18/lib/Handel/Storage/DBIC.pm Same API...different ORMS. signature.asc Description: OpenPGP digital signature ___ 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
mla wrote: Christopher H. Laco wrote: mla wrote: Perrin Harkins wrote: On 5/22/07, Adam Bartosik [EMAIL PROTECTED] wrote: What I found missing in DBIx::Class is AR method find_by_sql(sql). Did you ask about it on the mailing list? Nearly all of the Perl ORMs have support for direct SQL. I don't know DBIx::Class, but search_literal sounds like what you want. I doubt there's anything worth porting in ActiveRecord that one of the many Perl options (DBIx::Class, Rose::DB::Object, Class::DBI, Tangram, Alzabo) doesn't provide. If I may ask, Perrin, what do you use? Maurice I'm one of those odd birds that's used CDBI, DBIC and RDBO. I've converted from CDBI to DBIC and also written an RDBO layer for a project. /CDBI smart ass comments deleted/ :-) They all have their quirks. DBIC does a great job of getting out of your way. If there's an option, chances are you can set it at the class and/or object instance level, allowing fair amounts of evil to be accomplished. :-) RDBO tickles my fancy if I'm really into triggers at the various stages of data usage. What I really really missed from DBIC when writing RDBO was deploy(). The ability to just kick out a db schema into a DB from a DBIC schema totally rocks. Thanks for sharing your experiences. Other than the the deploy() stuff, any other criticisms of RDBO? Now that I'm looking at it again, I'm liking the design very much. I found this thread that compared some of the differences (might be outdated now): http://www.gossamer-threads.com/lists/catalyst/users/3095 What would cause you to *not* use RDBO on a new project? Maurice 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. Managers...ResultSets There's been a lot of traffic on RDBO lately polishing helper methods for relations and other such stuff Really, they're both great ORMS. I just prefer DBIC. Some prefer RDBO. Both are powerful. Just don't use CDBI. :-P (Sorry, couldn't resist). Repeat after me: Thou Shalt Never Create A CDBI Storage Layer For Handel. :-) -=Chris signature.asc Description: OpenPGP digital signature ___ 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
On 5/22/07, mla [EMAIL PROTECTED] wrote: If I may ask, Perrin, what do you use? I have a large system that was started back when Class::DBI was a hot new thing. It still uses CDBI and hasn't really had a good reason to change, since we use a lot of custom SQL and that's pretty easy to do with CDBI (and performs well). For new projects, I'm trying Rose::DB::Object. I had good success using the query builder from RDBO on its own for one project. A lot of the database work I do doesn't go through any ORM because it involves complex reporting. There are some good features in the other ones too. Tangram is a pretty amazing accomplishment. DBIx::Class abstracts some things that the others don't, making it more flexible. RDBO seems to suit me best at the moment though. - Perrin ___ 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
On Tue, May 22, 2007 at 12:03:43PM -0700, mla wrote: Okay, thanks. I will do that. I'm mainly looking to strip features, not match them. DBIx::Class' component architecture makes it easy to do that too. It's pretty much an ORM construction kit that just happens to provide a default recipe :) -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
[Catalyst] DBIC/RDBO comparison (excuse new thread)
Damn it, I've lost which message I should be replying to. But to answer the freshness question - UNIQUE RDBO FEATURES * Support for Informix. -- no idea, we may have users, we may not :) * Objects may be loaded based on unique keys. -- DBIC has this * Extensive column metadata: data types, size limits, default values. -- DBIC can take this info but lets the DB enforce it * Bundled set of column classes for most commonly used data types, with integrated inflate/deflate, validation, and other convenience functions. -- not exactly but things like InflateColumn::DateTime provide it as an add-on * The bundled column classes also support some esoteric column types: Informix SET columns, Postgres CHKPASS, BIT, and array columns. (Inflate/deflate is done to/from Perl arrays and Bit::Vector objects as appropriate; Postgres arrays and bitfields are emulated in other databases.) -- nope. nobody's ever asked for this except for pg arrays, which I'm waiting for somebody to care about enough to write tests :) * In addition to inflate/deflate, column triggers can also be applied to get/set (user data) and load/save (to/from database) events. -- DBIC has always allowed this via subclassing, triggers are just a performance hit you don't need. * Can auto-join via one-to-many and many-to-many relationships, fetching all data in a single query, preserving custom sort orders for sub-objects. -- DBIC implemented this in 06, pretty much * Queries accept rich values as arguments (e.g., DateTime and Bit::Vector objects) -- expected in 09 * Bulk update and delete methods, which also work with rich query arguments. -- resultset objects provide this * By default, when an object's related sub-objects are added or updated through that object, all changes are delayed until the parent object is saved, at which time all outstanding changes occur within a single transaction. (Immediate actions are also supported.) -- 08 will support this for create, anything else you use txn_do for * Support for SELECT DISTINCT ... queries. -- distinct = 1 * Lazy loading can be overridden on a per-class basis during single and multi-table queries. -- no, but the select/as mechanism has proven sufficient so far * Database migration: copying objects from one database to another by trading db (Rose::DB) objects. Works across database types (e.g., Postgres to MySQL) provided that all column data types exist (or are emulated) in both places. -- largely works. dunno how far users have stressed this. * In addition to extracting column names, primary keys, and foreign keys, the RDBO loader can also do the following: - Configure column data types, size limits, and default values. - Extract and configure unique keys. - Set up all relationship types, including many-to-many relationships. -- Schema::Loader basically handles this * All automatic behavior and naming conventions are encapsulated in a convention manager object. Using different convention managers will alter the behavior of the loader and other automatic processes. (e.g., A Rails convention manager could enforce the Ruby on Rails naming conventions for classes and tables.) -- no, but everything is configurable pretty much -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
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] Sending email from Catalyst and scripts
J, I've looked at your module, but I'm afraid it would actually make sending emails even more dependent on catalyst, and I want to be able to use the same email framework from both catalyst and command-line scripts. In my setup, each email belongs to one emailclass. Metadata for each emailclass, including template_name, is stored in the database. template_name defines the location for the template files for this email class. A list of template files usually consists of templates for text version, HTML version, email subject, and email headers (all of them are TT templates). Each email class also has its own test script which sends a sample email for that class. I have two TT views - one for the text emails, and another for HTML emails (each view has its own wrappers). As I've mentioned before, send_email method in Controller::Email does the bulk of work: based on the emailclass, it fetches the template files and uses the TT views to render the parts of the email, which is then contructed using Email::MIME::Creator (although I could have used Catalyst::Plugin::Email as well), stores metadata for this email into database, and then actually sends it. So, to rephrase, my question is actually not about how to send email from catalyst - the above setup works really well. I just want to be able to use the same method to send emails from catalyst AND command-line scripts. I see two ways to consider (there might be more): 1) Somehow setup the catalyst context $c in the command-line scripts, so I could call the same send_email method from Controller::Email. Is this possible? 2) Move the bulk of send_email out of catalyst and just leave a wrapper for that method in Controller::Email. The problem would be that catalyst provides many helpful methods (i.e., easy access to preconfigured views and models), and those wouldn't be available outside of catalyst. On 5/22/07, J. Shirley [EMAIL PROTECTED] wrote: I've recently been working on an Email view, which I hope will become the recommended way to send Email from Catalyst. It hitches into Email::Send, and also ties into your Template view (which, sadly, only works with View::TT at the moment but I'm hoping to get the other views supported soon) I haven't posted it to CPAN yet, as I'm waiting to get some tests written up for it, but you can download it from the Catalyst SVN repository at: http://dev.catalystframework.org/repos/Catalyst/trunk/Catalyst-View-Email/ I also have a tarball at http://staff.toeat.com/~jshirley/Catalyst-View-Email-0.01.tar.gz I recommend you read through the pod for both Catalyst::View::Email and Catalyst::View::Email::Template And, as for sending out an email via the command line, there are many ways to achieve this depending upon what your goal and full use case is. Good luck, and happy hacking, -J -- - Evaldas Imbrasas http://www.imbrasas.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] Constants that refer to rows in a lookup table.
Bill Moseley wrote: This is suppose to be an ORM-neutral question. I often use lookup tables in the database, even for things like, say, cart_status: create table cart_status ( id SERIAL PRIMARY KEY, nametext NOT NULL, active boolean NOT NULL DEFAULT TRUE ); -- trust the sequence, Luke insert into cart_status (name) values ('Pending'); insert into cart_status (name) values ('Completed'); Then things like this are nice: [% cart.cart_status.name %] And can do this: update cart_status set name = 'Finished' where name = 'Completed'; And add new lookup options: insert into cart_status (name) values ('Orphaned'); but this is not so nice: $cart_class-search( cart_status = 1 ); And just because you've mentioned cart... :-) What's so wrong with cart_status = 1 ? ..where cart_status in (1, 2) Constants aren't the devil. MyApp::Constants isn't abnormal. Personally, I never store 'flags' as strings. You say 'pending', I say 'Pending'and if the db is or isn't case sensitive?... IF you do store it as strings, I'd say still use constants in your code anyways... -=Chris signature.asc Description: OpenPGP digital signature ___ 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] Constants that refer to rows in a lookup table.
Bill Moseley wrote: This is suppose to be an ORM-neutral question. I often use lookup tables in the database, even for things like, say, cart_status: create table cart_status ( id SERIAL PRIMARY KEY, nametext NOT NULL, active boolean NOT NULL DEFAULT TRUE ); -- trust the sequence, Luke insert into cart_status (name) values ('Pending'); insert into cart_status (name) values ('Completed'); Then things like this are nice: [% cart.cart_status.name %] And can do this: update cart_status set name = 'Finished' where name = 'Completed'; And add new lookup options: insert into cart_status (name) values ('Orphaned'); but this is not so nice: $cart_class-search( cart_status = 1 ); So, what have you found that works nicely? use MyApp::Const qw/ cart_pending /; # potentially long list cart_status = cart_pending # runtime checking use MyApp::Const qw/ :cart /; # Shorter list :) cart_status = MyApp::CONST::pending, # global constants # Make it very clear where a constant should be used # by adding the constants as methods to the cart namespace cart_status = $cart_class-pending_status And why aren't you using Handel? :-) signature.asc Description: OpenPGP digital signature ___ 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] Constants that refer to rows in a lookup table.
On Tue, May 22, 2007 at 04:36:06PM -0700, mla wrote: The PKs seem arbitrary in this case. I don't know if they should be referenced at all. I'd tend to use a subselect... UPDATE carts SET cart_status_id = ( SELECT id FROM cart_status WHERE name = 'Completed' ); But in a more ORM way, maybe something like my $status = Cart::Status-fetch(name = 'Pending'); Ya, but Pending is the description of the status, not the actual abstract status. Your cart is: [% cart.cart_status.name | html %] Manager makes decision: update cart_status set name = 'Not Completed' where name = 'Pending'; This still works: Your cart is: [% cart.cart_status.name | html %] But everywhere you did this is now broken: my $status = Cart::Status-fetch(name = 'Pending'); But if I did this everywhere instead: my $status = Cart::Status-fetch(name = cart_pending_status ); I'd still be on the beach. But the question was how do I represent constants best? -- Bill Moseley [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
On Tue, May 22, 2007 at 03:46:16PM -0500, Peter Karman wrote: 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; So far as I can see, the basic difference is - DBIx::Class aims for fast enough and extremely extensible/flexible Rose::DB::Object aim for extremely fast and extensible/flexible enough I discussed merging the projects with jcs a while back but he didn't see the point of the ResultSet chaining system, which I consider DBIC's key killer feature - until you've used it you don't realise it's something every other ORM is missing (see Paul Graham's lisp vs. blub articles). Personally, I see this as a great shame - for want of jcs understanding the use of one feature, the chance to have a single project was lost. In the meantime, RDBO is a brilliantly well-written system and if you're with jcs in not seeing the point of the (functional-ish/set-arithmetic-ish resultset concept) and not wanting to be able to subclass to override at any level of the process, it's a very useful option. I usually tell people to examine both and choose whichever best suits their project - the experienced developers seem -usually- to end up going for DBIx::Class by default, Rose::DB::Object when they need speed over features but that's my personal experience from discussion with a few hundred perl developers, not a statement of intent/recommendation. Rose::DB::Object -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
Re: [Catalyst] includes in catalyst
On Tue, May 22, 2007 at 05:14:53PM -0400, John Goulah wrote: Is it better to put module use statements within each controller class they are used in, or at some more global level , and if so where is suggested? In each controller class a module's used. This is more flexible and makes code re-use easier. It's the perl way - anything else is just asking for trouble later :) -- Matt S Trout Need help with your Catalyst or DBIx::Class project? Technical DirectorWant a managed development or deployment platform? Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote http://chainsawblues.vox.com/ http://www.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/
Re: [Catalyst] Constants that refer to rows in a lookup table.
Bill Moseley wrote: On Tue, May 22, 2007 at 04:36:06PM -0700, mla wrote: The PKs seem arbitrary in this case. I don't know if they should be referenced at all. I'd tend to use a subselect... UPDATE carts SET cart_status_id = ( SELECT id FROM cart_status WHERE name = 'Completed' ); But in a more ORM way, maybe something like my $status = Cart::Status-fetch(name = 'Pending'); Ya, but Pending is the description of the status, not the actual abstract status. Your cart is: [% cart.cart_status.name | html %] Manager makes decision: update cart_status set name = 'Not Completed' where name = 'Pending'; This still works: Your cart is: [% cart.cart_status.name | html %] But everywhere you did this is now broken: my $status = Cart::Status-fetch(name = 'Pending'); But if I did this everywhere instead: my $status = Cart::Status-fetch(name = cart_pending_status ); I'd still be on the beach. But the question was how do I represent constants best? Consider this change... create table cart_status ( id SERIAL PRIMARY KEY, status text UNIQUE NOT NULL nametext NOT NULL, active boolean NOT NULL DEFAULT TRUE ); -- trust the sequence, Luke insert into cart_status (status, name) values ('pending', 'Pending'); insert into cart_status (status, name) values ('completed', 'Completed'); Now you use id in your FKs, but reference the status row by the 'status' column, which is effectively the constant name. The id serves just as a synthetic key, but the unique constraint on status is the real pk. Now you can change name whenever you want and it affects nothing. The name and status then won't necessarily match, but that's the same as using a constant name. That's the approach I usually take. If you want to stick with actual, external constants referencing synthetic keys, then maybe define the constants first and don't rely on a serial column to populate the rows. Then if you're in a dev environment with a different sequence state or something, the constants won't be off. Maurice ___ 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] Constants that refer to rows in a lookup table.
On Tue, May 22, 2007 at 05:57:15PM -0700, mla wrote: Consider this change... create table cart_status ( id SERIAL PRIMARY KEY, status text UNIQUE NOT NULL nametext NOT NULL, active boolean NOT NULL DEFAULT TRUE ); Now there's two primary keys... Yes, that's an idea. Better use of the database's relationships, but it does mean an extra select or join every time I want to fetch cart(s) of a specific status. Something to think about. Doesn't answer my question about best way to use constants -- but does answer how not to use constants. ;) Thanks, -- Bill Moseley [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] Constants that refer to rows in a lookup table.
Bill Moseley wrote: On Tue, May 22, 2007 at 05:57:15PM -0700, mla wrote: Consider this change... create table cart_status ( id SERIAL PRIMARY KEY, status text UNIQUE NOT NULL nametext NOT NULL, active boolean NOT NULL DEFAULT TRUE ); Now there's two primary keys... Which is okay, AFAIK. No problems with multiple candidate keys. Yes, that's an idea. Better use of the database's relationships, but it does mean an extra select or join every time I want to fetch cart(s) of a specific status. Something to think about. If it's a performance issue then next step could be to fetch all the status rows at the start and then use the IDs from that as your constants. Doesn't answer my question about best way to use constants -- but does answer how not to use constants. ;) Sorry. Maurice ___ 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/