irfancss has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monk,

My question is related to newly added Perl module Module::Checkstyle.

Writing program to check coding style with the help of above module.

Checkstyle works is that it will look for a config file in $HOME/.module-checkstyle/ folder that is config is in the .ini file format it will set various params for the checkstyle::check module

a. whitespace - checks whitespace before/after , or =>
b. subroutine - checks name/length etc of every sub()
c. package - check for multiple package declaration in one .pm file

config used here ; this is a sample config global-error-level = warn [Whitespace] after-comma = true after-fat-comma = true before-fat-comma = true [Package] max-per-file = 1 has-matching-filename = true is-first-statement = true [Subroutine] disallow-fully-qualified-names = true
Above config checks perfectly for WHITESPACE as described. But here I need functionality to check open curly braces. any block should have curly braces on the same line. for eg:
if ($foo) {
And no block should have the { on second line
if ($foo)
{
also note the space after the ) and before {

To check this with the exiting packages is not possible for me. Let me know if you guys have any solution for this problem.

Regards
Irfan Shaikh

2005-10-13 Retitled by g0n, as per Monastery guidelines
Original title: 'Extetion for Module::Checkstyle::Check::Whitespace'

Replies are listed 'Best First'.
Re: Extension for Module::Checkstyle::Check::Whitespace
by davidrw (Prior) on Oct 12, 2005 at 17:56 UTC
    Have you read through the POD for Module::Checkstyle::Check ? It "takes you through the basic steps in writing your own check."