Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1043495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:40:31+00:00 2026-05-16T15:40:31+00:00

I use WWW::Mechanize::Shell to test stuff. Since I didn’t managed to sign in on

  • 0

I use WWW::Mechanize::Shell to test stuff.
Since I didn’t managed to sign in on a web site I want to scrape, I thought I will use the browser cookie (chrome or firefox) for that specific website with the ‘cookie’ command WWW::Mechanize::Shell has.

The question is, Cookies usually stored in a single file, which is not good, how to get a cookie for only this specific site?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:40:32+00:00Added an answer on May 16, 2026 at 3:40 pm

    Why isn’t storing cookies in a file good?

    Since WWW::Mechanize is built on top of LWP::UserAgent, you handle cookies just like you do in LWP::UserAgent. You can make the cookie jar a file or an in-memory hash.

    If you don’t want to save the cookies in a file, use an empty hash reference when you construct the mech object:

     use WWW::Mechanize;
    
     my $mech = WWW::Mechanize->new( cookie_jar => {} );
    

    If you want to use a new file, make a new HTTP::Cookies object:

     use WWW::Mechanize;
    
     my $mech = WWW::Mechanize->new( 
         cookie_jar => HTTP::Cookies->new( file => "$ENV{HOME}/.cookies.txt" ) 
         );
    

    If you want to load a browser specific cookies file, use the right module for it:

     use WWW::Mechanize;
    
     my $mech = WWW::Mechanize->new( 
         cookie_jar => HTTP::Cookies::Netscape->new( file => $filename ) 
         );
    

    If you want no cookies at all, use undef explicitly:

     use WWW::Mechanize;
    
     my $mech = WWW::Mechanize->new( cookie_jar => undef );
    

    All of this is in the docs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to search content from a site using WWW::Mechanize but to be able
I am using WWW:Mechanize to try to login to a site. Code use WWW::Mechanize;
I'm trying to use WWW::Mechanize to extract some links from the HTML page using
Instead of www.example.com/author/xyz, I want to use www.example.com/artist/xyz. I was hoping it was as
use strict; use warnings; use Time::HiRes qw(sleep); use Test::WWW::Selenium; use Test::More no_plan; use Test::Exception;
For example to get the favicon of a site I can use http://www.google.com/s2/favicons?domain= and
use WWW::Mechanize; my $mech = WWW::Mechanize->new; $mech->get( $url ); say $mech->text; How could I
#!/usr/bin/perl use WWW::Mechanize; use Compress::Zlib; my $mech = WWW::Mechanize->new(); my $username = ; #fill
#!/usr/bin/perl -w use WWW::Mechanize; print $WWW::Mechanize::VERSION.\n; 1) run from Textmate : Can't locate WWW/Mechanize.pm
I want to process all links but external ones from the whole web site.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.