Alien has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks!

Is there any way to see the cookies that a WWW::Mechanize object has for a certain website ?
Thank you guys !
  • Comment on How can I view mechanize's current cookies?

Replies are listed 'Best First'.
Re: How can I view mechanize's current cookies?
by Joost (Canon) on Mar 07, 2008 at 18:53 UTC
Re: How can I view mechanize's current cookies?
by ForgotPasswordAgain (Vicar) on Mar 07, 2008 at 18:53 UTC
    WWW::Mechanize subclasses LWP::UserAgent. LWP::UserAgent has a cookie_jar method, which returns a HTTP::Cookies object.
Re: How can I view mechanize's current cookies?
by Fletch (Bishop) on Mar 07, 2008 at 19:00 UTC

    Mechanize isa LWP::UserAgent subclass, and that class provides a cookie_jar method that returns the associated HTTP::Cookies instance (or a subclass thereof). That (HTTP::Cookies) in turn provides a scan method which takes a callback that's passed information in turn for all the cookies in the jar.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.