Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tidy DBIx::Class::Schema::Loader's output?

We are currently introducing DBIx::Class in our team and we would like to start out with DBIx::Class::Schema::Loader. However, we have hard requirements on code style, i.e. we've got Perl::Tidy as part of our pre-commit script, since we haven't had any generated code before. Now, we'd have to make sure that the code that Schema::Loader generates is clean and tidy. We can't run perltidy over the code before commit, since it screws up DBIC's MD5 hashing. So a post-processor integrated into Schema::Loader would be my preferred and probably the only feasible solution. But still: how would you handle this problem?

EDIT I might as well patch DBIx::Class::Schema::Loader::Base to use a perltidy preprocess parameter if it gets one.

like image 302
Nikolai Prokoschenko Avatar asked Jan 20 '10 14:01

Nikolai Prokoschenko


2 Answers

0.05000 has been released (previously the development version) it has the overwrite_modifications option rbuels added.

I will try to add a post_process option as well soon.

like image 136
Rafael Kitover Avatar answered Sep 28 '22 03:09

Rafael Kitover


The development version of DBICSL now has an overwrite_modifications option you can use to ignore changes in the md5summed parts of the code. This should let you run perltidy on the output before committing it, and still be able to re-dump later.

like image 23
Robert Buels Avatar answered Sep 28 '22 01:09

Robert Buels