Loading ljlib.pl in commandline scripts
Sep. 13th, 2012 05:16 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Just a quick FYI: from now on, anything run from the command line that loads the ljlib.pl library will need to use the following code:
BEGIN { require 'ljlib.pl' }
Instead of just:
require 'ljlib.pl';
This is needed for workers, scripts, and tests.
The old way used to work back when we were copying everything over to a single directory. Now that the code could be from one of several different directories, we have to have a bit of extra logic when setting things up, so we need to make sure that ljlib.pl is loaded early enough in the process.
I've updated all the various command line things that need this, so you should be good to go if you follow the way that other scripts have set it up.
If you ever run into the error Undefined subroutine &LJ::get_all_directories called at...
when writing/running your own scripts, this would be why. Just make sure to wrap that require of ljlib.pl in BEGIN and that should get things working.
Further info here: * Bug 4631 * discussion on the pull request on github