Bloehdian has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
the following script should send an http-request to httpbin.org. But it fails with the creation of the proper request string, probably since the script interprets it as a sequence of namespaces separated in the old style using apostrophe. What am I doing wrong?
#!/usr/bin/perl use strict; use REST::Client; my $client = REST::Client->new(); my $request=q{DELETE('https://www.httpbin.org/delete')}; print $request; eval( $client->$request ); print $client->responseCode();
Execution leads to the following
Can't locate object method ")" via package "DELETE('https://www.httpbin.org/delete" (perhaps you forgot to load "DELETE('https://www.httpbin.org/delete"?) at test.pl line 7.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem creating http request string using apostrophe
by LanX (Saint) on Dec 14, 2017 at 00:49 UTC |