Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by 1nickt (Abbot)
on Jul 28, 2015 at 17:34 UTC ( #1136642=note: print w/replies, xml ) Need Help??


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 stevieb, test code is below. The dist in question is CMS::Drupal::Modules::MembershipEntity. As I mentioned I find it very odd since t/40_fetch_memberships.t failed whereas t/10_obj_and_params.t, t/20_valid_drupal.t, t/50_term_object_params.t and t/60_membership_object_params.t all passed. Also the error only occurred on Strawberry 5.14.3.

It really looks like the interpreter had a hiccup!

Error message:

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.

First 7 lines of Test/Exception.pm:

1: use strict; 2: use warnings; 3: 4: package Test::Exception; # <-- line cited in error message 5: use Test::Builder; 6: use Sub::Uplevel qw( uplevel ); 7: use base qw( Exporter );

This is t/40_fetch_memberships.t:

#! perl use strict; use warnings; BEGIN { ## Make sure we don't connect to our real DB if we ## have given the credentials for it $ENV{'DRUPAL_IGNORE_TEST_CREDS'} = 1; } use open ':std', ':encoding(utf8)'; use Test::More tests => 1; use Test::Group; use Test::Exception; # <-- line cited in error message use CMS::Drupal; use CMS::Drupal::Modules::MembershipEntity; use CMS::Drupal::Modules::MembershipEntity::Test; my $drupal = CMS::Drupal->new; my $dbh = build_test_db( $drupal ); my $ME = CMS::Drupal::Modules::MembershipEntity->new( dbh => $dbh +); subtest 'Feed various things to fetch_memberships()', sub { plan tests => 2; subtest 'Various arrays of valid mids', sub { plan tests => 10; for ( [], [3694], [3694, 2966], [3694, 2966, 42], [3302, 3358, 3414, 3470, 3530, 3582, 3638, 3694, 3750, 3948, + 3974, 4006, 4030, 4086], ) { my @array = @{ $_ }; my $hashref; lives_ok { $hashref = $ME->fetch_memberships( @array ) } 'Called fetch_memberships().'; my $cmp_data = build_test_data( @array ); test 'Data comparison with '. @array .' mids', sub { is( (scalar keys %{ $hashref }), (scalar keys %{ $cmp_data }), 'One item returned for each mid passed in' ); is_deeply($hashref, $cmp_data, 'Data matches' ); }; } }; subtest 'Various arrays with invalid mids', sub { plan tests => 4; for ( [3694, 'foo'], [3694, $ME], [3694, chr(0x263a)], [3694, sub { print "Hello, world\n" }], ) { my @array = @{ $_ }; dies_ok { my $hashref = $ME->fetch_memberships( @array ) } $arra +y[1]; } }; }; __END__
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 syphilis (Bishop) on Jul 29, 2015 at 01:03 UTC
    As I mentioned I find it very odd since t/40_fetch_memberships.t failed whereas t/10_obj_and_params.t, t/20_valid_drupal.t, t/50_term_object_params.t and t/60_membership_object_params.t all passed.

    In those test files, the one that fails is the only one that contains:
    use open ':std', ':encoding(utf8)';
    Could that be connected to the error ? (Comment it out and see whether the same error arises.)
    Does that line *have* to be situated before the loading of Test::Exception ?

    Cheers,
    Rob

      Thanks syphilis, it's worth a try. I'll make a new version and upload it tonight.


      The way forward always starts with a minimal test.
Re^3: Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...')
by Anonymous Monk on Jul 29, 2015 at 06:56 UTC
    Did you try to reproduce the problem without all that extra CMS stuff?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2019-06-25 23:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (108 votes). Check out past polls.

    Notices?