Revision acfaa946
Von Sven Schöling vor fast 8 Jahren hinzugefügt
SL/Presenter.pm | ||
---|---|---|
149 | 149 |
return SL::Presenter::EscapedText->new(text => $text, is_escaped => 1); |
150 | 150 |
} |
151 | 151 |
|
152 |
my %dispatch = ( |
|
153 |
invoice => 'SL::Presenter::Invoice', |
|
154 |
gl_transaction => 'SL::Presenter::GLTransaction', |
|
155 |
purchase_invoice => 'SL::Presenter::PurchaseInvoice', |
|
156 |
|
|
157 |
); |
|
158 |
|
|
159 |
sub AUTOLOAD { |
|
160 |
our $AUTOLOAD; |
|
161 |
my $method = $AUTOLOAD; |
|
162 |
|
|
163 |
return if $method eq 'DESTROY'; |
|
164 |
|
|
165 |
if ($dispatch{$method}) { |
|
166 |
eval "require $dispatch{$method}" or die; |
|
167 |
return $dispatch{$method}; |
|
168 |
} |
|
169 |
|
|
170 |
die "method '$method' not found"; |
|
171 |
} |
|
172 |
|
|
152 | 173 |
1; |
153 | 174 |
|
154 | 175 |
__END__ |
Auch abrufbar als: Unified diff
Presenter: AUTOLOAD um auf SubPresenter zu dispatchen