Skip to content

How to use Perl REPL (

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

If you want to access external services (like mongodb), do not forget to start them.

NOTE: If you get "exec: 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
then just make build and retry, you will then be able to run

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

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");