line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Mechanize::Plugin::Display; |
2
|
1
|
|
|
1
|
|
238633
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
BEGIN { |
5
|
1
|
|
|
1
|
|
7
|
use Exporter (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
6
|
1
|
|
|
1
|
|
128
|
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
124
|
|
7
|
1
|
|
|
1
|
|
2
|
$VERSION = '1.01'; |
8
|
1
|
|
|
|
|
19
|
@ISA = qw (Exporter); |
9
|
|
|
|
|
|
|
#Give a hoot don't pollute, do not export more than needed by default |
10
|
1
|
|
|
|
|
2
|
@EXPORT = qw (); |
11
|
1
|
|
|
|
|
2
|
@EXPORT_OK = qw (); |
12
|
1
|
|
|
|
|
121
|
%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 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 for configuration details. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub WWW::Mechanize::display { |
53
|
0
|
|
|
0
|
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; #this line is important and will help the module return a true value |