[Dbix-class] RFC: Possibly cleaner output for DBIC::Schema::Loader dumps

Nilson Santos Figueiredo Junior acid06 at gmail.com
Fri Jul 21 06:44:33 CEST 2006


The first thing I do before adding my own code to the generated schema
classes is to replace all __PACKAGE__ occurrences to $pkg and add

  my $pkg = __PACKAGE__;

at the top of the file. I've seen someone else doing it and I thought
it made my schema classes a little bit more aesthetically pleasing so
it became one of my own best practices.

I also think that some line breaks here and there make a lot of
difference in code that will actually be handled by human beings.

So, attached you'll find a patch for DBIx::Class::Schema::Loader::Base
(against trunk) that implements these changes. I don't know if this is
generally seen as a good practice (I don't know about any reasons why
it shouldn't) but I've scared enough people with that __PACKAGE__
madness to have it lurking around my own code. But I guess this really
boils down to what everyone else prefers (and, maybe more importantly,
what blblack prefers ;-) ).

I also thought about maybe adding some comments above each of the
generated classes "sections" (e.g. columns, relationships, etc) since
it might help people who are just starting using the module and it's
is also something I usually manually add. But these aren't included in
the patch since I wasn't sure about the best wording.

-Nilson Santos F. Jr.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cleaner-output.patch
Type: text/x-patch
Size: 1682 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060721/4efb13a1/attachment.bin 


More information about the Dbix-class mailing list