Skip to content

Commit

Permalink
Directory path separator should be / on MSWin32, not \.
Browse files Browse the repository at this point in the history
  • Loading branch information
neilb committed Aug 27, 2012
1 parent 43de3ab commit 9310992
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Revision history for perl module Module::Path

0.03 2012-08-27
- Directory separator should be / and not \ on MSWin32.
Thanks to kmx for helping me identify the issue.

0.02 2012-08-26
- bugfix in initialisation of separator (Tom Molesworth)
- Added github repo to metadata and documentation
Expand Down
2 changes: 1 addition & 1 deletion dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ license = Perl_5
copyright_holder = Neil Bowers
copyright_year = 2012

version = 0.02
version = 0.03

[@Basic]
[PkgVersion]
Expand Down
4 changes: 2 additions & 2 deletions lib/Module/Path.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ our @EXPORT_OK = qw(module_path);
my $SEPARATOR;

BEGIN {
if ($^O =~ /^(MSWin|dos|os2)/i) {
if ($^O =~ /^(dos|os2)/i) {
$SEPARATOR = '\\';
} elsif ($^O =~ /^MacOS/i) {
$SEPARATOR = ':';
} else {
$SEPARATOR = '/';
$SEPARATOR = '/';
}
}

Expand Down
11 changes: 9 additions & 2 deletions t/02-module-path.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ use Module::Path 'module_path';

# This test does "use strict", so %INC should include the path where
# strict.pm was found, and module_path should find the same
ok(module_path('strict') eq $INC{'strict.pm'});
ok(module_path('strict') eq $INC{'strict.pm'},
"check 'strict' matches \%INC") || do {
warn "\n",
" \%INC : $INC{'strict.pm'}\n",
" module_path : ", (module_path('strict') || 'undef'), "\n",
" \$^O : $^O\n";
};

# module_path() returns undef if module not found in @INC
ok(not defined module_path('No::Such::Module'));
ok(!defined(module_path('No::Such::Module')),
"non-existent module should result in undef");

0 comments on commit 9310992

Please sign in to comment.