Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed small bug in Mojo::Command->get_all_data
  • Loading branch information
kraih committed Mar 28, 2012
1 parent f7e2f12 commit 5552c7e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,8 +1,9 @@
This file documents the revision history for Perl extension Mojolicious.

2.70 2012-03-27
2.70 2012-03-28
- Improved speed of version command by switching to the MetaCPAN API.
- Improved documentation.
- Fixed small bug in Mojo::Command->get_all_data.
- Fixed small bug in inflate command. (memowe)

2.69 2012-03-26
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/Command.pm
Expand Up @@ -68,7 +68,7 @@ sub get_all_data {

# Refresh or use cached data
my $d = do { no strict 'refs'; \*{"$class\::DATA"} };
return $CACHE->{$class} unless fileno $d;
return $CACHE->{$class} || {} unless fileno $d;
seek $d, 0, 0;
my $content = join '', <$d>;
close $d;
Expand Down Expand Up @@ -96,7 +96,7 @@ sub get_all_data {

sub get_data {
my ($self, $data, $class) = @_;
($self->get_all_data($class) || {})->{$data};
$self->get_all_data($class)->{$data};
}

# "You don’t like your job, you don’t strike.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Command/inflate.pm
Expand Up @@ -13,7 +13,7 @@ sub run {
# Find all embedded files
my $all = {};
my $app = $self->app;
$all = {%{$self->get_all_data($_) || {}}, %$all}
$all = {%{$self->get_all_data($_)}, %$all}
for @{$app->renderer->classes}, @{$app->static->classes};

# Turn them into real files
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Renderer.pm
Expand Up @@ -211,7 +211,7 @@ sub _data_templates {
return $self->{data_templates} if $self->{data_templates};
for my $class (reverse @{$self->classes}) {
$self->{data_templates}->{$_} = $class
for keys %{Mojo::Command->new->get_all_data($class) || {}};
for keys %{Mojo::Command->new->get_all_data($class)};
}
return $self->{data_templates} ||= {};
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Static.pm
Expand Up @@ -149,7 +149,7 @@ sub _get_data_file {
$self->{data_files} = {};
for my $class (reverse @{$self->classes}) {
$self->{data_files}->{$_} = $class
for keys %{Mojo::Command->new->get_all_data($class) || {}};
for keys %{Mojo::Command->new->get_all_data($class)};
}
}

Expand Down

0 comments on commit 5552c7e

Please sign in to comment.