chandantul has asked for the wisdom of the Perl Monks concerning the following question:
Hello Team, I was trying to capture the "Link" value contains string "next" in order to do the pagination but i was unable to do the same as i was collecting from header-as-string from LWP request. How i can collect the "Link" value that contains "next"?
Please check my header contents as print value
Cache-Control: no-cache, no-store Connection: close Date: Fri, 26 Mar 2021 02:11:16 GMT Pragma: no-cache Server: nginx Vary: Accept-Encoding Content-Type: application/json Expires: 0 Client-Date: Fri, 26 Mar 2021 02:11:16 GMT Client-Peer: 10.10.1.32:8080 Client-Response-Num: 1 Client-Transfer-Encoding: chunked Expect-Ct: report-uri="https://org.extract.net", max-age=0 Link: <https://sso.myorg.com/api/v5/myids?limit=200>; rel="self" Link: <https://sso.myorg.com/api/v5/myids?after=200xxxxxxxxxxxxxxxxx&l +imit=200>; rel="next"
my code portion
use LWP; use LWP::UserAgent; $response1 = $response->headers_as_string; print "$response1\n";
Please check below portion that is blank
$linkheader = $response1=~m/Link/; print "$linkheader\n";
How i can collect the Link values from the data above?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl to collect "Link" values contains "next"
by Corion (Patriarch) on Mar 26, 2021 at 06:46 UTC | |
by chandantul (Scribe) on Mar 28, 2021 at 01:47 UTC | |
|
Re: Perl to collect "Link" values contains "next"
by hippo (Archbishop) on Mar 26, 2021 at 10:47 UTC | |
by parv (Parson) on Mar 27, 2021 at 01:06 UTC | |
|
Re: Perl to collect "Link" values contains "next"
by parv (Parson) on Mar 26, 2021 at 02:42 UTC |