Skip to content

Commit

Permalink
small optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 10, 2013
1 parent cb7c669 commit ccf0745
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions lib/Mojo/Home.pm
Expand Up @@ -49,10 +49,7 @@ sub lib_dir {
sub list_files {
my ($self, $dir) = @_;

# Files relative to directory
my $parts = $self->{parts} || [];
my $root = catdir @$parts;
$dir = catdir $root, split '/', ($dir || '');
$dir = catdir @{$self->{parts} || []}, split '/', ($dir // '');
return [] unless -d $dir;
my @files;
find {
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/JSON.pm
Expand Up @@ -75,7 +75,7 @@ sub decode {
# Object
elsif (m/\G\{/gc) { $ref = _decode_object() }

# Unexpected
# Invalid character
else { _exception('Expected array or object') }

# Leftover data
Expand Down Expand Up @@ -169,7 +169,7 @@ sub _decode_string {
m!\G((?:(?:[^\x00-\x1f\\"]|\\(?:["\\/bfnrt]|u[0-9a-fA-F]{4})){0,32766})*)!gc;
my $str = $1;

# Missing quote
# Invalid character
unless (m/\G"/gc) {
_exception('Unexpected character or invalid escape while parsing string')
if m/\G[\x00-\x1f\\]/;
Expand Down Expand Up @@ -244,7 +244,7 @@ sub _decode_value {
# Null
return undef if m/\Gnull/gc;

# Invalid data
# Invalid character
_exception('Expected string, array, object, number, boolean or null');
}

Expand Down

0 comments on commit ccf0745

Please sign in to comment.