File Coverage

/.cpan/build/MOP-1.00-B2YG7M/blib/lib/MOP/MetaModule.pm
Criterion Covered Total %
statement 11 14 78.5
branch 1 4 25.0
condition 1 3 33.3
subroutine 3 4 75.0
pod 3 3 100.0
total 19 28 67.8


line stmt bran cond sub pod time code
1             ###########################################
2             # A Meta-Objects Protocol for Perl5 #
3             ###########################################
4             # (c) Rodolphe Ortalo, 1997-1998
5             #Included in the ESOPE project of LAAS-CNRS
6              
7             #$Id: MetaModule.pm,v 1.3 1999/02/10 15:16:41 ortalo Exp $
8              
9             package MOP::MetaModule;
10              
11 1     1   5 use strict;
  1         2  
  1         297  
12              
13             ##########################
14             # LOCAL CONSTANT SYMBOLS #
15             ##########################
16             my $DEBUG = 0;
17              
18             ##################
19             # META-METHODS #
20             ##################
21              
22             # Default implementation of meta-methods for sub-classes
23              
24             # We simply call the 'handle' meta-method
25             sub meta_method_call {
26 0     0 1 0 my $that = shift; # This is me ('m' for meta... :-)
27             # Same behavior if call for a base-class or base-object method
28 0 0       0 print STDERR "meta_method_call called for $_[0]\n" if $DEBUG;
29 0         0 $that->meta_handle_method_call(@_);
30             }
31              
32             # And this method calls the base-level method (aka. base-method)
33             sub meta_handle_method_call {
34 38     38 1 40 my $meta_that = shift;
35 38         42 my $base_method = shift;
36 38         38 my $base_that = shift;
37 38 50       71 print STDERR "meta_handle_method_call: calling $base_that->$base_method\n"
38             if $DEBUG;
39 38         87 $base_that->$base_method(@_);
40             }
41              
42             #############
43             # METHODS #
44             #############
45              
46             # Creates a new (empty) meta-object from class or object
47             sub new {
48 5     5 1 7 my $self = shift;
49 5   33     21 my $type = ref($self) || $self;
50 5         16 return bless {}, $type;
51             }
52              
53             1; # Final true ending
54              
55             __END__