Use CGI::Cookie::XS instead of using the C-based HTTP Cookie parser. This will simplify the process of parsing cookies and save time by improving performance while consuming minimal resources.
With Cookie::XS, you can easily parse a raw cookie string and obtain a structured result based on the key-value pairs. Here is an example of how you can use the parse method:
```
use Cookie::XS;
my $raw_cookie = 'foo=a phrase; haha; bar=yes, a phrase; baz=^wibble&leiyh; qux=';
my $res = Cookie::XS->parse($raw_cookie);
```
The $res variable will hold a hash reference that contains the parsed key-value pairs as arrays. For instance, for the input above, the result would be something like this:
```
{
'bar' => [
'yes, a phrase'
],
'baz' => [
'^wibble',
'leiyh'
],
'foo' => [
'a phrase'
],
'qux' => [
''
]
}
```
Alternatively, you can directly fetch cookies from the CGI environment using the fetch method:
```
$res = Cookie::XS->fetch;
```
Overall, if you need to work with cookies in your C-based project, Cookie::XS is a solid option to consider. However, do keep in mind the recommendation to use CGI::Cookie::XS instead.
Version 0.11: N/A