2 |
## $Id$ |
## $Id$ |
3 |
## -------------------------------------------------------------------------------- |
## -------------------------------------------------------------------------------- |
4 |
## $Log$ |
## $Log$ |
5 |
|
## Revision 1.8 2003/02/14 14:20:05 joko |
6 |
|
## + modified mixin behaviour |
7 |
|
## |
8 |
## Revision 1.7 2003/02/11 10:34:19 joko |
## Revision 1.7 2003/02/11 10:34:19 joko |
9 |
## + loaded module may now lack 'mixin::with' declaration |
## + loaded module may now lack 'mixin::with' declaration |
10 |
## + this gets us the possibility to load modules from any perl namespace |
## + this gets us the possibility to load modules from any perl namespace |
166 |
#bless $self, $package; |
#bless $self, $package; |
167 |
|
|
168 |
# V2: |
# V2: |
169 |
|
$self->mixinPackage($package); |
170 |
|
|
171 |
|
if (my $method = $options->{method}) { |
172 |
|
$self->$method(); |
173 |
|
} |
174 |
|
|
175 |
|
return 1; |
176 |
|
|
177 |
|
} |
178 |
|
|
179 |
|
sub mixinPackage { |
180 |
|
my $self = shift; |
181 |
|
my $package = shift; |
182 |
|
|
183 |
# switch into foreign package and prepare for mixin |
# switch into foreign package and prepare for mixin |
184 |
$self->mixin_prepare($package); |
$self->mixin_prepare($package); |
185 |
|
|
186 |
# switch into local package (scope which uses DesignPattern::Bridge) and mixin plugin-module |
# switch into local package (scope which uses DesignPattern::Bridge) and mixin plugin-module |
187 |
$self->mixin_do($package); |
$self->mixin_do($package); |
188 |
|
|
|
if (my $method = $options->{method}) { |
|
|
$self->$method(); |
|
|
} |
|
|
|
|
|
return 1; |
|
|
|
|
189 |
} |
} |
190 |
|
|
191 |
# TODO: maybe refactor to DesignPattern::Object? what about the '$logger'? |
# TODO: maybe refactor to DesignPattern::Object? what about the '$logger'? |