Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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

by ikegami (Pope)
on Jul 28, 2015 at 18:30 UTC ( #1136652=note: print w/replies, xml ) Need Help??


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

The line endings of C:/strawberry5143/perl/vendor/lib/Test/Exception.pm (or  t/40_fetch_memberships.t?) need to be converted from LF to CRLF.

Replies are listed 'Best First'.
Re^2: Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...')
by 1nickt (Abbot) on Jul 28, 2015 at 21:30 UTC

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

    • How would incorrect line ending characters cause this error?
    • If an incorrect line ending caused the code to be broken into two lines, why wouldn't the first resultant line throw an error first? (Presumably it would be package Test::E)
    • Why don't the previous tests that also use Test::Exception throw the same error?
    • Why doesn't the same combination of Test::Exception and this test (from the same tarball) cause the same error on two other versions of Strawberry Perl running on the same hardware?

      Update: I guess there will be a different copy of the library files for each installed version of Strawberry Perl. So this would suggest that the test machine has a corrupted version of Test::Exception for that one Perl version?

    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.

      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?

      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1136652]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (10)
As of 2019-07-19 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?