lib/XML/XMetaL/Base.pm

filter: Statementstmt 85.7% 12 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 89.4% 17 / 19 CC 1 SCAR 0.6
CC
1
Cov
86%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« lib/XML/XMetaL/Registry.pm ↑ Summary lib/XML/XMetaL/Factory.pm »
1 package XML::XMetaL::Base;
2
3 2 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 2 ▶use Hash::Util qw(lock_keys);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 0 ▶use Win32::OLE;
Subroutine BEGIN: called CC=1 SCAR=2.6
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__
« lib/XML/XMetaL/Registry.pm ↑ Summary lib/XML/XMetaL/Factory.pm »