Skip to content

Instantly share code, notes, and snippets.

@Akron
Created March 13, 2013 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Akron/bf5405eabae8d3e590da to your computer and use it in GitHub Desktop.
Save Akron/bf5405eabae8d3e590da to your computer and use it in GitHub Desktop.
Multiple Header lines
my $headers = Mojo::Headers->new;
$headers->parse(<<'LINKS');
Link: <http://example.com/TheBook/chapter2>; rel="previous";
title="previous chapter"
Link: </>; rel="http://example.net/foo"
Link: </TheBook/chapter2>;
rel="previous"; title*=UTF-8'de'letztes%20Kapitel,
</TheBook/chapter4>;
rel="next"; title*=UTF-8'de'n%c3%a4chstes%20Kapitel
Link: <http://example.org/>;
rel="start http://example.net/relation/other"
LINKS
my @headers = $headers->header('link');
print $headers[0]->[0];
@Akron
Copy link
Author

Akron commented Mar 13, 2013

The print returns:
http://example.com/TheBook/chapter2; rel="previous"; title="previous chapter"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment