aboutsummaryrefslogtreecommitdiff
path: root/lib/Music/Lyrics/LRC.pm
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-11-01 23:57:26 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-11-01 23:57:38 +1300
commita7b17c9bc0bf6f8789d9672193e622bd7bed0d9e (patch)
tree40b4d4262c80f71272c837f3821b40542fe37a70 /lib/Music/Lyrics/LRC.pm
parentAdd very basic test suite (diff)
downloadMusic-Lyrics-LRC-a7b17c9bc0bf6f8789d9672193e622bd7bed0d9e.tar.gz
Music-Lyrics-LRC-a7b17c9bc0bf6f8789d9672193e622bd7bed0d9e.zip
Backport some patterns to work with 5.6.2
Diffstat (limited to 'lib/Music/Lyrics/LRC.pm')
-rw-r--r--lib/Music/Lyrics/LRC.pm12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Music/Lyrics/LRC.pm b/lib/Music/Lyrics/LRC.pm
index becbfb2..e156ab5 100644
--- a/lib/Music/Lyrics/LRC.pm
+++ b/lib/Music/Lyrics/LRC.pm
@@ -30,7 +30,7 @@ our %RE = (
\A # Start of string
\s* # Any whitespace
\[ # Opening left bracket
- ([^:\v]+) # Tag name, capture
+ ([^:\r\n]+) # Tag name, capture
: # Colon
(.*) # Tag value, capture
\] # Closing right bracket
@@ -49,7 +49,7 @@ our %RE = (
[.] # Period
(\d{2}) # Hundredths of a second, capture
\] # Closing right bracket
- \h* # Any horizontal whitespace
+ [\t ]* # Any tabs or spaces
(.*\S) # Lyric line, capture
\s* # Any whitespace
\z # End of string
@@ -112,7 +112,7 @@ sub add_lyric {
# Check parameters
int $time >= 0
or croak 'Bad lyric time';
- $text !~ m/ \v /msx
+ $text !~ m/ \r\n /msx
or croak 'Bad lyric line';
# Push the lyric onto our list
@@ -128,11 +128,11 @@ sub set_tag {
my ( $self, $name, $value ) = @_;
# Check parameters
- $name !~ m/ [:\v] /msx
+ $name !~ m/ [:\r\n] /msx
or croak 'Bad tag name';
# Tag content cannot have vertical whitespace
- $value !~ m/ \v /msx
+ $value !~ m/ \r\n /msx
or croak 'Bad tag value';
# Set the tag's value on our hash
@@ -144,7 +144,7 @@ sub unset_tag {
my ( $self, $name ) = @_;
# Check parameters
- $name !~ m/ [:\v] /msx
+ $name !~ m/ [:\r\n] /msx
or croak 'Bad tag name';
exists $self->{tags}{$name}
or carp 'Tag not set';