in reply to Downloads in firefox using perl WWW::Mechanize::Firefox

Hello pawaniitd,

Welcome to the monastery. Did you have a look at the manual to see if you missed anything? YOu want a new tab to be opened everytime you invoke the new constructor. Have a look at the list of options detailed in the manual here - Do they tell you anything? :-)

PS: Skills are gained not by running out at the first failure, but by patience and tenacity. Read manuals, code - gather as much as you can. Once again, welcome and have fun!

Replies are listed 'Best First'.
Re^2: Downloads in firefox using perl WWW::Mechanize::Firefox
by pawaniitd (Initiate) on Mar 11, 2014 at 11:51 UTC

    Hello robby_dobby,

    I have already read the manual and have been trying various options to get over the problem. The problem is not opening a new tab. I have no problem in opening a new tab, when i set Firefox's default behavior to handle PDF as 'view in Firefox' or 'View in adobe reader'. The problem arises when i set it to 'Save link' and assign a folder to download files.

    What happens in this case is that the runs the loop first time and loads the page and firefox downloads the file, and the programs just pauses there and never proceeds forward. If i add a print "reached"; statement after $mech->get() function, i do not see any output.

    I want to understand why this happens

      Are you running this behind a proxy? Chances are, your firefox got stuck when trying to resolve the url you're downloading, with that proxy and failed to authenticate your credentials. Why not use WWW::Mechanize? I'm pretty sure it has some options for proxy authentication.

        I solved the problem. I realized that the $mech->get() function might be waiting for the page to load. But as i set Firefox to download the file automatically, there was no page being loaded. Thus, i set the function to not wait for response from browser and it worked.

        I thank you for helping me out. As this was my first post i made some error in reporting the problem and the code. Next time i will try to frame the question better.