| 1 | package WWW::Mechanize::Plugin::Display; | ||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 1 | ▶ | BEGIN { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Exporter (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | $VERSION = '1.01'; | |
| 8 | 1 | @ISA = qw (Exporter); | |
| 9 | #Give a hoot don't pollute, do not export more than needed by default | ||
| 10 | 1 | @EXPORT = qw (); | |
| 11 | 1 | @EXPORT_OK = qw (); | |
| 12 | 1 | %EXPORT_TAGS = (); | |
| 13 | } | ||
| 14 | |||
| 15 | =head1 NAME | ||
| 16 | |||
| 17 | WWW::Mechanize::Plugin::Display - Display WWW::Mechanize results in a local web browser. | ||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | use WWW::Mechanize; | ||
| 22 | use WWW::Mechanize::Plugin::Display; | ||
| 23 | |||
| 24 | my $mech = WWW::Mechanize->new; | ||
| 25 | $mech->get('http://www.google.com'); | ||
| 26 | $mech->display; | ||
| 27 | |||
| 28 | =head1 DESCRIPTION | ||
| 29 | |||
| 30 | When you get an unexpected result while using WWW::Mechanize, it can be useful | ||
| 31 | to inspect the current page that Mechanize has fetched in a local browser. | ||
| 32 | |||
| 33 | This plugin adds a method for that, depending on L<HTML::Display> for most of | ||
| 34 | the work. | ||
| 35 | |||
| 36 | It should work with WWW::Mechanize, or any sub-class of it. | ||
| 37 | |||
| 38 | =head2 display() | ||
| 39 | |||
| 40 | $mech->display(); | ||
| 41 | |||
| 42 | Display the current HTML content in a local browser. | ||
| 43 | |||
| 44 | A quick example of setting a preferred browser: | ||
| 45 | |||
| 46 | PERL_HTML_DISPLAY_COMMAND=w3m -T text/html %s | ||
| 47 | |||
| 48 | See L<HTML::Display> for configuration details. | ||
| 49 | |||
| 50 | =cut | ||
| 51 | |||
| 52 | 0 | ▶ | sub WWW::Mechanize::display { |
|
Subroutine
display: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 53 | 0 | my $mech = shift; | |
| 54 | |||
| 55 | 0 | require HTML::Display; | |
| 56 | 0 | my $browser = HTML::Display->new(); | |
| 57 | 0 | $browser->display( | |
| 58 | html => $mech->content(), | ||
| 59 | location => $mech->uri(), | ||
| 60 | ); | ||
| 61 | |||
| 62 | } | ||
| 63 | |||
| 64 | =head1 AUTHOR | ||
| 65 | |||
| 66 | Mark Stosberg C<< mark@summersault.com >> | ||
| 67 | |||
| 68 | =head1 COPYRIGHT | ||
| 69 | |||
| 70 | This program is free software; you can redistribute | ||
| 71 | it and/or modify it under the same terms as Perl itself. | ||
| 72 | |||
| 73 | The full text of the license can be found in the | ||
| 74 | LICENSE file included with this module. | ||
| 75 | |||
| 76 | |||
| 77 | =head1 SEE ALSO | ||
| 78 | |||
| 79 | perl(1). | ||
| 80 | |||
| 81 | =cut | ||
| 82 | |||
| 83 | 1 | 1; #this line is important and will help the module return a true value | |