File: SCALAR.t

package info (click to toggle)
libcontextual-return-perl 0.003001-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 324 kB
  • ctags: 52
  • sloc: perl: 1,187; makefile: 2
file content (13 lines) | stat: -rw-r--r-- 424 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
use Contextual::Return;
use Test::More 'no_plan';

sub foo {
    return
        SCALAR   { 86 }
        VALUE    { 42, 99 }
}

is_deeply \@{foo()}, [42,99]                    => 'ARRAYREF from NONVOID';
is ${foo()}+0, 86                               => 'NUMERIC from SCALAR';
is "${foo()}", '86'                             => 'STRING from SCALAR';
is "@{foo()}", '42 99'                          => 'STRING from NONVOID';