1Devel::REPL::Profile(3)User Contributed Perl DocumentatioDnevel::REPL::Profile(3)
2
3
4

NAME

6       Devel::REPL::Profile - Code to execute when re.pl starts
7

VERSION

9       version 1.003028
10

SYNOPSIS

12        package Devel::REPL::Profile::MyProject;
13
14        use Moose;
15        use namespace::autoclean;
16
17        with 'Devel::REPL::Profile';
18
19        sub apply_profile {
20            my ($self, $repl) = @_;
21            # do something here
22        }
23
24        1;
25

DESCRIPTION

27       For particular projects you might well end up running the same commands
28       each time the REPL shell starts up - loading Perl modules, setting
29       configuration, and so on.
30
31       A mechanism called profiles exists to let you package and distribute
32       these start-up scripts, as Perl modules.
33

USAGE

35       Quite simply, follow the "SYNOPSIS" section above to create a
36       boilerplate profile module. Within the "apply_profile" method, the
37       $repl variable can be used to run any commands as the user would,
38       within the context of their running "Devel::REPL" shell instance.
39
40       For example, to load a module, you might have something like this:
41
42        sub apply_profile {
43            my ($self, $repl) = @_;
44            $repl->eval('use Carp');
45        }
46
47       As you can see, the "eval" method is used to run any code. The user
48       won't see any output from that, and the code can "safely" die without
49       destroying the REPL shell. The return value of "eval" will be the
50       return value of the code you gave, or else if it died then a
51       "Devel::REPL::Error" object is returned.
52
53       If you want to load a "Devel::REPL" plugin, then use the following
54       method:
55
56        $repl->load_plugin('Timing');
57
58       The "load_plugin" and "eval" methods should cover most of what you
59       would want to do before the user has access to the shell. Remember that
60       plugin features are immediately available, so you can load for example
61       the "LexEnv" plugin, and then declare "my" variables which the user
62       will have access to.
63
64   Selecting a Profile
65       To run the shell with a particular profile, use the following command:
66
67        system$ re.pl --profile MyProject
68
69       Alternatively, you can set the environment variable
70       "DEVEL_REPL_PROFILE" to MyProject.
71
72       When the profile name is unqualified, as in the above example, the
73       profile is assumed to be in the "Devel::REPL::Profile::" namespace.
74       Otherwise if you pass something which contains the "::" character
75       sequence, it will be loaded as-is.
76

SUPPORT

78       Bugs may be submitted through the RT bug tracker
79       <https://rt.cpan.org/Public/Dist/Display.html?Name=Devel-REPL> (or
80       bug-Devel-REPL@rt.cpan.org <mailto:bug-Devel-REPL@rt.cpan.org>).
81
82       There is also an irc channel available for users of this distribution,
83       at "#devel" on "irc.perl.org" <irc://irc.perl.org/#devel-repl>.
84

AUTHOR

86       Matt S Trout - mst (at) shadowcatsystems.co.uk
87       (<http://www.shadowcatsystems.co.uk/>)
88
90       This software is copyright (c) 2007 by Matt S Trout - mst (at)
91       shadowcatsystems.co.uk (<http://www.shadowcatsystems.co.uk/>).
92
93       This is free software; you can redistribute it and/or modify it under
94       the same terms as the Perl 5 programming language system itself.
95
96
97
98perl v5.32.0                      2020-07-28           Devel::REPL::Profile(3)
Impressum