Devel::REPL::Plugin::LazyLoad - Lazily load packages into your REPL
version 0.01
# repl.rc $_REPL->load_plugin('LazyLoad'); $_REPL->lazy_load('File::Slurp' => qw/read_file write_file/); # for # Exporter-style # modules $_REPL->lazy_load('DateTime'); # for OO-style modules
This plugin for Devel::REPL allows you to lazily load certain modules into your REPL as you use them. Let's say you end up using DateTime math in your REPL 50% of the time. Put the following into your repl.rc:
repl.rc
$_REPL->load_plugin('LazyLoad'); $_REPL->lazy_load('DateTime');
Now, the first time you use DateTime, it will be loaded, and you shouldn't notice a difference, apart from the loading time. If you never use DateTime in a REPL session, it never gets loaded.
Tells the REPL to lazily load a module. If no import list is specified, $module is treated as an "OO-style" module (ex. DateTime, where you call methods on the class rather than use exported functions). If an import list is specified, each function in the import list is created in the current package and will load $module when invoked.
$module
my $class = 'DateTime'; $class->new will not work.
my $class = 'DateTime'; $class->new
DateTime::->new will not work.
DateTime::->new
Exported symbols that are not specified in the call to import will not work.
Prototypes for exported functions may be messed up until they are actually imported into the REPL.
Devel::REPL
Rob Hoelz <rob@hoelz.ro>
This software is copyright (c) 2012 by Rob Hoelz.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Please report any bugs or feature requests on the bugtracker website https://github.com/hoelzro/devel-repl-plugin-lazyload/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
To install Devel::REPL::Plugin::LazyLoad, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::REPL::Plugin::LazyLoad
CPAN shell
perl -MCPAN -e shell install Devel::REPL::Plugin::LazyLoad
For more information on module installation, please visit the detailed CPAN module installation guide.