How to use Perl REPL (re.pl)#
NOTE: New to Perl? Check how to learn perl!
On your local dev instance, the "backend" container comes with Devel::REPL installed.
This is a handy package to try out perl expressions and learn.
Thanks to PERL5LIB
variable which is already configured,
you can load any module of ProductOpener
from within it.
Launch Repl#
Just run
docker compose run --rm backend re.pl
If you want to access external services (like mongodb), do not forget to start them.
NOTE: If you get "exec: re.pl: not found", it means you may not have dev tools installed. Try going in your .env (or .envrc) file and add the line:
CPANMOPTS=--with-develop --with-feature=off_server_dev_tools
Testing perl code#
It can be a handy way to get your hand into perl by testing some code patterns, or seeing how they react.
For example one can test a regular expression:
$ my $text = "Hello World";
Hello World
$ $text =~ /Hello (\w+)/i
World
Reading a sto#
Another use case is reading a .sto
file to see what it contains.
Eg. for a user:
$ use ProductOpener::Store qw/:all/;
$ my $product_ref = retrieve("/mnt/podata/products/007/107/917/0260/product.sto");