Skip to content

Commit

Permalink
link to GitHub from feature FAQ answer
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 26, 2012
1 parent 5e82fb2 commit e7cb50a
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 41 deletions.
6 changes: 3 additions & 3 deletions lib/Mojo/DOM.pm
Expand Up @@ -76,7 +76,7 @@ sub attrs {

sub charset {
my $self = shift;
return $self->[0]->charset if @_ == 0;
return $self->[0]->charset unless @_;
$self->[0]->charset(shift);
return $self;
}
Expand Down Expand Up @@ -289,7 +289,7 @@ sub to_xml { shift->[0]->render }

sub tree {
my $self = shift;
return $self->[0]->tree if @_ == 0;
return $self->[0]->tree unless @_;
$self->[0]->tree(shift);
return $self;
}
Expand All @@ -312,7 +312,7 @@ sub type {
# "I want to set the record straight, I thought the cop was a prostitute."
sub xml {
my $self = shift;
return $self->[0]->xml if @_ == 0;
return $self->[0]->xml unless @_;
$self->[0]->xml(shift);
return $self;
}
Expand Down
19 changes: 8 additions & 11 deletions lib/Mojo/Message.pm
Expand Up @@ -85,9 +85,7 @@ sub body_params {

# Formdata
for my $data (@$formdata) {
my $name = $data->[0];
my $filename = $data->[1];
my $value = $data->[2];
my ($name, $filename, $value) = @$data;

# File
next if defined $filename;
Expand Down Expand Up @@ -340,19 +338,18 @@ sub uploads {
# Extract formdata
my $formdata = $self->_parse_formdata;
for my $data (@$formdata) {
my $name = $data->[0];
my $filename = $data->[1];
my $part = $data->[2];
my ($name, $filename, $part) = @$data;

# Just a form value
next unless defined $filename;

# Uploaded file
my $upload = Mojo::Upload->new;
$upload->name($name);
$upload->asset($part->asset);
$upload->filename($filename);
$upload->headers($part->headers);
my $upload = Mojo::Upload->new(
name => $name,
asset => $part->asset,
filename => $filename,
headers => $part->headers
);
push @uploads, $upload;
}

Expand Down
12 changes: 3 additions & 9 deletions lib/Mojo/UserAgent/Transactor.pm
Expand Up @@ -120,8 +120,7 @@ sub form {
# Multipart content
my $content = Mojo::Content::MultiPart->new;
$headers->content_type('multipart/form-data');
$content->headers($headers);
$content->parts(\@parts);
$content->headers($headers)->parts(\@parts);

# Add content to transaction
$req->content($content);
Expand Down Expand Up @@ -202,16 +201,11 @@ sub redirect {
if ($code ~~ [301, 307]) {
return unless $req = $req->clone;
$new->req($req);
my $headers = $req->headers;
$headers->remove('Host');
$headers->remove('Cookie');
$headers->remove('Referer');
$req->headers->remove('Host')->remove('Cookie')->remove('Referer');
}
else { $method = 'GET' unless $method ~~ [qw/GET HEAD/] }
$new->req->method($method)->url($location);
$new->previous($old);

return $new;
return $new->previous($old);
}

# "If he is so smart, how come he is dead?"
Expand Down
3 changes: 1 addition & 2 deletions lib/Mojolicious/Commands.pm
Expand Up @@ -111,8 +111,7 @@ sub run {
my ($name, $description) = @$command;
print " $name" . (' ' x ($max - length $name)) . " $description";
}
print $self->hint;
return 1;
return print $self->hint;
}

sub start {
Expand Down
4 changes: 3 additions & 1 deletion lib/Mojolicious/Guides/FAQ.pod
Expand Up @@ -66,7 +66,9 @@ Probably not. While the L<Mojolicious> distribtion covers a wide range of
features, we are rather conservative when it comes to adding new ones. The
most important criteria are outlined in
L<Mojolicious::Guides::CodingGuidelines>. But don't let this discourage you,
asking doesn't hurt, just be prepared that it might not pass the vote.
it doesn't hurt to open a GitHub issue
(L<https://github.com/kraih/mojo/issues>) and ask, just be prepared that it
might not pass the vote.

=head2 What does the error "Maximum message size exceeded." mean?

Expand Down
23 changes: 8 additions & 15 deletions lib/Mojolicious/Static.pm
Expand Up @@ -46,9 +46,7 @@ sub dispatch {
# Serve static file
return unless $self->serve($c, join('/', @parts));
$stash->{'mojo.static'}++;
$c->rendered;

return 1;
return $c->rendered;
}

# DEPRECATED in Leaf Fluttering In Wind!
Expand Down Expand Up @@ -107,10 +105,9 @@ sub serve {
# Not modified
my $since = Mojo::Date->new($date)->epoch;
if (defined $since && $since == $modified) {
$res_headers->remove('Content-Type');
$res_headers->remove('Content-Length');
$res_headers->remove('Content-Disposition');
$res->code(304) and return 1;
$res_headers->remove('Content-Type')->remove('Content-Length')
->remove('Content-Disposition');
return $res->code(304);
}
}

Expand All @@ -127,20 +124,16 @@ sub serve {
}

# Not satisfiable
else { $res->code(416) and return 1 }
else { return $res->code(416) }
}
$asset->start_range($start);
$asset->end_range($end);
$asset->start_range($start)->end_range($end);

# Serve file
$res->code(200) unless $res->code;
$res->content->asset($asset);
$rel =~ /\.(\w+)$/;
$res_headers->content_type($c->app->types->type($1) || 'text/plain');
$res_headers->accept_ranges('bytes');
$res_headers->last_modified(Mojo::Date->new($modified));

return 1;
return $res_headers->content_type($c->app->types->type($1) || 'text/plain')
->accept_ranges('bytes')->last_modified(Mojo::Date->new($modified));
}

# "I like being a women.
Expand Down

0 comments on commit e7cb50a

Please sign in to comment.