Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 Perl 的 Dancer 模块,如果您有一个“任何”方法(将匹配 get/post/put/delete),您如何确定浏览器使用的实际方法?
#!/usr/bin/perl use Dancer; my $instance = someclass->new(); any('/' => sub{ my $method = ??? my $params = params(); return($instance->$method($params)); });
我想这是
my $method = request->method;
尽管文档建议您尽可能使用以下内容(对您的一般代理/代表没有意义):
request->is_get(); request->is_post(); # etc . .