[ABE.pm] recent code

Lidie Steve sol0 at lehigh.edu
Sun Jul 4 22:30:53 CDT 2004


On Jul 4, 2004, at 10:55 PM, Ricardo SIGNES wrote:

> * Lidie Steve <sol0 at Lehigh.EDU> [2004-07-04T22:44:58]
>
>>> Nope!  -Mblib will only find blib and put it into your path.  It 
>>> won't
>>> actually use the code in there.  So, this would've worked:
>>>
>>> perl -Mblib -MAcme::ProgressBar -e'progress {sleep 5}'
>>
>> But it always works for *my* modules ;) (and typically others!).  Then
>> again, they're mostly Tk modules.
>
> Well, there's two ways to guess at why that worked!  One is that Tk
> automatically requires modules as needed.  (I'm guessing, but it seems
> reasonable.)  That is, you say something like

Well, it can/does if it's installed, but not otherwise.  Nick is very 
clever.

> $window->addWidget('Mirror') and it goes and requires
> Tk::Widget::Mirror.  Since you've used blib, it knows to look for that
> in blib, so it finds it.
>
> As for the other...
>
>>> I never use blib, for no good reason.  I always use -I lib, since it
>>> saves me having to 'make' before testing.
>>>
>>
>> Do not grok, grasshopper.
>>
>> For brevity this always works for me:
>>
>> perl Makefile.PL
>> make test
>> perl -Mblib examples/progress1.pl
>
> Aha!  So you're using blib and then running a script... but that 
> script,
> surely, has 'use Your::Code' in it, so it knows where to find stuff.
> So, it's like saying -Mblib -MYour::Code

But of course.  That way my examples run before installation if invoked 
in the installation directory with -Mblib, else anywhere after 
installation, without a code change, so the user has a fully functional 
example.

>
> -I lib adds "lib" to the @INC path.  -Mblib looks through directories
> under .  trying to find one named blib, and when it does, it adds it to
> the @INC path.  That's all.  So, the modules you need still need to be
> required/used elsewhere.
>
> Code only gets put into blib when you run make.  I usually leave my 
> code
> sitting in lib for casual testing, of which I do a lot, since it saves
> me a step of 'make'-ing and I can just run the tests I care about with
> the 'prove' program from Test-Harness.
>

I grok now.  And I just repeat a "make; perl -Mblib examples.frog.pl" 
... interesting.




More information about the ABE-pm mailing list