at internal keywords C<if> and C<unless> will normally be retained.
To prevent this, and thus form longer lines, use B<-nbol>.
+=item B<-bom>, B<--break-at-old-method-breakpoints>
+
+By default, a method call arrow C<-E<gt>> is considered a candidate for
+a breakpoint, but method chains will fill to the line width before a break is
+considered. With B<-bom>, breaks before the arrow are preserved, so if you
+have preformatted a method chain:
+
+ my $q = $rs
+ ->related_resultset('CDs')
+ ->related_resultset('Tracks')
+ ->search({
+ 'track.id' => {-ident => 'none_search.id'},
+ })->as_query;
+
+It will B<keep> these breaks, rather than become this:
+
+ my $q = $rs->related_resultset('CDs')->related_resultset('Tracks')->search({
+ 'track.id' => {-ident => 'none_search.id'},
+ })->as_query;
+
=item B<-bok>, B<--break-at-old-keyword-breakpoints>
By default, perltidy will retain a breakpoint before keywords which may
########################################
$add_option->( 'break-at-old-keyword-breakpoints', 'bok', '!' );
$add_option->( 'break-at-old-logical-breakpoints', 'bol', '!' );
+ $add_option->( 'break-at-old-method-breakpoints', 'bom', '!' );
$add_option->( 'break-at-old-ternary-breakpoints', 'bot', '!' );
$add_option->( 'break-at-old-attribute-breakpoints', 'boa', '!' );
$add_option->( 'ignore-old-breakpoints', 'iob', '!' );
-kis keep interior semicolons. Allows multiple statements per line.
-boc break at old comma breaks: turns off all automatic list formatting
-bol break at old logical breakpoints: or, and, ||, && (default)
+ -bom break at old method call breakpoints: ->
-bok break at old list keyword breakpoints such as map, sort (default)
-bot break at old conditional (ternary ?:) operator breakpoints (default)
-boa break at old attribute breakpoints
$rOpts_break_at_old_keyword_breakpoints
$rOpts_break_at_old_comma_breakpoints
$rOpts_break_at_old_logical_breakpoints
+ $rOpts_break_at_old_method_breakpoints
$rOpts_break_at_old_ternary_breakpoints
$rOpts_break_at_old_attribute_breakpoints
$rOpts_closing_side_comment_else_flag
$rOpts->{'break-at-old-keyword-breakpoints'};
$rOpts_break_at_old_logical_breakpoints =
$rOpts->{'break-at-old-logical-breakpoints'};
+ $rOpts_break_at_old_method_breakpoints =
+ $rOpts->{'break-at-old-method-breakpoints'};
$rOpts_closing_side_comment_else_flag =
$rOpts->{'closing-side-comment-else-flag'};
$rOpts_closing_side_comment_maximum_text =
set_forced_breakpoint( $i - 1 );
} ## end if ( $type eq 'k' && $i...)
+ # remember locations of -> if this is a pre-broken method chain
+ if ( $type eq '->' ) {
+ set_forced_breakpoint($i - 1)
+ if ( ( $i == $i_line_start )
+ && $rOpts_break_at_old_method_breakpoints );
+ } ## end if ( $type eq '->' )
# remember locations of '||' and '&&' for possible breaks if we
# decide this is a long logical expression.
- if ( $type eq '||' ) {
+ elsif ( $type eq '||' ) {
push @{ $rand_or_list[$depth][2] }, $i;
++$has_old_logical_breakpoints[$depth]
if ( ( $i == $i_line_start || $i == $i_line_end )
&& $rOpts_break_at_old_logical_breakpoints );
- } ## end if ( $type eq '||' )
+ } ## end elsif ( $type eq '||' )
elsif ( $type eq '&&' ) {
push @{ $rand_or_list[$depth][3] }, $i;
++$has_old_logical_breakpoints[$depth]