0
ˆ
ƒ`_•I|¥‰ÓMdœv ©ƒ&íK<óo¬¿Ã Ü
Index of /FSS-BCZ/root/sys/dev/char/4:29/subsystem/tty6/subsystem/tty51
Index of /FSS-BCZ/root/sys/dev/char/4:29/subsystem/tty6/subsystem/tty51
# ˆl–Ðz¾”*e¶…8 \¸'î6%1hßÂ
ƒt!ÁÀÄ Ï package JSON::Syck;
use strict;
use Exporter;
use YAML::Syck ();
our $VERSION = '1.47';
our @EXPORT_OK = qw( Load Dump LoadFile DumpFile DumpInto );
our @ISA = qw/Exporter/;
*Load = \&YAML::Syck::LoadJSON;
*Dump = \&YAML::Syck::DumpJSON;
sub DumpFile {
my $file = shift;
if ( YAML::Syck::_is_glob($file) ) {
if ( tied(*$file) ) {
# Tied filehandles (IO::String, IO::Scalar, etc.) don't support
# C-level PerlIO_write. Fall back to Perl-level print.
print $file YAML::Syck::DumpJSON( $_[0] )
or die "Error writing to filehandle $file: $!\n";
}
else {
my $err = YAML::Syck::DumpJSONFile( $_[0], $file );
if ($err) {
$! = 0 + $err;
die "Error writing to filehandle $file: $!\n";
}
}
}
else {
open( my $fh, '>', $file ) or die "Cannot write to $file: $!";
my $err = YAML::Syck::DumpJSONFile( $_[0], $fh );
if ($err) {
$! = 0 + $err;
die "Error writing to file $file: $!\n";
}
close $fh
or die "Error writing to file $file: $!\n";
}
return 1;
}
sub LoadFile {
my $file = shift;
if ( YAML::Syck::_is_glob($file) ) {
YAML::Syck::LoadJSON(
do { local $/; <$file> }
);
}
else {
if ( !-e $file || -z $file ) {
die("'$file' is non-existent or empty");
}
open( my $fh, '<', $file ) or die "Cannot read from $file: $!";
YAML::Syck::LoadJSON(
do { local $/; <$fh> }
);
}
}
sub DumpInto {
my $bufref = shift;
( ref $bufref ) or die "DumpInto not given reference to output buffer\n";
YAML::Syck::DumpJSONInto( $_[0], $bufref );
1;
}
$JSON::Syck::ImplicitTyping = 1;
$JSON::Syck::MaxDepth = 512;
$JSON::Syck::Headless = 1;
$JSON::Syck::ImplicitUnicode = 0;
$JSON::Syck::SingleQuote = 0;
1;
__END__
=head1 NAME
JSON::Syck - JSON is YAML (but consider using L instead!)
=head1 SYNOPSIS
use JSON::Syck; # no exports by default
my $data = JSON::Syck::Load($json);
my $json = JSON::Syck::Dump($data);
# $file can be an IO object, or a filename
my $data = JSON::Syck::LoadFile($file);
JSON::Syck::DumpFile($file, $data);
# Dump into a pre-existing buffer
my $json;
JSON::Syck::DumpInto(\$json, $data);
=head1 DESCRIPTION
JSON::Syck is a syck im