Re: DWIM inc bundling design discussion (LONG)

Eric Wilhelm <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.module-build
Message-ID <[email protected]>
# from David Golden
# on Thursday 10 September 2009 12:57:

>(1b) For either choice in #1a, how should the behavior of “bundle_inc”
>change depending on whether $source/inc exists or is missing?

I think this asks the wrong question, but all of the questions are 
somewhat tangled-up around what or whether to do with existing data and 
how to turn off the DWIM.

I would prefer to say:

  if(-e "inc/latest.pm") { warn "you're on your own!\n" }
  else {
    inc::latest->write("$distdir/inc/latest.pm")
    inc::latest->bundle_module($_, $distdir)
      for(inc::latest->loaded_modules)
  }

But obviously we have to answer the other question "correctly" to even 
get to this question.  That is: that it should only automatically write 
the bundles in $distdir.

If you write anything in $source, you have to have some *other* big 
switch to turn all of the DWIM behavior off completely.  But then you 
have to have some little switches if some parts are not to be DWIM'd 
on.

If you go with the -e "inc/latest.pm", then anything else in inc/ is 
literal stuff.  (And anything that clashes with the DWIM is an error.)

I'm leaning toward all-or-nothing here.  That is, either you let M::B do 
it all or M::B lets you do it all.  Anything else seems like too much 
logic for what should IMO be a very minimal component.

For a hastily-written version, see http://pasta.test-smoke.org/100 -- 
this is not completely complete, but helps explain the code snippet 
above.

--Eric
-- 
"It works better if you plug it in!"
--Sattinger's Law
---------------------------------------------------
    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.