Skip to content

Commit

Permalink
made content parser code a little more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 19, 2012
1 parent 353b6d3 commit fb01720
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/Mojo/Content/MultiPart.pm
Expand Up @@ -190,7 +190,8 @@ sub _parse_multipart_boundary {
substr $self->{multipart}, 0, length($boundary) + 6, '';

# New part
$self->emit(part => my $part = Mojo::Content::Single->new(relaxed => 1));
my $part = Mojo::Content::Single->new(relaxed => 1);
$self->emit(part => $part);
push @{$self->parts}, $part;
return $self->{multi_state} = 'multipart_body';
}
Expand Down
3 changes: 2 additions & 1 deletion lib/Mojo/Content/Single.pm
Expand Up @@ -54,7 +54,8 @@ sub parse {
# Content needs to be upgraded to multipart
if ($self->auto_upgrade && defined($self->boundary)) {
$self->unsubscribe(read => $self->{read});
$self->emit(upgrade => my $multi = Mojo::Content::MultiPart->new($self));
my $multi = Mojo::Content::MultiPart->new($self);
$self->emit(upgrade => $multi);
return $multi->parse;
}

Expand Down

0 comments on commit fb01720

Please sign in to comment.