Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 85074
Status: resolved
Priority: 0/
Queue: CGI

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

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Attachments
0001-test-the-handle-method.patch
0002-TODO-test-for-calling-the-seek-method-on-handle-s-re.patch
0003-make-the-result-of-handle-an-IO-File-instead-of-IO-H.patch



Subject: [PATCH] handle() untested + calling seek() as a method on result
Download (untitled) / with headers
text/plain 537b
handle() appears to have no tests. Also, calling the seek() method on the result of handle() causes a method not found error. Attached, three patches appliable with git am: 0001-test-the-handle-method.patch - basic tests for handle() 0002-TODO-test-for-calling-the-seek-method-on-handle-s-re.patch - a TODO test for calling seek() on the result of handle() 0003-make-the-result-of-handle-an-IO-File-instead-of-IO-H.patch - fix handle() to retutn an IO::File object If preferred, I can open github pull requests instead. Tony
Subject: 0002-TODO-test-for-calling-the-seek-method-on-handle-s-re.patch
From 638d03b36e5769508a74ed32cea2d6f95d1d5dcc Mon Sep 17 00:00:00 2001 From: Tony Cook <tony@develop-help.com> Date: Mon, 6 May 2013 10:27:49 +1000 Subject: [PATCH 2/3] TODO test for calling the seek method on handle()'s result --- t/upload.t | 3 +++ 1 file changed, 3 insertions(+) diff --git a/t/upload.t b/t/upload.t index e6c22f9..4c43457 100644 --- a/t/upload.t +++ b/t/upload.t @@ -129,6 +129,9 @@ ok( defined $q->upload('300x300_gif') , 'upload_basic_4' ); # check it acts like a handle seek($rawhandle, 0, 2); is(tell($rawhandle), 1656, "check it acts like a handle"); + + local $TODO = "the handle points at a file it should have file methods"; + ok(eval { $rawhandle->seek(0, 2); 1 }, "can call seek() on handle result"); } my $q2 = CGI->new; -- 1.7.10.4
Subject: 0003-make-the-result-of-handle-an-IO-File-instead-of-IO-H.patch
From e099bc127502e8544445c46ccb4bb02fb1a0cd3a Mon Sep 17 00:00:00 2001 From: Tony Cook <tony@develop-help.com> Date: Mon, 6 May 2013 10:29:07 +1000 Subject: [PATCH 3/3] make the result of handle() an IO::File instead of IO::Handle --- lib/CGI.pm | 4 ++-- t/upload.t | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/CGI.pm b/lib/CGI.pm index df63490..20c7cfb 100644 --- a/lib/CGI.pm +++ b/lib/CGI.pm @@ -3894,8 +3894,8 @@ END_OF_FUNC 'handle' => <<'END_OF_FUNC', sub handle { my $self = shift; - eval "require IO::Handle" unless IO::Handle->can('new_from_fd'); - return IO::Handle->new_from_fd(fileno $self,"<"); + eval "require IO::File" unless IO::Handle->can('new_from_fd'); + return IO::File->new_from_fd(fileno $self,"<"); } END_OF_FUNC diff --git a/t/upload.t b/t/upload.t index 4c43457..31f7664 100644 --- a/t/upload.t +++ b/t/upload.t @@ -129,8 +129,6 @@ ok( defined $q->upload('300x300_gif') , 'upload_basic_4' ); # check it acts like a handle seek($rawhandle, 0, 2); is(tell($rawhandle), 1656, "check it acts like a handle"); - - local $TODO = "the handle points at a file it should have file methods"; ok(eval { $rawhandle->seek(0, 2); 1 }, "can call seek() on handle result"); } -- 1.7.10.4
Subject: 0001-test-the-handle-method.patch
From 74c703894960af45abf3f4ed11e1ac8f5169cd21 Mon Sep 17 00:00:00 2001 From: Tony Cook <tony@develop-help.com> Date: Mon, 6 May 2013 10:26:44 +1000 Subject: [PATCH 1/3] test the handle method --- t/upload.t | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/t/upload.t b/t/upload.t index 8be37db..e6c22f9 100644 --- a/t/upload.t +++ b/t/upload.t @@ -121,6 +121,16 @@ ok( defined $q->upload('300x300_gif') , 'upload_basic_4' ); is(tell($fh1), 1656, $test); } +{ # test handle() method + my $fh1 = $q->upload("300x300_gif"); + my $rawhandle = $fh1->handle; + ok($rawhandle, "check handle()"); + isnt($rawhandle, "300x300_gif", "no string overload"); + # check it acts like a handle + seek($rawhandle, 0, 2); + is(tell($rawhandle), 1656, "check it acts like a handle"); +} + my $q2 = CGI->new; { -- 1.7.10.4
Subject: Re: [rt.cpan.org #85074] [PATCH] handle() untested + calling seek() as a method on result
Date: Mon, 06 May 2013 17:18:49 -0400
To: bug-cgi.pm [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Thanks. A Github pull request would be preferred, if that's easy. Mark
CC: TONYC [...] cpan.org
Subject: Re: [rt.cpan.org #85074] [PATCH] handle() untested + calling seek() as a method on result
Date: Tue, 7 May 2013 08:16:21 +1000
To: "mark [...] summersault.com via RT" <bug-CGI.pm [...] rt.cpan.org>
From: Tony Cook <tony [...] develop-help.com>
Download (untitled) / with headers
text/plain 282b
On Mon, May 06, 2013 at 05:19:09PM -0400, mark@summersault.com via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=85074 > > > Thanks. > > A Github pull request would be preferred, if that's easy. > > Mark
Done: https://github.com/markstos/CGI.pm/pull/24 Tony
Download (untitled) / with headers
text/plain 241b
This issue has been copied to: https://github.com/leejo/CGI.pm/issues/117 please take all future correspondence there. This ticket will remain open but please do not reply here. This ticket will be closed when the github issue is dealt with.
Download (untitled) / with headers
text/plain 440b
commit 031101606bbfd07b5bc95fad487d1c2a920e0061 Author: Lee Johnson <lee@givengain.ch> Date: Sat Sep 20 16:42:17 2014 +0100 resolve #117 [rt.cpan.org #85074] - tests for handle Also, calling the seek() method on the result of handle() causes a method not found error. thanks to TONYC@cpan.org Changes | 1 + lib/CGI.pm | 14 +++++++------- t/upload.t | 11 +++++++++++ 3 files changed, 19 insertions(+), 7 deletions(-)


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.