krang_exec - run some piece of code under the Krang install
Run an external script
$ krang_exec < script.pl
Run a simple command
$ krang_exec -e "print $ENV{KRANG_INSTANCE}"
Run an SQL query and print the results
$ krang_exec -qpe "SELECT COUNT(*) FROM story"
Sometimes it's extremely useful to be able to run a script or command for each installed instance of Krang. This makes it really easy to do so. It takes care of making sure all the paths to libraries are setup correctly, addons are loaded and other niceties.
By default it executes what's coming from STDIN.
If you don't want to use STDIN to send the code, just use this. Similar to perl's
-e, it's really only useful for short quick things.
Similar to perl's -M option, loads a module after setting up the paths
and environment.
Similar to perl's -M option, loads an Krang module after setting up the paths
and environment. You don't need to specify the 'Krang::' prefix of the module either.
Although it won't hurt anything.
By default it will execute the same command for all instances. Specify the single instance if you don't want to do that.
If you want to skip an instance simply use this option. It can be specified multiple times.
Print the results of the command. If it is a reference, Data::Dumper will be used.
By default the command you are given is treated as Perl code. This flag indicates that it should instead be treated as a system command to be sent to the shell.
By default the command you are given is treated as Perl code. This flag indicates that
it should instead be treated as an SQL query to be run. Combine it with the -p option
if you want to actually see the results of the query.