guiwp has asked for the wisdom of the Perl Monks concerning the following question:

I've played a little bit with the debugger as a solution for a REPL (perl -MModule::Name -d -e1). Now I decided to use the Devel::REPL but I don't known how to add my subs to the context.

Lets suppose I've a file named test.pl and inside it a sub named 'print_hello'. How do I expose this in the REPL? The only solution is execute the re.pl and load my script through a --rcfile file.rc? Can someone give me simple examples?

Replies are listed 'Best First'.
Re: Using Devel::REPL
by robby_dobby (Hermit) on Jun 20, 2016 at 01:27 UTC

      Thank you @robby_dobby, I'll give it a try!

      Strange... using reply (reply --cfg filerc) I always get Unknown option: cfg

        Solved! I was using Getopt::Long in my module/script (I mixed module with script so I could run through command line and use as module if wanted too) and somehow it was interfering with the logic of the reply.

        My approach now is make a module and a script that use the module (obvious thing!) to avoid such problems!

        Strange indeed, it works for me. Are you sure reply runs the correct executable?

        ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,