The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Haver::Reload - Reload modules if needed

SYNOPSIS

  use Haver::Reload;
  Haver::Reload->init;

  # Now, reload things:
  my @did = Haver::Reload->reload;

  # @did is a list of modules we reloaded.
 
  # change the default module matching pattern:
  Haver::Reload->pattern(qr/^MyMod::/);

  # Try to load a module at run-time:
  if (Haver::Reload->load('Haver::Server::Monkey')) {
    print "OK!\n";
  } else {
    print "Can't load Haver::Server::Monkey!\n";
  }
  # Note, the above is probably always going to be used as a way
  # to force-reload something.
  
  

DESCRIPTION

This module reloads modules, if the module is reloadable and has changed since init() was last called. The module must also match $Haver::Reload::Pattern, which is a regexp thingy, made with qr//. A module is considered reloadable if it contains a package global scalar $RELOAD and if that said global is true.

$Haver::Reload::Pattern defaults to qr/^Haver::/.

EXPORTS

Nothing at all.

SEE ALSO

https://savannah.nongnu.org/projects/haver/

AUTHOR

Dylan William Hardison, <dylanwh@tampabay.rr.com>

COPYRIGHT AND LICENSE

Copyright (C) 2004 by Dylan William Hardison

This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this module; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA