<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 03/22/2011 02:22 PM, Fulko Hew wrote:
<blockquote
cite="mid:AANLkTi=gomWT7=LmYnyPx8f4OS5xP9019zGsab8inzhJ@mail.gmail.com"
type="cite"><font face="courier new,monospace">I don't know if I'm
doing this right, or in the best manner...<br>
<br>
a) I have a compiler that generates Perl classes/source files
based on data you feed it.<br>
b) People then write applications that 'include' those source
files.<br>
<br>
Right now I have been using (for example) 'require "<a
moz-do-not-send="true" href="http://module1.pm">module1.pm</a>";'
in the applications.<br>
Which is great as long as I don't need to have the application
run out of a<br>
non-current-working-directory.<br>
<br>
But now I have a situation where the generated modules have 'use
constant' in them<br>
and I need to have the callers be able to use those constants
easily.<br>
<br>
At the moment they need to do $x = Module1::CONSTANT_1(); in
order for it to work.<br>
Something more natural would be </font><font face="courier
new,monospace">$x = Module1::CONSTANT_1; ie. without the parens.<br>
</font><br>
<font face="courier new,monospace">To do that I need to use
export/import (right?)<br>
And the only way to do that is something like 'use module qw/</font><font
face="courier new,monospace">CONSTANT_1/;<br>
<br>
But then I'm using USE, not REQUIRE, and then the modules need
to be installed<br>
in a standard directory... and the problem then mushrooms.<br>
<br>
Then I find out about 'use lib', but it only knows about
explicitly defined<br>
directories. And 'use lib' isn't any different than didling the
@INC variable<br>
anyway. And there doesn't seem to be an easy way of didling
either to get it<br>
to include the 'invoked' directory (only the
current-working-dirctory).<br>
<br>
I figure its easier to ship the executable and its modules in a
single<br>
directory, than to ship the executable (where the user can put
it anywhere<br>
they want) and then force the user to 'install' the remaining
modules.<br>
<br>
<br>
Whats a guy to do?<br>
(Ah, statically compiled executables sure are looking easy right
about now!)<br>
<br>
Comments?<br>
Fulko<br>
<br>
</font>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
toronto-pm mailing list
<a class="moz-txt-link-abbreviated" href="mailto:toronto-pm@pm.org">toronto-pm@pm.org</a>
<a class="moz-txt-link-freetext" href="http://mail.pm.org/mailman/listinfo/toronto-pm">http://mail.pm.org/mailman/listinfo/toronto-pm</a>
</pre>
</blockquote>
Look into the Readonly and FindBin modules combined with use lib.<br>
<br>
Cheers,<br>
Matt
</body>
</html>