File Coverage

lib/XML/XMetaL/Base.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             package XML::XMetaL::Base;
2            
3 2     2   31408 use 5.008;
  2         9  
  2         92  
4 2     2   11 use strict;
  2         4  
  2         71  
5 2     2   12 use warnings;
  2         17  
  2         81  
6            
7 2     2   1042 use Hash::Util qw(lock_keys);
  2         3042  
  2         16  
8 2     2   2345 use Win32::OLE;
  0            
  0            
9            
10             use XML::XMetaL::Utilities;
11            
12             use constant TRUE => 1;
13             use constant FALSE => 0;
14            
15            
16             sub new {
17             my ($class, %args) = @_;
18             my $self;
19             eval {
20             lock_keys(%args,qw(-application));
21             $self = bless {
22             _utilities => XML::XMetaL::Utilities->new(-application => $args{-application}),
23             }, ref($class) || $class;
24             lock_keys(%$self, keys %$self);
25             };
26             croak $@ if $@;
27             return $self;
28             }
29            
30             sub _get_application {$_[0]->_get_utilities()->get_application()}
31             sub _get_documents {$_[0]->_get_application()->{Documents}}
32             sub _get_active_document {$_[0]->_get_utilities()->get_active_document()}
33             sub _get_utilities {$_[0]->{_utilities}}
34            
35             # ======================================================================
36             # Default handlers
37             # ======================================================================
38            
39             our $AUTOLOAD;
40             sub AUTOLOAD {
41             my ($self, @args) = @_;
42             my ($class, $method) = $AUTOLOAD =~ /^(.*)::(.*)$/;
43             return if $method eq 'DESTROY';
44             no strict 'refs';
45             *{$AUTOLOAD} = sub {
46             my ($self) = @_;
47             my $application = $self->_get_application();
48             $application->SetStatusText("No handler implemented for $method events");
49             return $application->{DisplayAlerts};
50             };
51             $self->$method();
52             }
53            
54             1;
55             __END__