Queue::Q::ReliableFIFO::Lua - Load lua scripts into Redis
use Queue::Q::ReliableFIFO::Lua; my $lua = Queue::Q::ReliableFIFO::Lua->new( script_dir => /some/path redis_conn => $redis_conn); $lua->call('myscript', $n, @keys, @argv);
This module offers two ways of loading/running lua scripts.
One way is with separate lua scripts, which live at a location as indicated by the script_dir parameter (passed to the constructor) or as indicated by the LUA_SCRIPT_DIR environment variable.
The other way is by putting the source code of the lua scripts in this module, in the %scripts hash.
Which way is actually used depends on whether or not passing info about a path to lua scripts. If a lua script location is known, those script will be used, otherwise the %scripts code is used.
During development it is more conveniant to use the separate lua files of course. But for deploying it is less error prone if the lua code is inside the perl module. So that is why this is done this way.
The scripts are loaded when the constructor is called.