perl - How do I access sub-directories (t, scripts) in my module's root installation directory? -


The module Foo :: bar is installed anywhere in @INC .

, then script or for

@INC In addition to continuous check for , what is the method of accessing those modules to those modules from the module?

For example, I would like to call a special script in lib / scripts / findmeifyoucan .pl to Foo / Bar.pm . % Inc

You can find it relative to the corresponding code, to know For where the associated code resides:

  Package Foo: Bar; #This code resides in ... something ... / lib / Foo / Bar.pm package unrelated; Use the file: Spec; Use Foo :: Bar; My $ filename = 'Foo / Bar.pm'; (My $ libpath = $ INC {$ filename}) = ~ s # / \ Q $ filename \ E $ ## g; ## Strip / and File Name My $ script = file :: spec-> catfile ($ libpath, qw (scripts findmeifyoucan.pl));  

Comments