I have the following code snippet:
my $obj = $class->new({
schema => $schema,
reminder => $reminder,
action => $action,
dt => $dt,
});
My problem is, that perltidy tries to format it into something, like this:
my $obj = $class->new(
{ schema => $schema,
reminder => $reminder,
action => $action,
dt => $dt,
}
);
I don't like the curly brace placement. Can I somehow configure perltidy to format it like the first example? (Skipping the formatting for the block is not an option. I want to format every longer hashref into that format, so it is more compact and readable)
My perltidyrc so far:
-l=79 # Max line width is 78 cols
-i=4 # Indent level is 4 cols
-ci=4 # Continuation indent is 4 cols
-st # Output to STDOUT
-se # Errors to STDERR
-vt=2 # Maximal vertical tightness
-cti=0 # No extra indentation for closing brackets
-pt=1 # Medium parenthesis tightness
-bt=1 # Medium brace tightness
-sbt=1 # Medium square bracket tightness
-bbt=1 # Medium block brace tightness
-nsfs # No space before semicolons
-nolq # Don't outdent long quoted strings
If I remove the '{}' and pass the parameters as a list, it does the right thing btw. But i have to pass a hashref.
Or could you recommend a sane way of formatting such code?
The following seems to solve the above problem and works for me: