Skip to content

Instantly share code, notes, and snippets.

@fgabolde
Created April 26, 2013 15:07
Show Gist options
  • Save fgabolde/5467985 to your computer and use it in GitHub Desktop.
Save fgabolde/5467985 to your computer and use it in GitHub Desktop.
Reloading a module at runtime.
#!perl
use strict;
use warnings;
use 5.010;
use Carp;
eval 'require Package::Reloaded';
if ($@) { say "exception: $@" }
say Package::Reloaded::blah();
my $wait = <STDIN>; # edit Package/Reloaded.pm before pressing RET
# use Module::Runtime::module_notional_filename here, instead of hardcoding the module filename
delete $INC{'Package/Reloaded.pm'};
eval 'require Package::Reloaded';
if ($@) { say "exception when reloading: $@" }
say Package::Reloaded::blah();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment