Refresh your classes during runtime

Edit Package perl-Class-Refresh
https://metacpan.org/release/Class-Refresh

During development, it is fairly common to cycle between writing code and
testing that code. Generally the testing happens within the test suite, but
frequently it is more convenient to test things by hand when tracking down
a bug, or when doing some exploratory coding. In many situations, however,
this becomes inconvenient - for instance, in a REPL, or in a stateful web
application, restarting from the beginning after every code change can get
pretty tedious. This module allows you to reload your application classes
on the fly, so that the code/test cycle becomes a lot easier.

This module takes a hash of import arguments, which can include:

* track_require

use Class::Refresh track_require => 1;

If set, a 'require()' hook will be installed to track modules which are
loaded. This will make the list of modules to reload when 'refresh' is
called more accurate, but may cause issues with other modules which hook
into 'require' (since the hook is global).

This module has several limitations, due to reloading modules in this way
being an inherently fragile operation. Therefore, this module is
recommended for use only in development environments - it should not be
used for reloading things in production.

It makes several assumptions about how code is structured that simplify the
logic involved quite a bit, and make it more reliable when those
assumptions hold, but do make it inappropriate for use in certain cases.
For instance, this module is named 'Class::Refresh' for a reason: it is
only intended for refreshing classes, where each file contains a single
namespace, and each namespace corresponds to a single file, and all
function calls happen through method dispatch. Unlike Module::Refresh,
which makes an effort to track the files where subs were defined, this
module assumes that refreshing a class means wiping out everything in the
class's namespace, and reloading the file corresponding to that class. If
your code includes multiple files that all load things into a common
namespace, or defines multiple classes in a single file, this will likely
not work.

Refresh
Refresh
Source Files
Filename Size Changed
Class-Refresh-0.07.tar.gz 0000021794 21.3 KB
cpanspec.yml 0000000764 764 Bytes
perl-Class-Refresh.changes 0000000186 186 Bytes
perl-Class-Refresh.spec 0000004027 3.93 KB
Latest Revision
Dirk Stoecker's avatar Dirk Stoecker (dstoecker) accepted request 848348 from Dan Čermák's avatar Dan Čermák (dancermak) (revision 1)
Submission of Class-Refresh which is a dependency of Perl-LanguageServer
Comments 0
openSUSE Build Service is sponsored by