[tpm] use from a local directory

Fulko Hew fulko.hew at gmail.com
Tue Mar 22 11:22:31 PDT 2011

I don't know if I'm doing this right, or in the best manner...

a) I have a compiler that generates Perl classes/source files based on data
you feed it.
b) People then write applications that 'include' those source files.

Right now I have been using (for example) 'require "module1.pm";' in the
Which is great as long as I don't need to have the application run out of a

But now I have a situation where the generated modules have 'use constant'
in them
and I need to have the callers be able to use those constants easily.

At the moment they need to do $x = Module1::CONSTANT_1(); in order for it to
Something more natural would be $x = Module1::CONSTANT_1; ie. without the

To do that I need to use export/import (right?)
And the only way to do that is something like 'use module  qw/CONSTANT_1/;

But then I'm using USE, not REQUIRE, and then the modules need to be
in a standard directory... and the problem then mushrooms.

Then I find out about 'use lib', but it only knows about explicitly defined
directories.  And 'use lib' isn't any different than didling the @INC
anyway.  And there doesn't seem to be an easy way of didling either to get
to include the 'invoked' directory (only the current-working-dirctory).

I figure its easier to ship the executable and its modules in a single
directory, than to ship the executable (where the user can put it anywhere
they want) and then force the user to 'install' the remaining modules.

Whats a guy to do?
(Ah, statically compiled executables sure are looking easy right about now!)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20110322/f6d65e26/attachment.html>

More information about the toronto-pm mailing list