Browse Source

* Subtitle::Utils : minor optimizations

master
Alex 'AdUser' Z 6 years ago
parent
commit
f2d257510e
  1. 12
      lib/Subtitle/Utils.pm

12
lib/Subtitle/Utils.pm

@ -16,11 +16,11 @@ our %EXPORT_TAGS = (
timing => [qw(make_timing parse_timing)],
);
## string sunctions
## string functions
sub chomp_all {
return unless @_;
return $_ =~ s/[\r\n]+$//o for @_;
return unless $_[0];
$_[0] =~ s/[\r\n]+$//o;
}
sub strip_bom {
@ -29,8 +29,8 @@ sub strip_bom {
}
sub trim {
return unless @_;
$_ =~ s/(^\s+|\s+$)//go for @_;
return unless $_[0];
$_[0] =~ s/(^\s+|\s+$)//go;
}
## timing functions
@ -101,9 +101,9 @@ Subtitle::Utils -- usefull generic routines
=head2 C<chomp_all>
chomp($line);
chomp($line1, $line2);
In-place strips newlines (CR/LF) from line.
Differs from standart chomp() than strips '\r', '\n' and it's combinaion, disregarding $/
=head2 C<strip_bom>

Loading…
Cancel
Save