Microsoft (R) Program Maintenance Utility Version 7.00.8882 Copyright (C) Microsoft Corp 1988-2000. All rights reserved. C:\cpanrun-5.8\build\5-8-0\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(1, 'blib\lib', 'blib\arch')" 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 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 3) line 2. # BEGIN failed--compilation aborted at (eval 3) line 2. # ' # expected: '' ok 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..1 ok 1 - POD test for blib\lib/Test/Without/Module.pm ok 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: '166' # expected: '0' # 0: package Test::Without::Module; # 1: use strict; # 2: use Carp qw( croak ); # 3: # 4: use vars qw( $VERSION ); # 5: $VERSION = 0.15; # 6: # 7: use vars qw( %forbidden ); # 8: # 9: sub get_forbidden_list { # 10: \%forbidden # 11: }; # 12: # 13: sub import { # 14: my ($self,@forbidden_modules) = @_; # 15: # 16: my $forbidden = get_forbidden_list; # 17: $forbidden->{$_} = $_ # 18: for @forbidden_modules; # 19: # 20: # Scrub %INC, so that loaded modules disappear # 21: for my $module (@forbidden_modules) { # 22: scrub( $module ); # 23: }; # 24: # 25: unshift @INC, \&fake_module; # 26: }; # 27: # 28: sub fake_module { # 29: my ($self,$module_file,$member_only) = @_; # 30: #warn $@ if $@; # Don't touch $@, or .al files will not load anymore???? # 31: # 32: my $forbidden = get_forbidden_list; # 33: # 34: my $modulename = file2module($module_file); # 35: # 36: # Deliver a faked, nonworking module # 37: #if (grep { $modulename =~ /\Q$_\E/ } keys %$forbidden) { # 38: if (exists $forbidden->{$modulename}) { # 39: my @faked_module = ("package $modulename;","0;"); # 40: return sub { defined ( $_ = shift @faked_module ) }; # 41: }; # 42: }; # 43: # 44: sub unimport { # 45: my ($self,@list) = @_; # 46: my $module; # 47: my $forbidden = \%forbidden; # 48: for $module (@list) { # 49: if (exists $forbidden->{$module}) { # 50: delete $forbidden->{$module}; # 51: scrub( $module ); # 52: } else { # 53: croak "Can't allow non-forbidden module $module"; # 54: }; # 55: }; # 56: }; # 57: # 58: sub file2module { # 59: my ($mod) = @_; # 60: $mod =~ s!/!::!g; # 61: $mod =~ s!\.pm$!!; # 62: $mod; # 63: }; # 64: # 65: sub scrub { # 66: my ($module) = @_; # 67: my $key; # 68: for $key (keys %INC) { # 69: delete $INC{$key} # 70: if (file2module($key) =~ /\Q$module\E$/); # 71: #if (file2module($key) =~ $module); # 72: }; # 73: }; # 74: # 75: 1; # 76: # 77: =head1 NAME # 78: # 79: Test::Without::Module - Test fallback behaviour in absence of modules # 80: # 81: =head1 SYNOPSIS # 82: # 83: =for example begin # 84: # 85: use Test::Without::Module qw( My::Module ); # 86: # 87: # Now, loading of My::Module fails : # 88: eval { require My::Module; }; # 89: warn $@ if $@; # 90: # 91: # Now it works again # 92: eval q{ no Test::Without::Module qw( My::Module ) }; # 93: eval { require My::Module; }; # 94: print "Found My::Module" unless $@; # 95: # 96: =for example end # 97: # 98: =head1 DESCRIPTION # 99: # 100: This module allows you to deliberately hide modules from a program # 101: even though they are installed. This is mostly useful for testing modules # 102: that have a fallback when a certain dependency module is not installed. # 103: # 104: =head2 EXPORT # 105: # 106: None. All magic is done via C and # 107: C. # 108: # 109: =head2 Test::Without::Module::get_forbidden_list # 110: # 111: This function returns a reference to a copy of the current hash of forbidden # 112: modules or an empty hash if none are currently forbidden. This is convenient # 113: if you are testing and/or debugging this module. # 114: # 115: =cut # 116: # 117: =head1 ONE LINER # 118: # 119: A neat trick for using this module from the command line # 120: was mentioned to me by NUFFIN: # 121: # 122: perl -MTest::Without::Module=Some::Module -w -Iblib/lib t/SomeModule.t # 123: # 124: That way, you can easily see how your module or test file behaves # 125: when a certain module is unavailable. # 126: # 127: =head1 BUGS # 128: # 129: =over 4 # 130: # 131: =item * There is no lexicalic scoping # 132: # 133: =back # 134: # 135: =head1 CREDITS # 136: # 137: Much improvement must be thanked to Aristotle from PerlMonks, he pointed me # 138: to a much less convoluted way to fake a module at # 139: L. # 140: # 141: I also discussed with him an even more elegant way of overriding # 142: CORE::GLOBAL::require, but the parsing of the overridden subroutine # 143: didn't work out the way I wanted it - CORE::require didn't recognize # 144: barewords as such anymore. # 145: # 146: NUFFIN and Jerrad Pierce pointed out the convenient # 147: use from the command line to interactively watch the # 148: behaviour of the test suite and module in absence # 149: of a module. # 150: # 151: =head1 AUTHOR # 152: # 153: Copyright (c) 2003-2007 Max Maischein, Ecorion@cpan.orgE # 154: # 155: =head1 LICENSE # 156: # 157: This module is released under the same terms as Perl itself. # 158: # 159: =head1 SEE ALSO # 160: # 161: L, L, L, L # 162: # 163: =cut # 164: # 165: __END__ # Looks like you failed 1 tests of 1. dubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED test 1 Failed 1/1 tests, 0.00% okay t\99-versions.....................# Checking for $VERSION = 0.15; ok 1 - blib/lib/Test/Without/Module.pm 1..1 ok t\embedded-Test-Without-Module....ok 1 # skip Need module My::Module to run this test 1..1 ok 1/1 skipped: Need module My::Module to run this test Failed 1/10 test scripts, 90.00% okay. 1/27 subtests failed, 96.30% okay. Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------------- t\99-unix-text.t 1 256 1 1 100.00% 1 1 subtest skipped. NMAKE : fatal error U1077: 'C:\cpanrun-5.8\build\5-8-0\bin\perl.exe' : return code '0xff' Stop.