The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Devel::REPL::Plugin::LazyLoad - Lazily load packages into your REPL

VERSION

version 0.01

SYNOPSIS

  # 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

DESCRIPTION

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->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.

METHODS

$_REPL->lazy_load($module)

$_REPL->lazy_load($module, @import_list)

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.

LIMITATIONS

  • my $class = 'DateTime'; $class->new will not work.

  • DateTime::->new will not work.

  • 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.

SEE ALSO

Devel::REPL

AUTHOR

Rob Hoelz <rob@hoelz.ro>

COPYRIGHT AND LICENSE

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.

BUGS

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.