| 1 | package HTML::Display::Win32::IE; | ||
| 2 | use strict; | ||
| 3 | use Carp qw(carp); | ||
| 4 | use parent 'HTML::Display::Win32::OLE'; | ||
| 5 | use vars qw($VERSION); | ||
| 6 | $VERSION='0.40'; | ||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | HTML::Display::Win32::IE - use IE to display HTML pages | ||
| 11 | |||
| 12 | =head1 SYNOPSIS | ||
| 13 | |||
| 14 | =for example begin | ||
| 15 | |||
| 16 | my $browser = HTML::Display->new( | ||
| 17 | class => 'HTML::Display::Dump', | ||
| 18 | ); | ||
| 19 | $browser->display("<html><body><h1>Hello world!</h1></body></html>"); | ||
| 20 | |||
| 21 | =for example end | ||
| 22 | |||
| 23 | This implementation avoids temporary files by using OLE to push | ||
| 24 | the HTML directly into the browser. | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | sub new { | ||
| 29 | my ($class) = @_; | ||
| 30 | my $self = $class->SUPER::new( app_string => "InternetExplorer.Application" ); | ||
| 31 | $self; | ||
| 32 | }; | ||
| 33 | |||
| 34 | sub setup { | ||
| 35 | my ($self,$control) = @_; | ||
| 36 | #warn "Setting up browser"; | ||
| 37 | $control->{'Visible'} = 1; | ||
| 38 | $control->Navigate('about:blank'); | ||
| 39 | }; | ||
| 40 | |||
| 41 | sub display_html { | ||
| 42 | my ($self,$html) = @_; | ||
| 43 | if ($html) { | ||
| 44 | my $browser = $self->control; | ||
| 45 | my $document = $browser->{Document}; | ||
| 46 | $document->open("text/html","replace"); | ||
| 47 | $document->write($html); | ||
| 48 | } else { | ||
| 49 | carp "No HTML given" unless $html; | ||
| 50 | }; | ||
| 51 | }; | ||
| 52 | |||
| 53 | =head1 AUTHOR | ||
| 54 | |||
| 55 | Copyright (c) 2004-2007 Max Maischein C<< <corion@cpan.org> >> | ||
| 56 | |||
| 57 | =head1 LICENSE | ||
| 58 | |||
| 59 | This module is released under the same terms as Perl itself. | ||
| 60 | |||
| 61 | =cut | ||
| 62 | |||
| 63 | 1; |