One Hat Cyber Team
Your IP :
216.73.216.84
Server IP :
50.6.229.107
Server :
Linux server.hostburly.com 5.14.0-611.38.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 10 17:21:28 EDT 2026 x86_64
Server Software :
Apache
PHP Version :
8.2.30
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
.cpan
/
build
/
JSON-4.10-0
/
t
/
Edit File:
20_unknown.t
use strict; use warnings; use Test::More; BEGIN { plan tests => 10 }; BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; } use JSON; my $json = JSON->new; eval q| $json->encode( [ sub {} ] ) |; ok( $@ =~ /encountered CODE/, $@ ); eval q| $json->encode( [ \-1 ] ) |; ok( $@ =~ /cannot encode reference to scalar/, $@ ); eval q| $json->encode( [ \undef ] ) |; ok( $@ =~ /cannot encode reference to scalar/, $@ ); eval q| $json->encode( [ \{} ] ) |; ok( $@ =~ /cannot encode reference to scalar/, $@ ); $json->allow_unknown; is( $json->encode( [ sub {} ] ), '[null]' ); is( $json->encode( [ \-1 ] ), '[null]' ); is( $json->encode( [ \undef ] ), '[null]' ); is( $json->encode( [ \{} ] ), '[null]' ); SKIP: { skip "this test is for Perl 5.8 or later", 2 if( $] < 5.008 ); $json->allow_unknown(0); my $fh; open( $fh, '>hoge.txt' ) or die $!; eval q| $json->encode( [ $fh ] ) |; ok( $@ =~ /encountered GLOB|cannot encode reference to scalar/, $@ ); $json->allow_unknown(1); is( $json->encode( [ $fh ] ), '[null]' ); close $fh; unlink('hoge.txt'); }
Simpan