File Coverage

blib/lib/XAO/DO/Embeddable.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 24 24 100.0


line stmt bran cond sub pod time code
1             =head1 NAME
2              
3             XAO::DO::Embeddable - recommended base object for XAO embeddable configs
4              
5             =head1 SYNOPSIS
6              
7             package XAO::DO::Foo::Config;
8             use strict;
9             use XAO::Objects;
10             use base XAO::Objects->load(objname => 'Embeddable');
11              
12             =head1 DESCRIPTION
13              
14             Provides set_base_config() and base_config() methods to embeddable
15             configs based on it.
16              
17             =head1 METHODS
18              
19             =over
20              
21             =cut
22              
23             ###############################################################################
24             package XAO::DO::Embeddable;
25 1     1   7 use strict;
  1         2  
  1         29  
26 1     1   5 use XAO::Objects;
  1         2  
  1         27  
27 1     1   6 use base XAO::Objects->load(objname => 'Atom');
  1         2  
  1         32  
28              
29 1     1   8 use vars qw($VERSION);
  1         5  
  1         241  
30             $VERSION=(0+sprintf('%u.%03u',(q$Id: Embeddable.pm,v 2.1 2005/01/13 22:34:34 am Exp $ =~ /\s(\d+)\.(\d+)\s/))) || die "Bad VERSION";
31              
32             ###############################################################################
33              
34             =item set_base_config ($)
35              
36             Called automatically with one argument -- reference to the configuration
37             object it is being embedded into.
38              
39             =cut
40              
41             sub set_base_config ($%) {
42 1     1 1 3 my ($self,$base)=@_;
43 1         2 $self->{_embedding_base_config}=$base;
44             }
45              
46             ###############################################################################
47              
48             =item base_config ($)
49              
50             Returns previously stored base config reference. Reason to have this
51             method is the following: methods of embedded configs are called in the
52             namespace of their own and common configuration object is not available
53             from them through normal @ISA relations.
54              
55             =cut
56              
57             sub base_config ($%) {
58 1     1 1 13 my $self=shift;
59 1         8 return $self->{_embedding_base_config};
60             }
61              
62             ###############################################################################
63             1;
64             __END__