-----Original Message-----
From: Jason McCarver via RT
.......... so then it's back to how does I::MM know which modules need to
be 'use'ed. My attempt at a
solution was to force the programmer to explicitly tell I::MM by way of
the INLINE_MODULES argument. I do agree it would be better to not have
to do that. However I believe that would mean one of the following
would need to be done:
- shotgun approach and 'use' all modules in the distribution (seems ugly,
possibly error-prone)
When I build the Foo.tar.gz source that you provided against Inline-0.55
(having first removed the "INLINE_MODULES => [qw(Foo::Bar Foo::Bar::Baz)],"
entry in the Makefile.PL), at the make stage the following commands get run:
###########################
C:\_32\pscrpt\Foo-broken>dmake
cp lib/Foo/Bar/Baz.pm blib\lib\Foo\Bar\Baz.pm
cp lib/Foo.pm blib\lib\Foo.pm
cp lib/Foo/Bar.pm blib\lib\Foo\Bar.pm
C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ -MFoo -e1 2.01
blib\arch
###########################
The commands we really want to be run there are:
###########################
C:\_32\pscrpt\Foo-broken>dmake
cp lib/Foo/Bar/Baz.pm blib\lib\Foo\Bar\Baz.pm
cp lib/Foo.pm blib\lib\Foo.pm
cp lib/Foo/Bar.pm blib\lib\Foo\Bar.pm
C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ -MFoo -e1 2.01
blib\arch
C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ -MFoo::Bar -e1
2.01 blib\arch
C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ -MFoo::Bar::Baz
-e1 2.01 blib\arch
###########################
In fact, the
"C:\MinGW\Perl516\bin\perl.exe -Mblib -MInline=NOISY,_INSTALL_ -MFoo -e1
2.01 blib\arch" command is not needed - but it doesn't do any harm. (Foo.pm
does not use Inline, not does it use a module that uses Inline, so nothing
gets installed as a result of running that command.)
Therefore, instead of the generated Makefile terminating with the following
(generated by Inline::MakeMaker):
###########################
# Well, not quite. Inline::MakeMaker is adding this:
# --- MakeMaker inline section:
Foo.inl : $(TO_INST_PM)
$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -MFoo -e1 2.01 $(INST_ARCHLIB)
pure_all :: Foo.inl
# The End is here.
###########################
we want it to terminate with:
###########################
# Well, not quite. Inline::MakeMaker is adding this:
# --- MakeMaker inline section:
Foo.inl : $(TO_INST_PM)
$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -MFoo -e1 2.01 $(INST_ARCHLIB)
pure_all :: Foo.inl
Bar.inl : $(TO_INST_PM)
$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -MFoo::Bar -e1 2.01
$(INST_ARCHLIB)
pure_all :: Bar.inl
Baz.inl : $(TO_INST_PM)
$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -MFoo::Bar::Baz -e1 2.01
$(INST_ARCHLIB)
pure_all :: Baz.inl
# The End is here.
###########################
And I think it would be straightforward to get Inline::MakeMaker to do this.
I::MM simply has to recurse through the ./lib folder and create the relevant
entry in the Makefile for every pm file it finds (irrespective of whether
that pm file actually uses Inline).
I think this corresponds to your "shotgun" approach.
I don't think it's ugly. For sure it's an unnecessary step for the modules
that don't use Inline but (for those modules) it does no harm other than to
consume a fraction of a second during the make stage.
It becomes (possibly) error prone when someone wants to bundle something
like:
Foo
Foo::Bar
Foo::lib::Bar
but I'd quite happily wait to cross that bridge if and when we come to it.
OTOH, it would require no new config options and no change to any
documentation. All we need to do is to have I::MM loop recursively through
the ./lib directory (if such a directory exists).
What do you think ?
I'll probably be without an internet connection from Thursday night until
Monday night, but I'll take my laptop with me and test out a proof of
concept regarding this proposal over that period.
Cheers,
Rob