WWW::Scripter::WindowGroup - Multiple-window browsing environment
use WWW'Scripter'WindowGroup;
$browser = new WWW'Scripter'WindowGroup;
# This has one window already
# OR:
$browser = new WWW'Scripter'WindowGroup empty => 1;
$browser->attach($w = new WWW'Scripter);
$w = $browser->active_window;
$w->get('http://ghare.dr/');
$w->close;
$w = $browser->new_window;
@w = $browser->windows;
This module provides a virtual multiple-window browsing environment for
WWW::Scripter. It does not actually create any windows on the screen, but it
can be used to script websites that make use of multiple windows. The
individual windows themselves are WWW::Scripter objects.
Before you start using this, consider whether the site you are
scripting actually needs multiple windows. If a single-window
environment will do, use WWW::Scripter directly.
Note: Window groups hold strong references to their windows, but
the windows themselves hold weak references to the window group. So if you
let a window group go out of scope while retaining a reference to a window,
that window will revert to single-window mode.
- new
- The constructor. Call this method on the class, not on an object thereof.
It takes no arguments.
- active_window
- Returns the window that is currently 'active'. This can be changed by
scripts calling the "focus" method on a
window, or opening a new one, so keep your own reference to it if you need
to refer to a specific window repeatedly.
- windows
- Returns a list of all windows in list context, or the number of windows in
scalar context.
- new_window
- Adds a new WWW::Scripter to the window group and returns it.
- attach ($window)
- This methods adds a window to the group, making it the frontmost window
and setting its "window_group" attribute
appropriately.
If you attach a window that is already attached to another
group, strange things may happen. Detach it first.
- detach ($window)
- This removes the window from the group and sets its
"window_group" attribute to
"undef". This is used internally by
WWW::Scripter's "close" method.
- bring_to_front ($window)
- This makes $window the active window.