Skip to content

Commit

Permalink
use xdigit character class -- fix #100
Browse files Browse the repository at this point in the history
  • Loading branch information
moregan authored and wchristian committed Nov 21, 2014
1 parent fb8f80e commit a212df0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/PPI/Cache.pm
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ sub _md5hex {
my $it = _SCALAR($_[0])
? PPI::Util::md5hex(${$_[0]})
: $_[0];
return (defined $it and ! ref $it and $it =~ /^[a-f0-9]{32}\z/si)
return (defined $it and ! ref $it and $it =~ /^[[:xdigit:]]{32}\z/s)
? lc $it
: undef;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PPI/Token/Number/Hex.pm
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ sub __TOKENIZER__on_char {
# Allow underscores straight through
return 1 if $char eq '_';

if ( $char =~ /[\da-f]/i ) {
if ( $char =~ /[[:xdigit:]]/ ) {
return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion t/19_selftesting.t
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ is_deeply( $bad, [ 'Bad::Class1', 'Bad::Class2', 'Bad::Class3', 'Bad::Class4' ],
foreach my $file ( @files ) {
# MD5 the raw file
my $md5a = PPI::Util::md5hex_file($file);
like( $md5a, qr/^[0-9a-f]{32}\z/, 'md5hex_file ok' );
like( $md5a, qr/^[[:xdigit:]]{32}\z/, 'md5hex_file ok' );

# Load the file
my $Document = PPI::Document->new($file);
Expand Down

0 comments on commit a212df0

Please sign in to comment.