http://www.perlmonks.org?node_id=1136669


in reply to Re: Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...')
in thread Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...')

Hi, ikegami. Thanks for your repy, but I don't understand it:

Thanks for helping me figure this out. Note this is not on my machine but on chorny's at CPAN testers.

Update 2: Added question #2
The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^3: Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...')
by ikegami (Pope) on Jul 29, 2015 at 15:18 UTC

    It's part of the handling of #! lines. Perl reads a block, then tries to undo the read, but it doesn't have all the necessary information to do so, so it guesses. The end result is that it thinks the file is

    xception; use Test::Builder; use Sub::Uplevel qw( uplevel ); use base qw( Exporter ); ...
    instead of
    use strict; use warnings; package Test::Exception; use Test::Builder; use Sub::Uplevel qw( uplevel ); use base qw( Exporter ); ...

    Or something like that. There are holes in that explanation. For example, how could strict subs be on when it encountered "xception"? But while I can't quite explain the result in this specific case, I'm quite sure about the cause. If I'm wrong, well, I only wasted a minute of your time. Did you try my fix?

Re^3: Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...')
by Anonymous Monk on Jul 28, 2015 at 23:32 UTC

    How would incorrect line ending characters cause this error?

    It wouldn't because perl doesn't care about crlf or lf line endings

    ikegami is assuming a cause because of "xception" which suggests an "\r" got into the output stream .... its just causing your shell to hide more of the message

      I don't think it's the output stream from the test harness. The message seems complete:

      Bareword "xception" not allowed while "strict subs" in use at C:/straw +berry5143/perl/vendor/lib/Test/Exception.pm line 4. Compilation failed in require at t/40_fetch_memberships.t line 14. BEGIN failed--compilation aborted at t/40_fetch_memberships.t line 14.

      So if an "\r" or something like that got into the input stream, and caused line 4 of Test::Exception to be split as it was being read, why wouldn't the first half of the line cause an error?

      package Test::E

      (with no semicolon at the end of the "line")?

      The way forward always starts with a minimal test.

        I don't think...

        :) You don't have to, when ikegami has something worth saying, its not cryptic or confusing, you don't really have to decipher it