>See HTTP::Headers. Don't convert them to a string and then try to parse out the >Link, but access it directly, using the ->header() method:
#!perl use warnings; use strict; use HTTP::Headers; use 5.012; my $headers = HTTP::Headers->new(); $headers->header( '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="se +lf"', 'Link' => '<https://sso.myorg.com/api/v5/myids?after=200xxxxxxxxxx +xxxxxxx&limit=200>; rel="next"', ); say "Found link headers:"; for my $h ( $headers->header('Link') ) { if( $h =~ /\brel="next"/ ) { say "Found 'next' link: $h"; } else { say "Ignoring other Link header: $h"; }; }; __END__ Found link headers: Ignoring other Link header: <https://sso.myorg.com/api/v5/myids?limit= +200>; rel="self" Found 'next' link: <https://sso.myorg.com/api/v5/myids?after=200xxxxxx +xxxxxxxxxxx&limit=200>; rel="next"
In reply to Re: Perl to collect "Link" values contains "next"
by Corion
in thread Perl to collect "Link" values contains "next"
by chandantul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |