Skip Menu |

This queue is for tickets about the Text-CSV_XS CPAN distribution.

Report information
The Basics
Id: 77797
Status: resolved
Priority: 0/
Queue: Text-CSV_XS

People
Owner: Nobody in particular
Requestors: TONYC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.90
Fixed in: 0.90



Subject: fixes for varous magic test issues
These changes fix the various 67_magic.t issues discussed in IRC.
Subject: 0001-avoid-untie-attempted-while-d-inner-references-still.patch
From 9c4517d8e2fb020eb3e6f3974916fedf925580fd Mon Sep 17 00:00:00 2001 From: Tony Cook <tony@develop-help.com> Date: Wed, 13 Jun 2012 20:49:53 +1000 Subject: [PATCH 1/3] avoid untie attempted while %d inner references still exist The tie subs were closures over $bar, keeping it live and causing warnings when we tried to untie. --- t/76_magic.t | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/t/76_magic.t b/t/76_magic.t index 546dfb4..5365171 100644 --- a/t/76_magic.t +++ b/t/76_magic.t @@ -83,20 +83,19 @@ unlink "_76test.csv"; use vars qw( @ISA ); @ISA = qw(Tie::Scalar); - my $bar; - sub FETCH { - return $bar; + return ${$_[0]}; } # FETCH sub STORE { - $bar = $_[1]; + ${$_[0]} = $_[1]; } # STORE sub TIESCALAR { + my $bar; bless \$bar, "Bar"; } # TIESCALAR -- 1.7.2.5
Subject: 0002-untie-the-correct-variable.patch
From 6acb3614b1bee68f06135b105dc4c20345a5ad61 Mon Sep 17 00:00:00 2001 From: Tony Cook <tony@develop-help.com> Date: Wed, 13 Jun 2012 20:50:12 +1000 Subject: [PATCH 2/3] untie the correct variable --- t/76_magic.t | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/t/76_magic.t b/t/76_magic.t index 5365171..2e4a4a0 100644 --- a/t/76_magic.t +++ b/t/76_magic.t @@ -26,7 +26,7 @@ is_deeply ([$csv->fields], \@foo, "column_names ()"); tie $bar, "Bar"; $bar = "#"; ok ($csv->combine ($bar, @{$foo}[1..3]),"combine () from magic"); -untie $foo; +untie $bar; is_deeply ([$csv->fields], \@foo, "column_names ()"); tie $foo, "Foo"; -- 1.7.2.5
Subject: 0003-test-magic-is-honoured-for-bound-columns.patch
From a042c2c92005a2cdc2fb490f5750ab15cef39a44 Mon Sep 17 00:00:00 2001 From: Tony Cook <tony@develop-help.com> Date: Wed, 13 Jun 2012 20:50:57 +1000 Subject: [PATCH 3/3] test magic is honoured for bound columns --- t/76_magic.t | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/t/76_magic.t b/t/76_magic.t index 2e4a4a0..eb0956f 100644 --- a/t/76_magic.t +++ b/t/76_magic.t @@ -45,10 +45,13 @@ untie $foo; is_deeply ([$csv->column_names], \@foo, "column_names ()"); open $fh, "<", "_76test.csv"; -is ($csv->bind_columns (undef), undef, "bind column clear"); +tie $bar, "Bar"; ok ($csv->bind_columns (\$bar, \my ($f0, $f1, $f2)), "bind"); ok ($csv->getline ($fh), "fetch with magic"); is_deeply ([$bar,$f0,$f1,$f2], \@foo, "columns fetched on magic"); +# free any refs +is ($csv->bind_columns (undef), undef, "bind column clear"); +untie $bar; close $fh; unlink "_76test.csv"; -- 1.7.2.5