r34089 - in /branches/upstream/libyaml-syck-perl/current: Changes MANIFEST Makefile.PL README SIGNATURE lib/JSON/Syck.pm lib/YAML/Syck.pm t/json-loadfile.t

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Sat Apr 25 16:22:31 UTC 2009


Author: ryan52-guest
Date: Sat Apr 25 16:22:23 2009
New Revision: 34089

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=34089
Log:
[svn-upgrade] Integrating new upstream version, libyaml-syck-perl (1.07)

Added:
    branches/upstream/libyaml-syck-perl/current/t/json-loadfile.t
Removed:
    branches/upstream/libyaml-syck-perl/current/SIGNATURE
Modified:
    branches/upstream/libyaml-syck-perl/current/Changes
    branches/upstream/libyaml-syck-perl/current/MANIFEST
    branches/upstream/libyaml-syck-perl/current/Makefile.PL
    branches/upstream/libyaml-syck-perl/current/README
    branches/upstream/libyaml-syck-perl/current/lib/JSON/Syck.pm
    branches/upstream/libyaml-syck-perl/current/lib/YAML/Syck.pm

Modified: branches/upstream/libyaml-syck-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libyaml-syck-perl/current/Changes?rev=34089&op=diff
==============================================================================
--- branches/upstream/libyaml-syck-perl/current/Changes (original)
+++ branches/upstream/libyaml-syck-perl/current/Changes Sat Apr 25 16:22:23 2009
@@ -1,3 +1,8 @@
+[Changes for 1.07 (JSON::Syck 0.30) - 2009-04-25]
+
+* Added the missing Loadfile function to JSON::Syck.
+  Reported by: Dan McCormick
+
 [Changes for 1.05 (JSON::Syck 0.29) - 2008-06-09]
 
 * Loading a YAML stream containing Regexp nodes under -d:DProf should

Modified: branches/upstream/libyaml-syck-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libyaml-syck-perl/current/MANIFEST?rev=34089&op=diff
==============================================================================
--- branches/upstream/libyaml-syck-perl/current/MANIFEST (original)
+++ branches/upstream/libyaml-syck-perl/current/MANIFEST Sat Apr 25 16:22:23 2009
@@ -35,7 +35,6 @@
 ppport_math.h
 ppport_sort.h
 README
-SIGNATURE			Public-key signature (added by MakeMaker)
 syck.h
 Syck.xs
 syck_.c
@@ -52,6 +51,7 @@
 t/json-crlf.t
 t/json-empty.t
 t/json-indent.t
+t/json-loadfile.t
 t/json-minus.t
 t/json-newline.t
 t/json-null.t

Modified: branches/upstream/libyaml-syck-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libyaml-syck-perl/current/Makefile.PL?rev=34089&op=diff
==============================================================================
--- branches/upstream/libyaml-syck-perl/current/Makefile.PL (original)
+++ branches/upstream/libyaml-syck-perl/current/Makefile.PL Sat Apr 25 16:22:23 2009
@@ -40,4 +40,4 @@
 include_deps    'Test::More';
 requires        'Scalar::Util';
 build_requires  'Devel::Leak' if defined $ENV{'AUTOMATED_TESTING'};
-sign; WriteAll;
+WriteAll;

Modified: branches/upstream/libyaml-syck-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libyaml-syck-perl/current/README?rev=34089&op=diff
==============================================================================
--- branches/upstream/libyaml-syck-perl/current/README (original)
+++ branches/upstream/libyaml-syck-perl/current/README Sat Apr 25 16:22:23 2009
@@ -2,8 +2,8 @@
     YAML::Syck - Fast, lightweight YAML loader and dumper
 
 VERSION
-    This document describes version 1.01 of YAML::Syck, released January 18,
-    2008.
+    This document describes version 1.07 of YAML::Syck, released April 25,
+    2009.
 
 SYNOPSIS
         use YAML::Syck;
@@ -101,7 +101,7 @@
     Audrey Tang <cpan at audreyt.org>
 
 COPYRIGHT
-    Copyright 2005, 2006, 2007, 2008 by Audrey Tang <cpan at audreyt.org>.
+    Copyright 2005-2009 by Audrey Tang <cpan at audreyt.org>.
 
     This software is released under the MIT license cited below.
 

Modified: branches/upstream/libyaml-syck-perl/current/lib/JSON/Syck.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libyaml-syck-perl/current/lib/JSON/Syck.pm?rev=34089&op=diff
==============================================================================
--- branches/upstream/libyaml-syck-perl/current/lib/JSON/Syck.pm (original)
+++ branches/upstream/libyaml-syck-perl/current/lib/JSON/Syck.pm Sat Apr 25 16:22:23 2009
@@ -5,7 +5,7 @@
 use YAML::Syck ();
 
 BEGIN {
-    $VERSION    = '0.29';
+    $VERSION    = '0.30';
     @EXPORT_OK  = qw( Load Dump LoadFile DumpFile );
     @ISA        = 'Exporter';
     *Load       = \&YAML::Syck::LoadJSON;
@@ -22,6 +22,19 @@
         open 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_openhandle($file) ) {
+        YAML::Syck::LoadJSON(do { local $/; <$file> });
+    }
+    else {
+        local *FH;
+        open FH, "< $file" or die "Cannot read from $file: $!";
+        YAML::Syck::LoadJSON(do { local $/; <FH> });
     }
 }
 
@@ -142,7 +155,7 @@
 
 =head1 COPYRIGHT
 
-Copyright 2005, 2006, 2007, 2008 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
+Copyright 2005-2009 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
 
 This software is released under the MIT license cited below.
 

Modified: branches/upstream/libyaml-syck-perl/current/lib/YAML/Syck.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libyaml-syck-perl/current/lib/YAML/Syck.pm?rev=34089&op=diff
==============================================================================
--- branches/upstream/libyaml-syck-perl/current/lib/YAML/Syck.pm (original)
+++ branches/upstream/libyaml-syck-perl/current/lib/YAML/Syck.pm Sat Apr 25 16:22:23 2009
@@ -13,7 +13,7 @@
 use Exporter;
 
 BEGIN {
-    $VERSION = '1.05';
+    $VERSION = '1.07';
     @EXPORT  = qw( Dump Load DumpFile LoadFile );
     @ISA     = qw( Exporter );
 
@@ -139,7 +139,7 @@
 
 =head1 VERSION
 
-This document describes version 1.04 of YAML::Syck, released February 17, 2008.
+This document describes version 1.07 of YAML::Syck, released April 25, 2009.
 
 =head1 SYNOPSIS
 
@@ -251,7 +251,7 @@
 
 =head1 COPYRIGHT
 
-Copyright 2005, 2006, 2007, 2008 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
+Copyright 2005-2009 by Audrey Tang E<lt>cpan at audreyt.orgE<gt>.
 
 This software is released under the MIT license cited below.
 

Added: branches/upstream/libyaml-syck-perl/current/t/json-loadfile.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libyaml-syck-perl/current/t/json-loadfile.t?rev=34089&op=file
==============================================================================
--- branches/upstream/libyaml-syck-perl/current/t/json-loadfile.t (added)
+++ branches/upstream/libyaml-syck-perl/current/t/json-loadfile.t Sat Apr 25 16:22:23 2009
@@ -1,0 +1,89 @@
+use t::TestYAML;
+use JSON::Syck;
+use Test::More;
+use FindBin '$RealBin';
+
+chdir $RealBin;
+
+unless (-w $RealBin) {
+    plan skip_all => "Can't write to $RealBin";
+    exit;
+}
+
+plan tests => 8;
+
+*::LoadFile = *JSON::Syck::LoadFile;
+
+# remember where *DATA begins
+my $pos = tell(DATA);
+die "tell(DATA) failed: $!" unless $pos != -1;
+
+# read via a GLOB
+is(LoadFile(*DATA), "a simple scalar", 'LoadFile(*DATA) works');
+
+# rewind *DATA
+seek(DATA, $pos, 0)==1 or die "rewind *DATA failed: $!";
+
+# read via a GLOB ref
+is(LoadFile(\*DATA), "a simple scalar", 'LoadFile(\*DATA) works');
+
+sub write_file {
+    my ($fh, $contents) = @_;
+    local *H;
+    open(H, "> $fh") or die $!;
+    print H $contents;
+    close(H);
+}
+
+# write YAML to a file
+write_file('loadfile.json', "---\na simple scalar");
+END { unlink 'loadfile.json' or die "can't delete 'loadfile.json': $!" if -e 'loadfile.json' }
+
+# using file names
+is(LoadFile('loadfile.json'), "a simple scalar", 'LoadFile works with file names');
+
+# read via IO::File
+{
+    require IO::File;
+    my $h = IO::File->new('loadfile.json');
+    is(LoadFile($h), "a simple scalar", 'LoadFile works with IO::File');
+    close($h);
+}
+
+# read via indirect file handles
+SKIP: {
+    skip "indirect file handles require 5.6 or later", 1 unless $] >= 5.006000;
+
+    open(my $h, 'loadfile.json');
+    is(LoadFile($h), "a simple scalar", 'LoadFile works with indirect filehandles');
+    close($h);
+}
+
+# read via ordinary filehandles
+{
+    local *H;
+    open(H, 'loadfile.json');
+    is(LoadFile(*H), "a simple scalar", 'LoadFile works with ordinary filehandles');
+    close(H);
+}
+
+# read via ordinary filehandles (refs)
+{
+    local *H;
+    open(H, 'loadfile.json');
+    is(LoadFile(\*H), "a simple scalar", 'LoadFile works with glob refs');
+    close(H);
+}
+
+# load from "in memory" file
+SKIP : {
+    skip "in-memory files require 5.8 or later", 1 unless $] >= 5.00800; eval q[
+
+    open(my $h, '<', \'a simple scalar');
+    is(LoadFile($h), "a simple scalar", 'LoadFile works with in-memory files');
+    close($h);
+
+] }
+
+__DATA__
+"a simple scalar"




More information about the Pkg-perl-cvs-commits mailing list