X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=examples%2Fbreak_long_quotes.pl;h=ba40d9a51ec7172efd99436f20cbd75094adcd86;hb=7f0d4e4cf8cde72a1e9ea5c3ddc5fb71fc0d7651;hp=66c58a652abea41bcbca1c1d07c3ab28ad4f7c74;hpb=8aa69fbac36a21cad0a1c0d5b3452a546d427d7f;p=perltidy.git diff --git a/examples/break_long_quotes.pl b/examples/break_long_quotes.pl old mode 100644 new mode 100755 index 66c58a6..ba40d9a --- a/examples/break_long_quotes.pl +++ b/examples/break_long_quotes.pl @@ -51,12 +51,15 @@ sub scan_file { unless ($fh) { die "cannot open '$file': $!\n" } my $formatter = MyWriter->new($line_length); - perltidy( + my $err=perltidy( 'formatter' => $formatter, # callback object 'source' => $fh, - 'argv' => "-npro -se", # dont need .perltidyrc + 'argv' => "-npro -se", # don't need .perltidyrc # errors to STDOUT ); + if ($err){ + die "Error calling perltidy\n"; + } $fh->close(); } ## end sub scan_file @@ -88,11 +91,11 @@ sub write_line { my $line_of_tokens = shift; my $line_type = $line_of_tokens->{_line_type}; my $input_line_number = $line_of_tokens->{_line_number}; - my $input_line = $line_of_tokens->{_line_text}; # the orignal line - my $rtoken_type = $line_of_tokens->{_rtoken_type}; # type of tokens - my $rtokens = $line_of_tokens->{_rtokens}; # text of tokens + my $input_line = $line_of_tokens->{_line_text}; # the original line + my $rtoken_type = $line_of_tokens->{_rtoken_type}; # type of tokens + my $rtokens = $line_of_tokens->{_rtokens}; # text of tokens my $starting_in_quote = - $line_of_tokens->{_starting_in_quote}; # text of tokens + $line_of_tokens->{_starting_in_quote}; # text of tokens my $ending_in_quote = $line_of_tokens->{_ending_in_quote}; # text of tokens my $max_quote_length = $self->{_max_quote_length}; chomp $input_line; @@ -140,7 +143,7 @@ EOM $new_line .= $token; } ## end for ( my $j = 0 ; $j <=... - # substitude the modified line for the original line + # substitute the modified line for the original line $input_line = $new_line; } ## end if ( $line_type eq 'CODE')