This file is indexed.

/usr/lib/perl5/JSON/Syck.pm is in libyaml-syck-perl 1.19-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
package JSON::Syck;
use strict;
use vars qw( $VERSION @EXPORT_OK @ISA );
use Exporter;
use YAML::Syck ();

BEGIN {
    $VERSION    = '0.42';
    @EXPORT_OK  = qw( Load Dump LoadFile DumpFile );
    @ISA        = 'Exporter';
    *Load       = \&YAML::Syck::LoadJSON;
    *Dump       = \&YAML::Syck::DumpJSON;
}

sub DumpFile {
    my $file = shift;
    if ( YAML::Syck::_is_openhandle($file) ) {
        print {$file} YAML::Syck::DumpJSON($_[0]);
    }
    else {
        open(my $fh, '>',  $file) or die "Cannot write to $file: $!";
        print {$fh} YAML::Syck::DumpJSON($_[0]);
        close $fh;
    }
}


sub LoadFile {
    my $file = shift;
    if ( YAML::Syck::_is_glob($file) ) {
        if(-z $file) {
	    die("Cannot load an empty file");
        }
        YAML::Syck::LoadJSON(do { local $/; <$file> });
    }
    else {
        if(!-e $file || -z $file) {
	    die("'$file' is non-existant or empty");
	}
        open(my $fh, '<', $file) or die "Cannot read from $file: $!";
        YAML::Syck::LoadJSON(do { local $/; <$fh> });
    }
}

$JSON::Syck::ImplicitTyping  = 1;
$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<JSON::XS> 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);

=head1 DESCRIPTION

JSON::Syck is a syck implementation of JSON parsing and generation. Because
JSON is YAML (L<http://redhanded.hobix.com/inspect/yamlIsJson.html>), using
syck gives you a fast and memory-efficient parser and dumper for JSON data
representation.

However, a newer module L<JSON::XS>, has since emerged.  It is more flexible,
efficient and robust, so please consider using it instead of this module.

=head1 DIFFERENCE WITH JSON

You might want to know the difference between the I<JSON> module and
this one.

Since JSON is a pure-perl module and JSON::Syck is based on libsyck,
JSON::Syck is supposed to be very fast and memory efficient. See
chansen's benchmark table at
L<http://idisk.mac.com/christian.hansen/Public/perl/serialize.pl>

JSON.pm comes with dozens of ways to do the same thing and lots of
options, while JSON::Syck doesn't. There's only C<Load> and C<Dump>.

Oh, and JSON::Syck doesn't use camelCase method names :-)

=head1 REFERENCES

=head2 SCALAR REFERENCE

For now, when you pass a scalar reference to JSON::Syck, it
dereferences to get the actual scalar value.

JSON::Syck raises an exception when you pass in circular references.

If you want to serialize self refernecing stuff, you should use
YAML which supports it.

=head2 SUBROUTINE REFERENCE

When you pass subroutine reference, JSON::Syck dumps it as null.

=head1 UTF-8 FLAGS

By default this module doesn't touch any of utf-8 flags set in
strings, and assumes UTF-8 bytes to be passed and emit.

However, when you set C<$JSON::Syck::ImplicitUnicode> to 1, this
module properly decodes UTF-8 binaries and sets UTF-8 flag everywhere,
as in:

  JSON (UTF-8 bytes)   => Perl (UTF-8 flagged)
  JSON (UTF-8 flagged) => Perl (UTF-8 flagged)
  Perl (UTF-8 bytes)   => JSON (UTF-8 flagged)
  Perl (UTF-8 flagged) => JSON (UTF-8 flagged)

Unfortunately, there's no implicit way to dump Perl UTF-8 flagged data
structure to utf-8 encoded JSON. To do this, simply use Encode module, e.g.:

  use Encode;
  use JSON::Syck qw(Dump);

  my $json = encode_utf8( Dump($data) );

Alternatively you can use Encode::JavaScript::UCS to encode Unicode
strings as in I<%uXXXX> form.

  use Encode;
  use Encode::JavaScript::UCS;
  use JSON::Syck qw(Dump);

  my $json_unicode_escaped = encode( 'JavaScript-UCS', Dump($data) );

=head1 QUOTING

According to the JSON specification, all JSON strings are to be double-quoted.
However, when embedding JavaScript in HTML attributes, it may be more
convenient to use single quotes.

Set C<$JSON::Syck::SingleQuote> to 1 will make both C<Dump> and C<Load> expect
single-quoted string literals.

=head1 SEE ALSO

L<JSON::XS>,

=head1 AUTHORS

Audrey Tang E<lt>cpan@audreyt.orgE<gt>

Tatsuhiko Miyagawa E<lt>miyagawa@gmail.comE<gt>

=head1 COPYRIGHT

Copyright 2005-2009 by Audrey Tang E<lt>cpan@audreyt.orgE<gt>.

This software is released under the MIT license cited below.

The F<libsyck> code bundled with this library is released by
"why the lucky stiff", under a BSD-style license.  See the F<COPYING>
file for details.

=head2 The "MIT" License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

=cut