⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.177
Server IP:
50.6.168.112
Server:
Linux server-617809.webnetzimbabwe.com 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.4.10
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
.cpan
/
build
/
YAML-LibYAML-0.89-0
/
t
/
View File Name :
code.t
use FindBin '$Bin'; use lib $Bin; use TestYAMLTests tests => 5; #------------------------------------------------------------------------------- my $sub = sub { return "Hi.\n" }; my $yaml = <<'...'; --- !!perl/code '{ "DUMMY" }' ... is Dump($sub), $yaml, "Dumping a code ref works produces DUMMY"; #------------------------------------------------------------------------------- $sub = sub { return "Bye.\n" }; bless $sub, "Barry::White"; $yaml = <<'...'; --- !!perl/code:Barry::White |- { use warnings; use strict; return "Bye.\n"; } ... use B::Deparse; if (new B::Deparse -> coderef2text ( sub { no strict; 1; use strict; 1; }) =~ 'refs') { $yaml =~ s/use strict/use strict 'refs'/g; } $YAML::XS::DumpCode = 1; is Dump($sub), $yaml, "Dumping a blessed code ref works (with B::Deparse)"; #------------------------------------------------------------------------------- $sub = sub { return "Bye.\n" }; bless $sub, "Barry::White"; $yaml = <<'...'; --- !!perl/code:Barry::White '{ "DUMMY" }' ... $YAML::XS::DumpCode = 0; is Dump($sub), $yaml, "Dumping a blessed code ref works (with DUMMY again)"; $yaml = <<'...'; --- !!perl/code:Barry::White |- { use warnings; use strict; return "Bye.\n"; } ... $YAML::XS::LoadCode = 0; $sub = Load($yaml); my $return = $sub->(); is($return, undef, "Loaded dummy coderef"); $YAML::XS::LoadCode = 1; $sub = Load($yaml); $return = $sub->(); cmp_ok($return, 'eq', "Bye.\n", "Loaded coderef");