in reply to How to close the default browser in perl

hello,
some notes; open_browser is not a builtin, is part of Browser::Open and this module seems able to guess which command execute (via system) and expose such command via his function open_browser_cmd. It seems to me that such module is a bit old/unmaintained/abandoned and if you look at source code it does a very little work. that said that module seems to have only few errors in compatibility matrix (also the module tests are very simple) so you can easily spot the right browser's command (by your own or using the module) and open that process storing the associated PID, with the PID you can kill the program at your will.

HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: How to close the default browser in perl
by Corion (Patriarch) on Jan 19, 2015 at 08:29 UTC

    Note that killing the browser process will likely also kill all other browser windows and browser tabs that are currently open. A user might not be amused if a program does stuff like that.

      yes, of course. This may heavely depends on th OS, i think. in win7 for example there is a PID for every tab open and if you kill such PID the tab only goes in error if is a tab in a group. if you close a 'main' window via kill you kill all windows at same time, and is not a nice thing.

      Please ppp note that 'default browser' is only a facility of an OS not a Perl concept.

      L*
      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
        Hey hii, Isn't it possible to write a script for Alt +F4 ?