| line | stmt | bran | cond | sub | pod | time | code |
| 1 | | | | | | | package HTML::Display::Win32::OLE; |
| 2 | | | | | | | use strict; |
| 3 | | | | | | | use parent 'HTML::Display::Common'; |
| 4 | | | | | | | use vars qw($VERSION); |
| 5 | | | | | | | $VERSION='0.38'; |
| 6 | |
| 7 - 31 | | =head1 NAME
HTML::Display::Win32::OLE - use an OLE object to display HTML
=head1 SYNOPSIS
=for example begin
package HTML::Display::Win32::OleControl;
use parent 'HTML::Display::Win32::OLE';
sub new {
my $class = shift;
$class->SUPER::new( app_string => "FooBrowser.Application", @_ );
$self;
};
my $browser = HTML::Display->new(
class => 'HTML::Display::Win32::OleControl',
);
$browser->display("<html><body><h1>Hello world!</h1></body></html>");
=for example end
=cut |
| 32 | |
| 33 | | | | | | | sub new { |
| 34 | | | | | | | my ($class) = shift; |
| 35 | | | | | | | my %args = @_; |
| 36 | |
| 37 | | | | | | | my $self = $class->SUPER::new( %args ); |
| 38 | | | | | | | $self; |
| 39 | | | | | | | }; |
| 40 | |
| 41 - 47 | | =head2 setup
C<setup> is a method you can override to provide initial
setup of your OLE control. It is called after the control
is instantiated for the first time.
=cut |
| 48 | |
| 49 | | | | | | | sub setup {}; |
| 50 | |
| 51 - 57 | | =head2 control
This initializes the OLE control and returns it. Only one
control is initialized for each object instance. You don't need
to store it separately.
=cut |
| 58 | |
| 59 | | | | | | | sub control { |
| 60 | | | | | | | my $self = shift; |
| 61 | | | | | | | unless ($self->{control}) { |
| 62 | | | | | | | eval "use Win32::OLE"; |
| 63 | | | | | | | die $@ if $@; |
| 64 | | | | | | | my $control = Win32::OLE->CreateObject($self->{app_string}); |
| 65 | | | | | | | $self->{control} = $control; |
| 66 | | | | | | | $self->setup($control); |
| 67 | | | | | | | }; |
| 68 | | | | | | | $self->{control}; |
| 69 | | | | | | | }; |
| 70 | |
| 71 | | | | | | | 1; |