The standard module for this is HTTP::Cookies. You can use the any of the save, scan or as_string methods to extract cookie data from the jar depending on your requirements.
| [reply] [d/l] [select] |
hippo's response will be useful if you are doing all your interaction via Perl. However, if you need to extract a cookie from an existing browser session, you'll need to use browser-specific debugging tools. I usually use Firebug for Firefox.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
| [reply] |
I don't have experience with Firebug. I have worked with the
Firefox cookies DB, named amazingly enough cookies.sqlite in the Mozzila
file hierachy. SQLite is actually quite popular in many apps and all
smart phones have some form of it.
I use SQlite Manager
plug in to firefox. If you install that add-in, it will know how to find
the cookies SQL file and you can see what's there. Of course PERL DBI::SQLite works great.
Just an idea... Probably doesn't solve the OP's problem of session specific cookies, but this can show all the cookies.
| [reply] |
I love using SQLite and the associated Firefox plugins, but given the depth of experience suggested by the post, I figured the Firebug UI would greatly facilitate the OP's goal.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
| [reply] |
my $raw_cookies = $ENV{'HTTP_COOKIE'} || $ENV{'COOKIE'} || '';
| [reply] [d/l] |
You can get all the cookies with the environment variable.
my $raw_cookies = $ENV{'HTTP_COOKIE'} || $ENV{'COOKIE'} || '';
Only if you happen to work with a CGI interface on the server side. On the client side, this will not work at all, and most other ways of interfacing with a webserver don't put cookies into the environment.
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
| [reply] [d/l] |
| [reply] |