#!perl
sub
Burlap::fun (&) {
$_
[0]->() }
{
is fun { 2 + 2 }->(), 4;
::ok fun { 0 };
}
{
::is fun {
'singing'
},
'singing'
;
}
{
sub
proc (&) {
&Burlap::fun
}
proc add(
$x
,
$y
) {
return
$x
+
$y
;
}
is add(@{[2, 3]}), 5;
{
is proc () {
'bla'
}->(),
'bla'
;
is method () {
$self
}->(
'der'
),
'der'
;
{
no
Function::Parameters;
is proc {
'unk'
},
'unk'
;
is
eval
(
'fun foo($x) { $x; } 1'
),
undef
;
like $@,
qr/syntax error/
;
}
is proc () {
'bla'
}->(),
'bla'
;
is method () {
$self
}->(
'der'
),
'der'
;
no
Function::Parameters
'proc'
;
is proc {
'unk2'
},
'unk2'
;
is method () {
$self
}->(
'der2'
),
'der2'
;
}
is proc () {
'bla3'
}->(),
'bla3'
;
is
eval
(
'fun foo($x) { $x; } 1'
),
undef
;
like $@,
qr/syntax error/
;
}