Re: thoughts on DWIM bundling

Eric Wilhelm <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.module-build
Message-ID <[email protected]>
# from John Peacock
# on Tuesday 08 September 2009 09:10:

>I don't see #2 as necessarily being /more/ correct; the author has
>[presumably] tested with the packages installed in the current Perl
>library path.

Yes.  An author should always have the same thing on their system that 
they're putting in their bundle.  I think it's also going to be 
difficult to set inc/ as a target for various cpan clients (maybe 
requires local::lib.)

But possibly just refuse to bundle anything you can't find a .packlist 
for.  If the author upgrades it from the CPAN, they'll have .packlists, 
right?  (cue "what if" about core's packlists being inconsistent => fix 
the inconsistent bit.)

>On the other hand, if the disttest target made sure that _only_ the
>./inc modules were used during the testing, that would strike me as a
>belt and suspenders arrangement.

That's part of the trick that inc::latest->import needs to figure out.  
I'm thinking that import() doesn't do any of the actual copying (this 
is not the case with inc::Module::Install.)

With some discussion on irc, we've concluded that:

  1) inc::latest is a fine name
  2) if -e inc/latest.pm => goto inc/latest.pm
  3) else, see author-mode import()
  4) Build.PL needs to remember inc::latest->loaded_modules
  5) ACTION_dist (or something) puts those --^ in $dist_dir/inc/inc_...
      (using .packlists only) and ensures they are in configure_requires

#3 - author-mode import() is like: require $mod; $mod->import(@args),  
push(@loaded_modules, $mod) -- that is: has no dealings with inc/

Because of #2, you have a clear way to sidestep the DWIM by making and 
populating your own inc/.  If you do this, you're on your own -- you do 
the MANIFEST thing and all that.

So, in #5, we're only doing inc::latest->write($dist_dir) and 
copying .pm files (as per their packlists) into $dist_dir/inc.  Thus, 
the ./inc/latest.pm is never there when a DWIM author runs `perl 
Build.PL` from their repository.

This implies that the author-mode (found in @INC) inc::latest is a 
completely different module than the ./inc/latest.pm.

--Eric
-- 
perl -e 'srand; print join(" ",sort({rand() < 0.5}
  qw(sometimes it is important to be consistent)));'
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.