WWW::Mechanize::Plugin::Display - Display WWW::Mechanize results in a local web browser.


WWW-Mechanize-Plugin-Display documentation Contained in the WWW-Mechanize-Plugin-Display distribution.

Index


Code Index:

NAME

Top

WWW::Mechanize::Plugin::Display - Display WWW::Mechanize results in a local web browser.

SYNOPSIS

Top

  use WWW::Mechanize;
  use WWW::Mechanize::Plugin::Display;

  my $mech = WWW::Mechanize->new;
  $mech->get('http://www.google.com');
  $mech->display;

DESCRIPTION

Top

When you get an unexpected result while using WWW::Mechanize, it can be useful to inspect the current page that Mechanize has fetched in a local browser.

This plugin adds a method for that, depending on HTML::Display for most of the work.

It should work with WWW::Mechanize, or any sub-class of it.

display()

    $mech->display();

Display the current HTML content in a local browser.

A quick example of setting a preferred browser:

 PERL_HTML_DISPLAY_COMMAND=w3m -T text/html %s

See HTML::Display for configuration details.

AUTHOR

Top

	Mark Stosberg C<< mark@summersault.com >>

COPYRIGHT

Top

SEE ALSO

Top

perl(1).


WWW-Mechanize-Plugin-Display documentation Contained in the WWW-Mechanize-Plugin-Display distribution.
package WWW::Mechanize::Plugin::Display;
use strict;

BEGIN {
	use Exporter ();
	use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
	$VERSION     = '1.01';
	@ISA         = qw (Exporter);
	#Give a hoot don't pollute, do not export more than needed by default
	@EXPORT      = qw ();
	@EXPORT_OK   = qw ();
	%EXPORT_TAGS = ();
}

sub WWW::Mechanize::display {
    my $mech = shift;

    require HTML::Display;
    my $browser = HTML::Display->new();
    $browser->display(
        html     => $mech->content(), 
        location => $mech->uri(),
    );

}

1; #this line is important and will help the module return a true value