Skip to content

Commit b6c08c6

Browse files
committed
Simplify method creation
1 parent 92a8bb9 commit b6c08c6

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/HTTP/Request/Common.pm

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,9 @@ my $CRLF = "\015\012"; # "\r\n" is not portable
2020
sub GET { _simple_req('GET', @_); }
2121
sub HEAD { _simple_req('HEAD', @_); }
2222
sub DELETE { _simple_req('DELETE', @_); }
23-
24-
for my $type (qw(PUT PATCH POST)) {
25-
no strict 'refs';
26-
*{ __PACKAGE__ . "::" . $type } = sub {
27-
return request_type_with_data($type, @_);
28-
};
29-
}
23+
sub PATCH { request_type_with_data('PATCH', @_); }
24+
sub POST { request_type_with_data('POST', @_); }
25+
sub PUT { request_type_with_data('PUT', @_); }
3026

3127
sub request_type_with_data
3228
{

0 commit comments

Comments
 (0)