Someone else please let me know if this is right, but my understanding was that you w/could do something like the following in a crontab(5) for such a thing:
DBUILDER_DIR=/home/indy/source/dbuilder
* */6 * * * $DBUILDER_DIR/scripts/spamburglar.pl
To my knowledge, you don't have to put an environment variable definition in a cron entry on the same line, but can put it above entries if it affects more than one, or is more readable that way. Then, in your code, I am thinking you w/could do something like:
unless (defined($ENV{'DBUILDER_DIR'})) {
$ENV{'DBUILDER_DIR'} = '..';
}
use lib "$ENV{'DBUILDER_DIR'}/lib";
I haven't used the use lib... pragma you are using before, but I hope this either proves helpful in itself, or results in a more knowledgable monk posting to correct my misunderstanding, enlightening us both. My best in your quest for this knowledge.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|