The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Package::Transporter::Generator::Potential::Interactive - AUTOLOAD interactive (write missing subroutines as the running program encounters them)

SYNOPSIS

        use strict;
        use Package::Transporter sub{eval shift}, sub {
                $_[0]->register_potential('::Interactive', 'FOR_ANY');
        };
        
        sub hello_world() { print "Hello World.\n"; }
        print STDOUT hallo_welt();
        
        Package::Transporter->new(sub{eval shift}); # access lexicals;
        exit(0);

DESCRIPTION

Problem: at the end of a long computation, the program crashed due to a missing or misspelled subroutine. Solution: Correct the problem interactively while the program is still running.

Starts a simple interactive shell as shown below. Requires an interactive TTY. A fair attempt is made not to suffer from interactive syntax errors.

Chances are that you can recover from an otherwise fatal situation, but keep in mind that any kind of recovery has to be practiced.

Sample Screen Output

        #----------------------------------------------------------------------------
        # The subroutine 'hallo_welt' is missing in package 'main'.
        # You can write it now if you're adventurous.
        # Menu: [1:Help] [2:Alias] [3:transport] [4:cluck] [5:Dumper(@_)] [6:Give up]
        # Please enter 1-6 followed by Enter: 1
        #
        # 1: Display this text.
        # 2: Meant for fixing typing mistakes. Enter the real subroutine name.
        # 3: Paste the $code to be passed to $self->transport(\$code)
        # 4: Execute Carp::cluck to see where the request is coming from.
        # 5: Print the arguments with Data::Dumper(\@_);
        # 6: Indicate failure and eventually die().
        #
        # For further details see Package::Transporter::Generator::Potential::Interactive
        #----------------------------------------------------------------------------
        # Menu: [1:Help] [2:Alias] [3:transport] [4:cluck] [5:Dumper(@_)] [6:Give up]
        # Please enter 1-6 followed by Enter: 2
        # Enter the name of an existing subroutine:
        hello_world
        Hello World.

RELATED MODULES

This module is different from REPL in that no error condition was triggered, yet.

Carp::REPL, Devel::ebug, Devel::REPL

ANYTHING ELSE

Please see the documentation of the upstream package Package::Transporter.