[Bps-public-commit] PerlIO-via-dynamic branch, master, created. 52b0d25ddea752b557555d7909d4948359797bc4

Alex Vandiver alexmv at bestpractical.com
Sat Nov 3 20:20:15 EDT 2012


The branch, master has been created
        at  52b0d25ddea752b557555d7909d4948359797bc4 (commit)

- Log -----------------------------------------------------------------
commit 4dced4681da1b09e637d0cabf0f8b65a67266367
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Mon Sep 8 11:17:46 2008 +0000

    directory for PerlIO::via::dynamic

commit 4482594b06a8cdbaf5856eaa9a893e86c26dee0d
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Mon Sep 8 11:18:28 2008 +0000

    PerlIO::via::dynamic 0.02

diff --git a/CHANGES b/CHANGES
new file mode 100644
index 0000000..8b5c11a
--- /dev/null
+++ b/CHANGES
@@ -0,0 +1,7 @@
+[Changes for 0.01 - 17 Feb, 2004]
+
+Support cleanup for dynamic namespaces..
+
+[Changes for 0.01 - 5 Feb, 2004]
+
+Initial release.
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..2a23d31
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,9 @@
+MANIFEST
+CHANGES
+README
+Makefile.PL
+dynamic.pm
+t/1use.t
+t/2basic.t
+t/3gc.t
+META.yml                                 Module meta-data (added by MakeMaker)
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..a19ed9e
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,10 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
+name:         PerlIO-via-dynamic
+version:      0.02
+version_from: dynamic.pm
+installdirs:  site
+requires:
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.21
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..bf4e9e4
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,16 @@
+#!/usr/bin/perl
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+    AUTHOR		=> 'Chia-liang Kao (clkao at clkao.org)',
+    ABSTRACT		=> 'Dynamic PerlIO layers',
+    NAME		=> 'PerlIO::via::dynamic',
+    VERSION_FROM	=> 'dynamic.pm',
+    DISTNAME		=> 'PerlIO-via-dynamic',
+
+    dist		=> {
+        COMPRESS	=> 'gzip -9',
+        SUFFIX		=> '.gz',
+    },
+);
+
diff --git a/README b/README
new file mode 100644
index 0000000..f9c4a20
--- /dev/null
+++ b/README
@@ -0,0 +1,24 @@
+This is the README file for PerlIO::via::dynamic, a module that helps creating
+dynamic PerlIO layers.
+
+* Installation
+
+PerlIO::via::dynamic uses the stanard perl module install process:
+
+% perl Makefile.PL
+% make
+# make install
+
+* Latest version
+
+The latest PerlIO::via::dynamic could be found on cpan or at:
+http://svn.elixus.org/svnweb/repos/browse/member/clkao/PerlIO-via-dynamic/
+
+* Copyright
+
+Copyright 2004 by Chia-liang Kao clkao at clkao.org.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See <http://www.perl.com/perl/misc/Artistic.html>.
diff --git a/dynamic.pm b/dynamic.pm
new file mode 100644
index 0000000..aa6c676
--- /dev/null
+++ b/dynamic.pm
@@ -0,0 +1,145 @@
+package PerlIO::via::dynamic;
+use strict;
+our $VERSION = '0.02';
+
+=head1 NAME
+
+PerlIO::via::dynamic - dynamic PerlIO layers
+
+=head1 SYNOPSIS
+
+ open $fh, $fname;
+ $p = PerlIO::via::dynamic->new
+  (translate =>
+    sub { $_[1] =~ s/\$Filename[:\w\s\-\.\/\\]*\$/\$Filename: $fname\$/e},
+   untranslate =>
+    sub { $_[1] =~ s/\$Filename[:\w\s\-\.\/\\]*\$/\$Filename\$/});
+ $p->via ($fh);
+ binmode $fh, $p->via; # deprecated
+
+=head1 DESCRIPTION
+
+PerlIO::via::dynamic is used for creating dynamic PerlIO layers. It is
+useful when the behavior or the layer depends on variables. You should
+not use this module as via layer directly (ie :via(dynamic)).
+
+Use the constructor to create new layers, with two arguments:
+translate and untranslate. Then use C<$p-E<gt>via ($fh)> to wrap the
+handle.
+
+Note that PerlIO::via::dynamic uses the scalar fields to reference to
+the object representing the dynamic namespace. If you
+
+=cut
+
+use Symbol qw(delete_package gensym);
+use Scalar::Util qw(weaken);
+
+sub PUSHED {
+    die "this should not be via directly"
+	if $_[0] eq __PACKAGE__;
+    my $p = bless gensym(), $_[0];
+
+    no strict 'refs';
+    # make sure the blessed glob is destroyed
+    # earlier than the object representing the namespace.
+    ${*$p} = ${"$_[0]::EGO"};
+
+    return $p;
+}
+
+sub translate {
+}
+
+sub untranslate {
+}
+
+sub FILL {
+    my $line = readline( $_[1] );
+    $_[0]->untranslate ($line) if defined $line;
+    $line;
+}
+
+sub WRITE {
+    my $buf = $_[1];
+    $_[0]->translate($buf);
+    (print {$_[2]} $buf) ? length($buf) : -1;
+}
+
+sub SEEK {
+    seek ($_[3], $_[1], $_[2]);
+}
+
+sub new {
+    my ($class, %arg) = @_;
+    my $self = {};
+    my $package = 'PerlIO::via::dynamic'.substr("$self", 7, -1);
+    eval qq|
+package $package;
+our \@ISA = qw($class);
+
+1;
+| or die $@;
+
+    no strict 'refs';
+    for (keys %arg) {
+	*{"$package\::$_"} = $arg{$_};
+    }
+
+    bless $self, $package;
+    ${"$package\::EGO"} = $self;
+    weaken ${"$package\::EGO"};
+    return $self;
+}
+
+sub via {
+    my ($self, $fh) = @_;
+    my $via = ':via('.ref ($_[0]).')';
+    unless ($fh) {
+	# 0.01 compatibility
+	$self->{nogc} = 1;
+	return $via;
+    }
+    binmode ($fh, $via) or die $!;
+    if (defined ${*$fh}) {
+	warn "handle $fh cannot hold references, namespace won't be cleaned";
+    }
+    else {
+	${*$fh} = $self;
+    }
+}
+
+sub DESTROY {
+    my ($self) = @_;
+    return unless UNIVERSAL::isa ($self, 'HASH');
+    return if $self->{nogc};
+
+    no strict 'refs';
+    my $ref = ref($self);
+    my ($leaf) = ($ref =~ /([^:]+)$/);
+    $leaf .= '::';
+
+    for my $sym (keys %{$ref.'::'}) {
+	undef ${$ref.'::'}{$sym}
+	    if $sym;
+    }
+
+    delete $PerlIO::via::{$leaf};
+}
+
+=head1 AUTHORS
+
+Chia-liang Kao E<lt>clkao at clkao.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright 2004 by Chia-liang Kao E<lt>clkao at clkao.orgE<gt>.
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+See L<http://www.perl.com/perl/misc/Artistic.html>
+
+=cut
+
+1;
diff --git a/t/1use.t b/t/1use.t
new file mode 100644
index 0000000..88a29c7
--- /dev/null
+++ b/t/1use.t
@@ -0,0 +1,5 @@
+#!/usr/bin/perl
+use Test;
+BEGIN { plan tests => 1 };
+use PerlIO::via::dynamic; ok(1);
+exit;
diff --git a/t/2basic.t b/t/2basic.t
new file mode 100644
index 0000000..6ad1a70
--- /dev/null
+++ b/t/2basic.t
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+use Test;
+use strict;
+use PerlIO::via::dynamic;
+BEGIN { plan tests => 1 };
+
+# $Filename$
+
+my $fname = $0;
+
+my $p = PerlIO::via::dynamic->new
+  (untranslate =>
+    sub { $_[1] =~ s/\$Filename[:\w\s\-\.\/\\]*\$/"\$Filename: $fname\$"/e},
+   translate =>
+    sub { $_[1] =~ s/\$Filename[:\w\s\-\.\/\\]*\$/\$Filename\$/});
+
+open my $fh, '<'.$p->via, $fname;
+
+local $/;
+
+my $text = <$fh>;
+
+ok (1) if $text =~ m/^# \$Filename: $0\$/m;
+
+exit;
diff --git a/t/3gc.t b/t/3gc.t
new file mode 100644
index 0000000..39fe3de
--- /dev/null
+++ b/t/3gc.t
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -w
+use strict;
+use Test::More tests => 3;
+use PerlIO::via::dynamic;
+
+# $Filename$
+
+our $unused_destroyed;
+my $fname = $0;
+
+sub run_test {
+    my $o = bless {}, 'Unused';
+
+    my $p = PerlIO::via::dynamic->new
+	(untranslate =>
+	 sub { $o->{fnord}++;
+	       $_[1] =~ s/\$Filename[:\w\s\-\.\/\\]*\$/"\$Filename: $fname\$"/e},
+	 translate =>
+	 sub { $_[1] =~ s/\$Filename[:\w\s\-\.\/\\]*\$/\$Filename\$/});
+
+    open my $fh, '<', $fname;
+    $p->via ($fh);
+
+    local $/;
+    my $text = <$fh>;
+    ok (1) if $text =~ m/^# \$Filename: $0\$/m;
+}
+
+run_test ();
+
+ok ($unused_destroyed);
+
+run_test ();
+
+package Unused;
+
+sub DESTROY {
+    $main::unused_destroyed = 1;
+}

commit a786a343a00dbeb4cd965fb8d11fe07495be9372
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Mon Sep 8 11:18:54 2008 +0000

    PerlIO::via::dynamic 0.10.

diff --git a/CHANGES b/CHANGES
index 8b5c11a..7883366 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,9 @@
-[Changes for 0.01 - 17 Feb, 2004]
+[Changes for 0.10 - 6 Sep, 2004]
+
+* Add use_read option to use READ instead of FILL.
+* Make next layer autoflush on write.
+
+[Changes for 0.02 - 17 Feb, 2004]
 
 Support cleanup for dynamic namespaces..
 
diff --git a/MANIFEST b/MANIFEST
index 2a23d31..6e234fd 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,9 +1,21 @@
-MANIFEST
 CHANGES
-README
-Makefile.PL
 dynamic.pm
+inc/ExtUtils/AutoInstall.pm
+inc/Module/Install.pm
+inc/Module/Install/AutoInstall.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Include.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+Makefile.PL
+MANIFEST
+META.yml			Module meta-data (added by MakeMaker)
+README
+SIGNATURE			Public-key signature (added by MakeMaker)
 t/1use.t
 t/2basic.t
 t/3gc.t
-META.yml                                 Module meta-data (added by MakeMaker)
diff --git a/Makefile.PL b/Makefile.PL
index bf4e9e4..d2ade4e 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,16 +1,15 @@
 #!/usr/bin/perl
-use ExtUtils::MakeMaker;
 
-WriteMakefile(
-    AUTHOR		=> 'Chia-liang Kao (clkao at clkao.org)',
-    ABSTRACT		=> 'Dynamic PerlIO layers',
-    NAME		=> 'PerlIO::via::dynamic',
-    VERSION_FROM	=> 'dynamic.pm',
-    DISTNAME		=> 'PerlIO-via-dynamic',
+use inc::Module::Install;
+use 5.008;
 
-    dist		=> {
-        COMPRESS	=> 'gzip -9',
-        SUFFIX		=> '.gz',
-    },
-);
+name		('PerlIO-via-dynamic');
+author		('Chia-liang Kao <clkao at clkao.org>');
+abstract_from	('dynamic.pm');
+license		('perl');
+version_from	('dynamic.pm');
 
+include('ExtUtils::AutoInstall');
+auto_install();
+
+WriteAll( sign => 1 );
diff --git a/dynamic.pm b/dynamic.pm
index aa6c676..dfc3ff6 100644
--- a/dynamic.pm
+++ b/dynamic.pm
@@ -1,6 +1,6 @@
 package PerlIO::via::dynamic;
 use strict;
-our $VERSION = '0.02';
+our $VERSION = '0.10';
 
 =head1 NAME
 
@@ -19,21 +19,47 @@ PerlIO::via::dynamic - dynamic PerlIO layers
 
 =head1 DESCRIPTION
 
-PerlIO::via::dynamic is used for creating dynamic PerlIO layers. It is
-useful when the behavior or the layer depends on variables. You should
-not use this module as via layer directly (ie :via(dynamic)).
+C<PerlIO::via::dynamic> is used for creating dynamic L<PerlIO>
+layers. It is useful when the behavior or the layer depends on
+variables. You should not use this module as via layer directly (ie
+:via(dynamic)).
 
 Use the constructor to create new layers, with two arguments:
-translate and untranslate. Then use C<$p-E<gt>via ($fh)> to wrap the
-handle.
+translate and untranslate. Then use C<$p->via ($fh)> to wrap the
+handle.  Once <$fh> is destroyed, the temporary namespace for the IO
+layer will be removed.
 
 Note that PerlIO::via::dynamic uses the scalar fields to reference to
-the object representing the dynamic namespace. If you
+the object representing the dynamic namespace.
+
+=head1 OPTIONS
+
+=over
+
+=item translate
+
+A function that translate buffer upon I<write>.
+
+=item untranslate
+
+A function that translate buffer upon I<read>.
+
+=item use_read
+
+Use C<READ> instead of C<FILL> for the layer.  Useful when caller
+expect exact amount of data from read, and the C<untranslate> function
+might return different length.
+
+By default C<PerlIO::via::dynamic> creates line-based layer to make
+C<translate> implementation easier.
+
+=back
 
 =cut
 
 use Symbol qw(delete_package gensym);
 use Scalar::Util qw(weaken);
+use IO::Handle;
 
 sub PUSHED {
     die "this should not be via directly"
@@ -54,16 +80,24 @@ sub translate {
 sub untranslate {
 }
 
-sub FILL {
+sub _FILL {
     my $line = readline( $_[1] );
     $_[0]->untranslate ($line) if defined $line;
     $line;
 }
 
+sub READ {
+    my $ret = read $_[3], $_[1], $_[2];
+    return $ret unless $ret > 0;
+    $_[0]->untranslate ($_[1]);
+    return length ($_[1]);
+}
+
 sub WRITE {
     my $buf = $_[1];
     $_[0]->translate($buf);
-    (print {$_[2]} $buf) ? length($buf) : -1;
+    $_[2]->autoflush (1);
+    (print {$_[2]} $buf) ? length ($buf) : -1;
 }
 
 sub SEEK {
@@ -82,6 +116,14 @@ our \@ISA = qw($class);
 | or die $@;
 
     no strict 'refs';
+    unless ($arg{use_read}) {
+	*{"$package\::FILL"} = *PerlIO::via::dynamic::_FILL;
+    }
+    delete $arg{use_read};
+    if ($arg{no_gc}) {
+	$self->{nogc} = 1;
+    }
+    delete $arg{no_gc};
     for (keys %arg) {
 	*{"$package\::$_"} = $arg{$_};
     }

commit 727c516d9a8ac81260957696a3328b23640c9e58
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Mon Sep 8 11:19:35 2008 +0000

    PerlIO-via-dynamic 0.11

diff --git a/CHANGES b/CHANGES
index 7883366..2eef51b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+[Changes for 0.11 - 16 Sep, 2004]
+
+* Try harder to find space to hold reference.
+* Cleanup constructor.
+
 [Changes for 0.10 - 6 Sep, 2004]
 
 * Add use_read option to use READ instead of FILL.
diff --git a/MANIFEST b/MANIFEST
index 6e234fd..5f938fc 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -19,3 +19,4 @@ SIGNATURE			Public-key signature (added by MakeMaker)
 t/1use.t
 t/2basic.t
 t/3gc.t
+t/4gc-array.t
diff --git a/SIGNATURE b/SIGNATURE
new file mode 100644
index 0000000..702f771
--- /dev/null
+++ b/SIGNATURE
@@ -0,0 +1,44 @@
+This file contains message digests of all files listed in MANIFEST,
+signed via the Module::Signature module, version 0.41.
+
+To verify the content in this distribution, first make sure you have
+Module::Signature installed, then type:
+
+    % cpansign -v
+
+It would check each file's integrity, as well as the signature's
+validity.  If "==> Signature verified OK! <==" is not displayed,
+the distribution may already have been compromised, and you should
+not run its Makefile.PL or Build.PL.
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+SHA1 551baccbe416592e2d8be452cad2b789aef243f4 CHANGES
+SHA1 7c9dcc9043b882825627ba20943bf8958537601d MANIFEST
+SHA1 47196876f1450b0f0e91e88c4ac636f7836b5325 META.yml
+SHA1 7068c8062c803c48b397357ba4cbbf8ca8e2d3e4 Makefile.PL
+SHA1 bfbcb8279d026bcc34978f3857c60a165eec02b0 README
+SHA1 ab1c0e7e573725c8c56d85dd386372dd15c0a95d dynamic.pm
+SHA1 127fb0a41f8433b854676941c699693abc3e85d4 inc/ExtUtils/AutoInstall.pm
+SHA1 02597776ad22aacd2c8e189594fcbf701390b606 inc/Module/Install.pm
+SHA1 53422ed14b41bbc9af3ac14a26ced3ed21dee0bc inc/Module/Install/AutoInstall.pm
+SHA1 7ca8b8f54287c2b5af8062fc9f349275a07e06f3 inc/Module/Install/Base.pm
+SHA1 b6af22816210f8eaab4c2c616e05a8892b2fcfd0 inc/Module/Install/Can.pm
+SHA1 33659c004518e95afb6ffafad41e84f2a6268412 inc/Module/Install/Fetch.pm
+SHA1 b42b4d3a89848325ae29422c72638e1571e7af1b inc/Module/Install/Include.pm
+SHA1 c4ed10cd20914c04f3fff3f8aaf8943372cec114 inc/Module/Install/Makefile.pm
+SHA1 ccf9b6267b5c9e7b35ef129f7e974255955c8867 inc/Module/Install/Metadata.pm
+SHA1 1288f4c4e4ba88e19194d7952eacbd6be2a5b916 inc/Module/Install/Win32.pm
+SHA1 1022a7ab797fc0081ea947f102650362ad925d7a inc/Module/Install/WriteAll.pm
+SHA1 9b74492a537b62db702e0168e734a1091d4d829a t/1use.t
+SHA1 ddb2d82e1d42ffe92d215827855c4884c06230fb t/2basic.t
+SHA1 5c782845392f975b9069ba51aabc4a47b1d55397 t/3gc.t
+SHA1 e44e0463f05cde23df8b345f664fd6cfe180ac73 t/4gc-array.t
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.2.4 (FreeBSD)
+
+iD8DBQFBSOTgk1XldlEkA5YRAs5EAJ0SrhdxWIG7demj+iMcJJM0JqLEtwCeJ8UR
+ASqIvx/CYGEYR8Z6Jc2fs64=
+=ELR5
+-----END PGP SIGNATURE-----
diff --git a/dynamic.pm b/dynamic.pm
index dfc3ff6..c119914 100644
--- a/dynamic.pm
+++ b/dynamic.pm
@@ -1,6 +1,6 @@
 package PerlIO::via::dynamic;
 use strict;
-our $VERSION = '0.10';
+our $VERSION = '0.11';
 
 =head1 NAME
 
@@ -116,18 +116,14 @@ our \@ISA = qw($class);
 | or die $@;
 
     no strict 'refs';
-    unless ($arg{use_read}) {
-	*{"$package\::FILL"} = *PerlIO::via::dynamic::_FILL;
-    }
-    delete $arg{use_read};
-    if ($arg{no_gc}) {
-	$self->{nogc} = 1;
+    for (qw/translate untranslate/) {
+	*{"$package\::$_"} = delete $arg{$_}
+	    if exists $arg{$_}
     }
-    delete $arg{no_gc};
-    for (keys %arg) {
-	*{"$package\::$_"} = $arg{$_};
+    %$self = %arg;
+    unless ($self->{use_read}) {
+	*{"$package\::FILL"} = *PerlIO::via::dynamic::_FILL;
     }
-
     bless $self, $package;
     ${"$package\::EGO"} = $self;
     weaken ${"$package\::EGO"};
@@ -144,7 +140,13 @@ sub via {
     }
     binmode ($fh, $via) or die $!;
     if (defined ${*$fh}) {
-	warn "handle $fh cannot hold references, namespace won't be cleaned";
+	if (defined @{*$fh}) {
+	    warn "handle $fh cannot hold references, namespace won't be cleaned";
+	    $self->{nogc} = 1;
+	}
+	else {
+	    ${*$fh}[0] = $self;
+	}
     }
     else {
 	${*$fh} = $self;

commit 6c87d3935a6998e89461adabfb53421eb07d7b3c
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Mon Sep 8 11:20:22 2008 +0000

    blah

diff --git a/t/4gc-array.t b/t/4gc-array.t
new file mode 100644
index 0000000..9953242
--- /dev/null
+++ b/t/4gc-array.t
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -w
+use strict;
+use PerlIO::via::dynamic;
+use File::Temp;
+use Test::More tests => 1;
+
+our $unused_destroyed;
+
+sub run_test {
+    my $o = bless {}, 'Unused';
+
+    my $p = PerlIO::via::dynamic->new
+	(untranslate =>
+	 sub { $o->{fnord}++; });
+
+    my $fh = File::Temp->new;
+    $p->via ($fh);
+    print $fh "Foobar\n";
+
+}
+
+run_test ();
+ok ($unused_destroyed);
+
+package Unused;
+
+sub DESTROY {
+    $main::unused_destroyed = 1;
+}

commit 940e46213f203631ff9487206109b67b995c4767
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Mon Sep 8 11:20:51 2008 +0000

    0.12

diff --git a/CHANGES b/CHANGES
index 2eef51b..7f8f450 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+[Changes for 0.12 - 6 Mar, 2006]
+
+* Dummy release, as I accidentally delete the previous
+  one from pause.
+
 [Changes for 0.11 - 16 Sep, 2004]
 
 * Try harder to find space to hold reference.
diff --git a/MANIFEST b/MANIFEST
index 5f938fc..1be44fa 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,6 +1,7 @@
 CHANGES
 dynamic.pm
 inc/ExtUtils/AutoInstall.pm
+inc/Module/AutoInstall.pm
 inc/Module/Install.pm
 inc/Module/Install/AutoInstall.pm
 inc/Module/Install/Base.pm
diff --git a/dynamic.pm b/dynamic.pm
index c119914..3f0fdc1 100644
--- a/dynamic.pm
+++ b/dynamic.pm
@@ -1,6 +1,6 @@
 package PerlIO::via::dynamic;
 use strict;
-our $VERSION = '0.11';
+our $VERSION = '0.12';
 
 =head1 NAME
 

commit 0ddae5a9a6b0ae72d391d87e8555fbcbf01f7d56
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Mon Sep 8 11:21:26 2008 +0000

    workaround a 5.10.0 refcnt bug.

diff --git a/CHANGES b/CHANGES
index 7f8f450..d639307 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+[Changes for 0.13 - 31 May, 2008]
+
+* Workaround a refcnt bug in Perl 5.10.0
+
 [Changes for 0.12 - 6 Mar, 2006]
 
 * Dummy release, as I accidentally delete the previous
diff --git a/Makefile.PL b/Makefile.PL
index d2ade4e..a795dcf 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -8,6 +8,7 @@ author		('Chia-liang Kao <clkao at clkao.org>');
 abstract_from	('dynamic.pm');
 license		('perl');
 version_from	('dynamic.pm');
+requires        ('Internals') if $] == 5.010000;
 
 include('ExtUtils::AutoInstall');
 auto_install();
diff --git a/dynamic.pm b/dynamic.pm
index 3f0fdc1..cad134b 100644
--- a/dynamic.pm
+++ b/dynamic.pm
@@ -66,6 +66,12 @@ sub PUSHED {
 	if $_[0] eq __PACKAGE__;
     my $p = bless gensym(), $_[0];
 
+    if ($] == 5.010000 && ref($_[-1]) eq 'GLOB') {
+        # This is to workaround a core bug in perl 5.10.0, see
+        # http://rt.perl.org/rt3/Public/Bug/Display.html?id=54934
+        require Internals;
+        Internals::SetRefCount($_[-1], Internals::GetRefCount($_[-1])+1);
+    }
     no strict 'refs';
     # make sure the blessed glob is destroyed
     # earlier than the object representing the namespace.

commit 52b0d25ddea752b557555d7909d4948359797bc4
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Mon Sep 8 11:22:06 2008 +0000

    0.13.

diff --git a/dynamic.pm b/dynamic.pm
index cad134b..37b6726 100644
--- a/dynamic.pm
+++ b/dynamic.pm
@@ -1,6 +1,6 @@
 package PerlIO::via::dynamic;
 use strict;
-our $VERSION = '0.12';
+our $VERSION = '0.13';
 
 =head1 NAME
 

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list