]>
git.proxmox.com Git - perlmod.git/blob - test.pl
10 my $v = RSPM
::Bless-
>new("Hello");
12 my ($a, $b, $c) = $v->multi_return();
13 say "Got ($a, $b, $c)";
14 my @ret = $v->multi_return();
15 say "Got: ".scalar(@ret)." values: @ret";
19 my $param = { a
=> 1 };
21 print "These should be called with a valid substr:\n";
22 RSPM
::Foo142
::test
(substr($s, 3, 3));
23 RSPM
::Foo142
::teststr
(substr($s, 3, 3));
24 print "Parameter exists: " . (exists($param->{x
}) ?
"YES" : "NO") . "\n";
25 RSPM
::Foo142
::test
($param->{x
});
26 print "Was auto-vivified: " . (exists($param->{x
}) ?
"YES" : "NO") . "\n";
27 RSPM
::Foo142
::teststr
($param->{x
});
29 my $a = "Can I have some coffee please?\n";
31 my $b = RSPM
::Foo142
::test_serde
($a);
33 my $c = RSPM
::Foo142
::test_serde
($b);
37 binmode STDOUT
, ':utf8';
38 my $a = "Can I have some ☕ please?\n";
40 my $b = RSPM
::Foo142
::test_serde
($a);
42 my $c = RSPM
::Foo142
::test_serde
($b);
48 my $state = $param->{tristate
};
49 $state = int($state) if defined($state);
52 if (defined($state)) {
53 $a = $state ?
"Some(true)" : "Some(false)";
58 my $b = RSPM
::Option
::to_string
($state);
59 my $c = RSPM
::Option
::struct_to_string
({ 'tristate' => $state });
66 to_string
({ 'tristate' => '0' });
67 to_string
({ 'tristate' => '1' });
68 to_string
({ 'tristate' => undef });