| 1 | package HTML::Display::Win32::OLE; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use parent 'HTML::Display::Common'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | $VERSION='0.40'; | |||||||||
| 6 | |||||||||||
| 7 | =head1 NAME | ||||||||||
| 8 | |||||||||||
| 9 | HTML::Display::Win32::OLE - use an OLE object to display HTML | ||||||||||
| 10 | |||||||||||
| 11 | =head1 SYNOPSIS | ||||||||||
| 12 | |||||||||||
| 13 | =for example begin | ||||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | package HTML::Display::Win32::OleControl; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | use parent 'HTML::Display::Win32::OLE'; | ||||||||||
| 17 | 0 | ▶ | |||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||
| 18 | 0 | sub new { | |||||||||
| 19 | 0 | my $class = shift; | |||||||||
| 20 | 0 | $class->SUPER::new( app_string => "FooBrowser.Application", @_ ); | |||||||||
| 21 | $self; | ||||||||||
| 22 | }; | ||||||||||
| 23 | |||||||||||
| 24 | my $browser = HTML::Display->new( | ||||||||||
| 25 | class => 'HTML::Display::Win32::OleControl', | ||||||||||
| 26 | ); | ||||||||||
| 27 | $browser->display("<html><body><h1>Hello world!</h1></body></html>"); | ||||||||||
| 28 | |||||||||||
| 29 | =for example end | ||||||||||
| 30 | |||||||||||
| 31 | =cut | ||||||||||
| 32 | |||||||||||
| 33 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 34 | 0 | my ($class) = shift; | |||||||||
| 35 | 0 | my %args = @_; | |||||||||
| 36 | |||||||||||
| 37 | 0 | my $self = $class->SUPER::new( %args ); | |||||||||
| 38 | 0 | $self; | |||||||||
| 39 | }; | ||||||||||
| 40 | |||||||||||
| 41 | =head2 setup | ||||||||||
| 42 | |||||||||||
| 43 | C<setup> is a method you can override to provide initial | ||||||||||
| 44 | setup of your OLE control. It is called after the control | ||||||||||
| 45 | is instantiated for the first time. | ||||||||||
| 46 | |||||||||||
| 47 | =cut | ||||||||||
| 48 | |||||||||||
| 49 | 0 | ▶ | sub setup {}; | ||||||||
|
Subroutine
setup: not called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 50 | |||||||||||
| 51 | =head2 control | ||||||||||
| 52 | |||||||||||
| 53 | This initializes the OLE control and returns it. Only one | ||||||||||
| 54 | control is initialized for each object instance. You don't need | ||||||||||
| 55 | to store it separately. | ||||||||||
| 56 | |||||||||||
| 57 | =cut | ||||||||||
| 58 | |||||||||||
| 59 | 0 | ▶ | sub control { | ||||||||
|
Subroutine
control: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 60 | 0 | my $self = shift; | |||||||||
| 61 | 0 | ▶ | unless ($self->{control}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 0 | eval "use Win32::OLE"; | |||||||||
| 63 | 0 | ▶ | die $@ if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | 0 | my $control = Win32::OLE->CreateObject($self->{app_string}); | |||||||||
| 65 | 0 | $self->{control} = $control; | |||||||||
| 66 | 0 | $self->setup($control); | |||||||||
| 67 | }; | ||||||||||
| 68 | 0 | $self->{control}; | |||||||||
| 69 | }; | ||||||||||
| 70 | |||||||||||
| 71 | =head1 AUTHOR | ||||||||||
| 72 | |||||||||||
| 73 | Copyright (c) 2004-2007 Max Maischein C<< <corion@cpan.org> >> | ||||||||||
| 74 | |||||||||||
| 75 | =head1 LICENSE | ||||||||||
| 76 | |||||||||||
| 77 | This module is released under the same terms as Perl itself. | ||||||||||
| 78 | |||||||||||
| 79 | =cut | ||||||||||
| 80 | |||||||||||
| 81 | 1 | 1; | |||||||||