views:

93

answers:

1

How can I configure WWW::Mechanize::Plugin::Display, so that the plug-in always opens a new window and not only a new tab?

+1  A: 

The module uses HTML::Display for opening a browser, which in turn uses the environment variable PERL_HTML_DISPLAY_COMMAND for determining the command for opening a browser. So, if you want to use Firefox, for example, you can set that variable to firefox -browser %s to force opening a new window.

http://search.cpan.org/~corion/HTML-Display-0.39/lib/HTML/Display.pm

EDIT: Sorry, this doesn't seem to work either. It opens a new empty window for each call to $mech->display, but also one tab for each call in which it then displays the content. Maybe you can find other command line options for Firefox or another browser that allows you to get the wanted behavior.

As an alternative you can configure your browser to always open new windows in new windows instead of new tabs (for Firefox: Preferences -> Tabs -> Open new windows in a new tab instead). If you want to keep that setting for your normal browsing, you can create an own profile for your Mechanize tests and add -P <your-test-profile> to your display command.

jkramer
You brought me on the right track. This works for me:>PERL_HTML_DISPLAY_COMMAND="/usr/bin/firefox -new-window %s"<
sid_com
How did you find the `-new-window` option? `firefox --help` doesn't show that option to me.
jkramer
man firefox (Linux/Terminal)
sid_com
Already tried, looks like my version of Firefox doesn't come with a manual. I found the manual via google though, thanks.
jkramer