Checking if your kit is complete... Looks good Writing Makefile for Test::Without::Module Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. cp lib/Test/Without/Module.pm blib\lib\Test\Without\Module.pm Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. D:\cpanrun\build\5-6-1\bin\perl.exe -Mblib -Id:\cpanrun\build\5-6-1\lib -Id:\cpanrun\build\5-6-1\lib -e "use Test::Harness qw(&runtests $verbose); $verbose=1; runtests @ARGV;" t\01-api.t t\02-block-use-module.t t\03-block-require-module.t t\04-import-export.t t\99-manifest.t t\99-pod.t t\99-todo.t t\99-unix-text.t t\99-versions.t t\embedded-Test-Without-Module.t Using D:/cpanrun/depot/main/contrib-patched/perl/CPAN/src/Test-Without-Module/blib t\01-api............1..1 ok 1 - use Test::Without::Module; ok t\02-block-use-module.1..4 ok 1 - use Test::Without::Module; ok 2 - Module list ok 3 - Importing raises an error ok 4 - Hid module ok t\03-block-require-module.1..6 ok 1 - use Test::Without::Module; ok 2 - Loading raised error ok 3 - Hid module ok 4 - Module list not ok 5 - Local (require) confinement # TODO Implement lexical scoping # Failed (TODO) test (t\03-block-require-module.t at line 22) # got: 'Digest::MD5 did not return a true value at t\03-block-require-module.t line 21. # ' # expected: '' not ok 6 - Local (use) confinement # TODO Implement lexical scoping # Failed (TODO) test (t\03-block-require-module.t at line 25) # got: 'Digest/MD5.pm did not return a true value at (eval 5) line 2. # BEGIN failed--compilation aborted at (eval 5) line 2. # ' # expected: '' FAILED tests 5-6 Failed 2/6 tests, 66.67% okay t\04-import-export..1..3 ok 1 - use Test::Without::Module; ok 2 - Module list is empty ok 3 - unimport ok t\99-manifest.......1..8 ok 1 - MANIFEST exists ok 2 - No empty lines in MANIFEST ok 3 - No whitespace-only lines in MANIFEST ok 4 - No trailing whitespace on lines in MANIFEST ok 5 - MANIFEST.skip exists ok 6 - No empty lines in MANIFEST.skip ok 7 - No whitespace-only lines in MANIFEST.skip ok 8 - No trailing whitespace on lines in MANIFEST.skip ok t\99-pod............1..0 # Skip Test::Pod required for testing POD skipped: Test::Pod required for testing POD t\99-todo...........1..1 ok 1 - Looking for XXXes in blib\lib/Test/Without/Module.pm ok t\99-unix-text......1..1 not ok 1 - 'blib\lib/Test/Without/Module.pm' contains no windows newlines # Failed test (t\99-unix-text.t at line 33) # got: '164' # expected: '0' # 0: package Test::Without::Module; # 1: use strict; # 2: use Carp qw( croak ); # 3: # 4: use vars qw( $VERSION ); # 5: $VERSION = 0.11; # 6: # 7: use constant SLOT => "Test::Without::Module::scope"; # 8: use constant REQUIRE_ERROR => q/Can't locate %s.pm in @INC (@INC contains: %s)/; # 9: # 10: use vars qw( %forbidden ); # 11: # 12: sub get_forbidden_list { # 13: \%forbidden # 14: }; # 15: # 16: sub import { # 17: my ($self,@forbidden_modules) = @_; # 18: # 19: # First, create a local copy of the active scope # 20: my $forbidden = get_forbidden_list; # 21: $forbidden->{$_} = $_ # 22: for @forbidden_modules; # 23: # 24: # Scrub %INC, so that loaded modules disappear # 25: for my $module (@forbidden_modules) { # 26: scrub( $module ); # 27: }; # 28: # 29: unshift @INC, \&fake_module ; # 30: }; # 31: # 32: sub fake_module { # 33: my ($self,$module_file,$member_only) = @_; # 34: warn $@ if $@; # 35: # 36: my $forbidden = get_forbidden_list; # 37: # 38: my $modulename = file2module($module_file); # 39: # 40: # Deliver a faked, nonworking module # 41: if (grep { $modulename =~ $_ } keys %$forbidden) { # 42: my @faked_module = ("package $modulename;","0;"); # 43: return sub { defined ( $_ = shift @faked_module ) }; # 44: }; # 45: }; # 46: # 47: sub unimport { # 48: my ($self,@list) = @_; # 49: my $module; # 50: my $forbidden = \%forbidden; # 51: for $module (@list) { # 52: if (exists $forbidden->{$module}) { # 53: delete $forbidden->{$module}; # 54: scrub( $module ); # 55: } else { # 56: croak "Can't allow non-forbidden module $module"; # 57: }; # 58: }; # 59: }; # 60: # 61: sub file2module { # 62: my ($mod) = @_; # 63: $mod =~ s!/!::!g; # 64: $mod =~ s!\.pm$!!; # 65: $mod; # 66: }; # 67: # 68: sub scrub { # 69: my ($module) = @_; # 70: my $key; # 71: for $key (keys %INC) { # 72: delete $INC{$key} # 73: if (file2module($key) =~ $module); # 74: }; # 75: }; # 76: # 77: 1; # 78: # 79: =head1 NAME # 80: # 81: Test::Without::Module - Test fallback behaviour in absence of modules # 82: # 83: =head1 SYNOPSIS # 84: # 85: =for example begin # 86: # 87: use Test::Without::Module qw( My::Module ); # 88: # 89: # Now, loading of My::Module fails : # 90: eval { require My::Module; }; # 91: warn $@ if $@; # 92: # 93: # Now it works again # 94: eval q{ no Test::Without::Module qw( My::Module ) }; # 95: eval { require My::Module; }; # 96: print "Found My::Module" unless $@; # 97: # 98: =for example end # 99: # 100: =head1 DESCRIPTION # 101: # 102: This module allows you to deliberately hide modules from a program # 103: even though they are installed. This is mostly useful for testing modules # 104: that have a fallback when a certain dependency module is not installed. # 105: # 106: =head2 EXPORT # 107: # 108: None. All magic is done via C and # 109: C. # 110: # 111: =head2 Test::Without::Module::get_forbidden_list # 112: # 113: This function returns a reference to a copy of the current hash of forbidden # 114: modules or an empty hash if none are currently forbidden. This is convenient # 115: if you are testing and/or debugging this module. # 116: # 117: =cut # 118: # 119: =head1 ONE LINER # 120: # 121: A neat trick for using this module from the command line # 122: was mentioned to me by NUFFIN: # 123: # 124: perl -MTest::Without::Module=Some::Module -w -Iblib/lib t/SomeModule.t # 125: # 126: That way, you can easily see how your module or test file behaves # 127: when a certain module is unavailable. # 128: # 129: =head1 BUGS # 130: # 131: =over 4 # 132: # 133: =item * There is no lexicalic scoping # 134: # 135: =back # 136: # 137: =head1 CREDITS # 138: # 139: Much improvement must be thanked to Aristotle from PerlMonks, he pointed me # 140: to a much less convoluted way to fake a module at # 141: L. # 142: # 143: I also discussed with him an even more elegant way of overriding # 144: CORE::GLOBAL::require, but the parsing of the overridden subroutine # 145: didn't work out the way I wanted it - CORE::require didn't recognize # 146: barewords as such anymore. # 147: # 148: NUFFIN and Jerrad Pierce pointed out the convenient # 149: use from the command line to interactively watch the # 150: behaviour of the test suite and module in absence # 151: of a module. # 152: # 153: =head1 AUTHOR # 154: # 155: Max Maischein, Ecorion@cpan.orgE # 156: # 157: =head1 SEE ALSO # 158: # 159: L, L, L # 160: # 161: =cut # 162: # 163: __END__ # Looks like you failed 1 test of 1. dubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 1 Failed 1/1 tests, 0.00% okay t\99-versions.......1..0 # Skip File::Slurp needed for testing skipped: File::Slurp needed for testing t\embedded-Test-Without-Module.ok 1 # skip Need module My::Module to run this test 1..1 FAILED test 1 Failed 1/1 tests, 0.00% okay Failed Test Status Wstat Total Fail Failed List of Failed -------------------------------------------------------------------------------- t\03-block-require-module.t 6 2 33.33% 5-6 t\99-unix-text.t 1 256 1 1 100.00% 1 t\embedded-Test-Without-Module.t 1 1 100.00% 1 2 tests skipped. Failed 3/10 test scripts, 70.00% okay. 4/25 subtests failed, 84.00% okay. NMAKE : fatal error U1077: 'D:\cpanrun\build\5-6-1\bin\perl.exe' : return code '0xff' Stop.