projects
/
catagits/CatalystX-Declare.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
encutened examples
[catagits/CatalystX-Declare.git]
/
examples
/
MyApp-Web
/
lib
/
MyApp
/
Web
/
Model
/
Calc.pm
1
use CatalystX::Declare;
2
3
model MyApp::Web::Model::Calc {
4
5
method op (Str $op) {
6
7
if ($op eq 'add') {
8
return sub {
9
my $num = shift;
10
$num += $_
11
for @_;
12
return $num;
13
};
14
}
15
elsif ($op eq 'multiply') {
16
return sub {
17
my $num = shift;
18
$num *= $_
19
for @_;
20
return $num;
21
};
22
}
23
else {
24
return sub { 'unknown operator' };
25
}
26
}
27
}