Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix for issue 15
  • Loading branch information
ingydotnet committed Dec 18, 2014
1 parent 17c85ec commit 76ea880
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/Inline/Module.pm
Expand Up @@ -34,10 +34,14 @@ sub import {
my ($stub_module, $program) = caller;

if ($program eq 'Makefile.PL' && not -e 'INLINE.h') {
$class->check_inc_inc($program);
no warnings 'once';
*MY::postamble = \&postamble;
return;
}
elsif ($program eq 'Build.PL') {
$class->check_inc_inc($program);
}

return unless @_;
my $cmd = shift;
Expand Down Expand Up @@ -75,6 +79,21 @@ Make sure you have the latest version of Inline::Module installed, then run:
}
}

sub check_inc_inc {
my ($class, $program) = @_;
my $first = $INC[0] or die;
if ($first !~ /^(\.[\/\\])?inc[\/\\]?$/) {
die <<"...";
First element of \@INC should be 'inc'.
It's '$first'.
Add this line to the top of your '$program':
use lib 'inc';
...
}
}

sub importer {
my ($class, $stub_module) = @_;
return sub {
Expand Down

0 comments on commit 76ea880

Please sign in to comment.