]>
git.proxmox.com Git - perlmod.git/blob - test.pl
12 my $v = RSPM
::Bless-
>new("Hello");
14 $v->something_nonraw();
15 my ($a, $b, $c) = $v->multi_return();
16 say "Got ($a, $b, $c)";
17 my @ret = $v->multi_return();
18 say "Got: ".scalar(@ret)." values: @ret";
22 my $param = { a
=> 1 };
24 print "These should be called with a valid substr:\n";
25 RSPM
::Foo142
::test
(substr($s, 3, 3));
26 RSPM
::Foo142
::teststr
(substr($s, 3, 3));
27 print "Parameter exists: " . (exists($param->{x
}) ?
"YES" : "NO") . "\n";
28 RSPM
::Foo142
::test
($param->{x
});
29 print "Was auto-vivified: " . (exists($param->{x
}) ?
"YES" : "NO") . "\n";
30 RSPM
::Foo142
::teststr
($param->{x
});
32 my $a = "Can I have some coffee please?\n";
34 my $b = RSPM
::Foo142
::test_serde
($a);
36 my $c = RSPM
::Foo142
::test_serde
($b);
40 binmode STDOUT
, ':utf8';
41 my $a = "Can I have some ☕ please?\n";
43 my $b = RSPM
::Foo142
::test_serde
($a);
45 my $c = RSPM
::Foo142
::test_serde
($b);
51 my $state = $param->{tristate
};
52 $state = int($state) if defined($state);
55 if (defined($state)) {
56 $a = $state ?
"Some(true)" : "Some(false)";
61 my $b = RSPM
::Option
::to_string
($state);
62 my $c = RSPM
::Option
::struct_to_string
({ 'tristate' => $state });
69 to_string
({ 'tristate' => '0' });
70 to_string
({ 'tristate' => '1' });
71 to_string
({ 'tristate' => undef });
73 my $ref1 = { x
=> "x was stored" };
74 my $ref2 = RSPM
::Foo142
::test_refs
({ copied
=> "copied string", reference
=> $ref1 });
75 print($ref1->{x
}, "\n");
76 $ref2->{x
} = "x was changed";
77 print($ref1->{x
}, "\n");