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

NAME

6       Devel::REPL::Profile
7

SYNOPSIS

9        package Devel::REPL::Profile::MyProject;
10
11        use Moose;
12        use namespace::clean -except => [ 'meta' ];
13
14        with 'Devel::REPL::Profile';
15
16        sub apply_profile {
17            my ($self, $repl) = @_;
18            # do something here
19        }
20
21        1;
22

DESCRIPTION

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

USAGE

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

AUTHOR

75       Matt S Trout - mst (at) shadowcatsystems.co.uk
76       (<http://www.shadowcatsystems.co.uk/>)
77

LICENSE

79       This library is free software under the same terms as perl itself
80
81
82
83perl v5.12.1                      2010-05-23           Devel::REPL::Profile(3)
Impressum