Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the IO-CaptureOutput CPAN distribution.

Report information
The Basics
Id: 31153
Status: resolved
Priority: 0/
Queue: IO-CaptureOutput

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

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



Subject: Subroutines must be 'use-d'; 'use_ok' insufficient
Am exploring the possibility of bringing IO::CaptureOutput into the Parrot distribution for the purpose of capturing output, replacing Parrot::IO::Capture::Mini (which is essentially a stripped-down IO::Capture). So far I have observed the following: 1. Contrary to an example from the POD, I get a syntax error if I fail to include an open parenthesis between 'capture' and 'sub' (along with a corresponding close-paren at the end of the statement). 2. If in a test file, I import sub foo() by wrapping it in a Test::More::use_ok test, I encounter a "Undefined subroutine &main::foo called at ..." error. However, when I perform the import by taking it out of the test suite, 'use foo;', that error is corrected. I suspect that is because use_ok is a run-time operation. To test this out, check out Parrot trunk and try to adapt t/configure/001-options.t to use IO::CaptureOutput instead of Parrot::IO::Capture::Mini. Then compare my first passes at using CaptureOutput here: http://svn.perl.org/parrot/branches/capture/t/configure/001-options.t http://svn.perl.org/parrot/branches/capture/t/configure/142-auto_aio-02.t Jim Keenan
Show quoted text
> 2. If in a test file, I import sub foo() by wrapping it in a > Test::More::use_ok test, I encounter > a "Undefined subroutine &main::foo called at ..." error. However, > when I perform the import > by taking it out of the test suite, 'use foo;', that error is > corrected. I suspect that is because > use_ok is a run-time operation.
Is your use_ok wrapped in a BEGIN {} block as described by the Test::More documentation? If not, the imported subroutines don't get installed in the symbol table until runtime -- after compilation has tried to find foo (and failed). Show quoted text
> 1. Contrary to an example from the POD, I get a syntax error if I > fail to include an open > parenthesis between 'capture' and 'sub' (along with a corresponding > close-paren at the end > of the statement).
This sounds like an issue with when the import happened above. I can remove the parentheses and prove on that file works fine on my perl 5.8.8 on linux. David
Latest release explains how to use with and without prototype. Thanks, David