Class-Refresh-0.07/0000755000175000001440000000000012303255517012616 5ustar doyusersClass-Refresh-0.07/lib/0000755000175000001440000000000012303255517013364 5ustar doyusersClass-Refresh-0.07/lib/Class/0000755000175000001440000000000012303255517014431 5ustar doyusersClass-Refresh-0.07/lib/Class/Refresh.pm0000644000175000001440000003142612303255517016373 0ustar doyuserspackage Class::Refresh; BEGIN { $Class::Refresh::AUTHORITY = 'cpan:DOY'; } { $Class::Refresh::VERSION = '0.07'; } use strict; use warnings; # ABSTRACT: refresh your classes during runtime use Carp 'carp'; use Class::Unload; use Class::Load; use Try::Tiny; our %CACHE; sub import { my $package = shift; my %opts = @_; if ($opts{track_require}) { require Devel::OverrideGlobalRequire; require B; Devel::OverrideGlobalRequire::override_global_require(sub { my $next = shift; my ($file) = @_; my $ret = $next->(); $package->_update_cache_for($file) # require v5.8.1; unless ref(\$file) eq 'VSTRING' # require 5.008001; || !(B::svref_2object(\$file)->FLAGS & B::SVf_POK()); return $ret; }); } } sub refresh { my $class = shift; $class->refresh_module($_) for $class->modified_modules; } sub modified_modules { my $class = shift; my @ret; for my $file (keys %CACHE) { # refresh files that are in our # %CACHE but not in %INC push @ret, $class->_file_to_mod($file) if (!$INC{$file}); } for my $file (keys %INC) { if (exists $CACHE{$file}) { push @ret, $class->_file_to_mod($file) if $class->_mtime($file) ne $CACHE{$file}; } else { $class->_update_cache_for($file); } } return @ret; } sub refresh_module { my $class = shift; my ($mod) = @_; $mod = $class->_file_to_mod($mod); my @to_refresh = grep { exists $INC{ $class->_mod_to_file($_) } } $class->_dependent_modules($mod); # immutable metaclasses will be automatically recreated when the metaclass # itself is loaded, so we don't want to try to do it here (it won't work, # since it's an autogenerated class) my %metas_for_immutable; if (Class::Load::is_class_loaded('Class::MOP')) { my @immutable_metas = grep { defined $_ && $_->isa('Class::MOP::Class') && $_->is_immutable } map { Class::MOP::class_of($_) } @to_refresh; for my $meta (@immutable_metas) { $metas_for_immutable{ref $meta} = 1; } } # XXX don't know what else to do here if (Class::Load::is_class_loaded('Class::MOP')) { my @new_to_refresh; for my $to_refresh (@to_refresh) { my $inc = $INC{ $class->_mod_to_file($to_refresh) } || ''; if (!$metas_for_immutable{$to_refresh} && $inc eq '(set by Moose)' && Class::MOP::class_of($to_refresh)) { carp("Not reloading $to_refresh since it was created dynamically"); next; } push @new_to_refresh, $to_refresh; } @to_refresh = @new_to_refresh; } $class->unload_module($_) for @to_refresh; if (Class::Load::is_class_loaded('Class::MOP')) { @to_refresh = grep { !$metas_for_immutable{$_} } @to_refresh; } $class->load_module($_) for @to_refresh; } sub unload_module { my $class = shift; my ($mod) = @_; $mod = $class->_file_to_mod($mod); Class::Unload->unload($mod); if (Class::Load::is_class_loaded('Class::MOP')) { Class::MOP::remove_metaclass_by_name($mod); } $class->_clear_cache_for($mod); } sub load_module { my $class = shift; my ($mod) = @_; $mod = $class->_file_to_mod($mod); my $file = $class->_mod_to_file($mod); my $last_require_failed = exists $INC{$file} && !defined $INC{$file}; try { Class::Load::load_class($mod); } catch { if ($last_require_failed) { # This file failed to load previously. # Presumably that error has already been caught, so that's fine } else { die $_; } } finally { $class->_update_cache_for($mod); }; } sub _dependent_modules { my $class = shift; my ($mod) = @_; $mod = $class->_file_to_mod($mod); return ($mod) unless Class::Load::is_class_loaded('Class::MOP'); my $meta = Class::MOP::class_of($mod); return ($mod) unless $meta; if ($meta->isa('Class::MOP::Class')) { # attribute cloning (has '+foo') means that we can't skip refreshing # mutable classes return ( # NOTE: this order is important! $mod, map { $class->_dependent_modules($_) } ($meta->subclasses, # XXX: metacircularity? what if $class is Class::MOP::Class? ($mod->isa('Class::MOP::Class') ? (map { $_->name } grep { $_->isa($mod) } Class::MOP::get_all_metaclass_instances()) : ())), ); } elsif ($meta->isa('Moose::Meta::Role')) { return ( $mod, map { $class->_dependent_modules($_) } $meta->consumers, ); } else { die "Unknown metaclass: $meta"; } } sub _update_cache_for { my $class = shift; my ($file) = @_; $file = $class->_mod_to_file($file); $CACHE{$file} = $class->_mtime($file); } sub _clear_cache_for { my $class = shift; my ($file) = @_; $file = $class->_mod_to_file($file); delete $CACHE{$file}; } sub _mtime { my $class = shift; my ($file) = @_; $file = $class->_mod_to_file($file); return 1 if !$INC{$file}; return join ' ', (stat($INC{$file}))[1, 7, 9]; } sub _file_to_mod { my $class = shift; my ($file) = @_; return $file unless $file =~ /\.pm$/; my $mod = $file; $mod =~ s{\.pm$}{}; $mod =~ s{/}{::}g; return $mod; } sub _mod_to_file { my $class = shift; my ($mod) = @_; return $mod unless $mod =~ /^\w+(?:::\w+)*$/; my $file = $mod; $file =~ s{::}{/}g; $file .= '.pm'; return $file; } 1; __END__ =pod =head1 NAME Class::Refresh - refresh your classes during runtime =head1 VERSION version 0.07 =head1 SYNOPSIS use Class::Refresh; use Foo; Class::Refresh->refresh; # edit Foo.pm Class::Refresh->refresh; # changes in Foo.pm are applied =head1 DESCRIPTION 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: =over 4 =item track_require use Class::Refresh track_require => 1; If set, a C hook will be installed to track modules which are loaded. This will make the list of modules to reload when C is called more accurate, but may cause issues with other modules which hook into C (since the hook is global). =back 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 C 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 L, 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. =head1 METHODS =head2 refresh The main entry point to the module. The first call to C populates a cache of modification times for currently loaded modules, and subsequent calls will refresh any classes which have changed since the previous call. =head2 modified_modules Returns a list of modules which have changed since the last call to C. =head2 refresh_module $mod This method calls C and C on C<$mod>, as well as on any classes that depend on C<$mod> (for instance, subclasses if C<$mod> is a class, or classes that consume C<$mod> if C<$mod> is a role). This ensures that all of your classes are consistent, even when dealing with things like immutable L classes. =head2 unload_module $mod Unloads C<$mod>, using L. =head2 load_module $mod Loads C<$mod>, using L. =head1 CAVEATS =over 4 =item Refreshing modules may miss modules which have been externally loaded since the last call to refresh This is because it's not easily possible to tell if a module has been modified since it was loaded, if we haven't seen it so far. A workaround for this may be to set the C option in the import arguments (see above), although this comes with its own set of caveats (since it is global behavior). =item Global variable accesses and function calls may not work as expected Perl resolves accesses to global variables and functions in other packages at compile time, so if the package is later reloaded, changes to those will not be noticed. As mentioned above, this module is intended for refreshing B. =item File modification times have a granularity of one second If you modify a file and then immediately call C and then immediately modify it again, the modification may not be seen on the next call to C. Note however that file size and inode number are also compared, so it still may be seen, depending on if either of those two things changed. =item Tracking modules which C a given module isn't possible For instance, modifying a L module which is used in a class won't cause the class to be refreshed, even if the change to the exporter would cause a change in the class's metaclass. =item Classes which aren't completely defined in a single file and files which define multiple classes cause problems If a class is defined across multiple files, there's no easy guaranteed way to restore the entire state of the class, since there may be load order issues. This includes L classes which have C called on them from outside of the class file itself. Also, files which define multiple classes cause problems since we can't always determine which classes are defined in the file, and so reloading the file may cause class definitions to be run more than once. =item Classes which build themselves differently based on the state of other classes may not work properly This module attempts to handle several cases of this sort for L classes (modifying a class will refresh all of its subclasses, modifying a role will refresh all classes and roles which consume that role, modifying a metaclass will refresh all classes whose metaclass is an instance of that metaclass), but it's not a problem that's solvable in the general case. =back =head1 BUGS =over 4 =item Reloading classes when their metaclass is modified doesn't quite work yet This will require modifications to Moose to support properly. =item Tracking changes to metaclasses other than the class metaclass isn't implemented yet =item Metacircularity probably has issues Refreshing a class which is its own metaclass will likely break. =back Please report any bugs to GitHub Issues at L. =head1 SEE ALSO L =head1 SUPPORT You can find this documentation for this module with the perldoc command. perldoc Class::Refresh You can also look for information at: =over 4 =item * MetaCPAN L =item * Github L =item * RT: CPAN's request tracker L =item * CPAN Ratings L =back =head1 CREDITS This module was based in large part on L by Jesse Vincent. =head1 AUTHOR Jesse Luehrs =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Jesse Luehrs. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =cut Class-Refresh-0.07/xt/0000755000175000001440000000000012303255517013251 5ustar doyusersClass-Refresh-0.07/xt/release/0000755000175000001440000000000012303255517014671 5ustar doyusersClass-Refresh-0.07/xt/release/pod-coverage.t0000644000175000001440000000065112303255517017433 0ustar doyusers#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests. use Test::More; eval "use Test::Pod::Coverage 1.08"; plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage" if $@; eval "use Pod::Coverage::TrustPod"; plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage" if $@; all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' }); Class-Refresh-0.07/xt/release/pod-syntax.t0000644000175000001440000000033212303255517017162 0ustar doyusers#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use Test::More; eval "use Test::Pod 1.41"; plan skip_all => "Test::Pod 1.41 required for testing POD" if $@; all_pod_files_ok(); Class-Refresh-0.07/xt/release/no-tabs.t0000644000175000001440000000034212303255517016420 0ustar doyusersuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::NoTabsTests 0.05 use Test::More 0.88; use Test::NoTabs; my @files = ( 'lib/Class/Refresh.pm' ); notabs_ok($_) foreach @files; done_testing; Class-Refresh-0.07/xt/release/eol.t0000644000175000001440000000024012303255517015631 0ustar doyusersuse strict; use warnings; use Test::More; eval 'use Test::EOL'; plan skip_all => 'Test::EOL required' if $@; all_perl_files_ok({ trailing_whitespace => 1 }); Class-Refresh-0.07/Makefile.PL0000644000175000001440000000341312303255517014571 0ustar doyusers # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.008. use strict; use warnings; use ExtUtils::MakeMaker 6.30; my %WriteMakefileArgs = ( "ABSTRACT" => "refresh your classes during runtime", "AUTHOR" => "Jesse Luehrs ", "BUILD_REQUIRES" => {}, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => "6.30" }, "DISTNAME" => "Class-Refresh", "EXE_FILES" => [], "LICENSE" => "perl", "NAME" => "Class::Refresh", "PREREQ_PM" => { "B" => 0, "Carp" => 0, "Class::Load" => 0, "Class::Unload" => 0, "Devel::OverrideGlobalRequire" => 0, "Try::Tiny" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "Exporter" => 0, "File::Copy" => 0, "File::Find" => 0, "File::Spec" => 0, "File::Temp" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::Fatal" => 0, "Test::More" => "0.88", "Test::Requires" => 0, "lib" => 0 }, "VERSION" => "0.07", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "B" => 0, "Carp" => 0, "Class::Load" => 0, "Class::Unload" => 0, "Devel::OverrideGlobalRequire" => 0, "Exporter" => 0, "File::Copy" => 0, "File::Find" => 0, "File::Spec" => 0, "File::Temp" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::Fatal" => 0, "Test::More" => "0.88", "Test::Requires" => 0, "Try::Tiny" => 0, "lib" => 0, "strict" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Class-Refresh-0.07/META.json0000644000175000001440000002451612303255517014247 0ustar doyusers{ "abstract" : "refresh your classes during runtime", "author" : [ "Jesse Luehrs " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.008, CPAN::Meta::Converter version 2.132830", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Class-Refresh", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "6.30" } }, "develop" : { "requires" : { "Pod::Coverage::TrustPod" : "0", "Test::More" : "0", "Test::NoTabs" : "0", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08" } }, "runtime" : { "requires" : { "B" : "0", "Carp" : "0", "Class::Load" : "0", "Class::Unload" : "0", "Devel::OverrideGlobalRequire" : "0", "Try::Tiny" : "0", "strict" : "0", "warnings" : "0" } }, "test" : { "requires" : { "Exporter" : "0", "File::Copy" : "0", "File::Find" : "0", "File::Spec" : "0", "File::Temp" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Test::Fatal" : "0", "Test::More" : "0.88", "Test::Requires" : "0", "lib" : "0" } } }, "provides" : { "Class::Refresh" : { "file" : "lib/Class/Refresh.pm", "version" : "0.07" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/doy/class-refresh/issues" }, "homepage" : "http://metacpan.org/release/Class-Refresh", "repository" : { "type" : "git", "url" : "git://github.com/doy/class-refresh.git", "web" : "https://github.com/doy/class-refresh" } }, "version" : "0.07", "x_Dist_Zilla" : { "perl" : { "version" : "5.018001" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Prereqs", "config" : { "Dist::Zilla::Plugin::Prereqs" : { "phase" : "test", "type" : "requires" } }, "name" : "@DOY/TestMoreDoneTesting", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::GatherDir", "name" : "@DOY/GatherDir", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@DOY/PruneCruft", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@DOY/ManifestSkip", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@DOY/MetaYAML", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@DOY/License", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::Readme", "name" : "@DOY/Readme", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "name" : "@DOY/RunExtraTests", "version" : "0.013" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@DOY/ExecDir", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@DOY/ShareDir", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::MakeMaker", "name" : "@DOY/MakeMaker", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@DOY/Manifest", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@DOY/TestRelease", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@DOY/ConfirmRelease", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@DOY/MetaConfig", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@DOY/MetaJSON", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@DOY/NextRelease", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", "name" : "@DOY/CheckChangesHasContent", "version" : "0.006" }, { "class" : "Dist::Zilla::Plugin::PkgVersion", "name" : "@DOY/PkgVersion", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::Authority", "name" : "@DOY/Authority", "version" : "1.006" }, { "class" : "Dist::Zilla::Plugin::PodCoverageTests", "name" : "@DOY/PodCoverageTests", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@DOY/PodSyntaxTests", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::NoTabsTests", "config" : { "Dist::Zilla::Plugin::Test::NoTabs" : { "module_finder" : [ ":InstallModules" ], "script_finder" : [ ":ExecFiles" ] } }, "name" : "@DOY/NoTabsTests", "version" : "0.05" }, { "class" : "Dist::Zilla::Plugin::EOLTests", "name" : "@DOY/EOLTests", "version" : "0.02" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "filename" : "t/00-compile.t", "module_finder" : [ ":InstallModules" ], "script_finder" : [ ":ExecFiles" ] } }, "name" : "@DOY/Test::Compile", "version" : "2.037" }, { "class" : "Dist::Zilla::Plugin::Metadata", "name" : "@DOY/Metadata", "version" : "3.03" }, { "class" : "Dist::Zilla::Plugin::MetaResources", "name" : "@DOY/MetaResources", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "name" : "@DOY/Git::Check", "version" : "2.016" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "name" : "@DOY/Git::Commit", "version" : "2.016" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "name" : "@DOY/Git::Tag", "version" : "2.016" }, { "class" : "Dist::Zilla::Plugin::Git::NextVersion", "name" : "@DOY/Git::NextVersion", "version" : "2.016" }, { "class" : "Dist::Zilla::Plugin::ContributorsFromGit", "name" : "@DOY/ContributorsFromGit", "version" : "0.006" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : {}, "Dist::Zilla::Role::MetaProvider::Provider" : { "inherit_missing" : "1", "inherit_version" : "1", "meta_noindex" : "1" } }, "name" : "@DOY/MetaProvides::Package", "version" : "1.15000000" }, { "class" : "Dist::Zilla::Plugin::PodWeaver", "name" : "@DOY/PodWeaver", "version" : "3.101641" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@DOY/UploadToCPAN", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::AutoPrereqs", "name" : "AutoPrereqs", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "5.008" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "5.008" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : "0" }, "version" : "5.008" } }, "x_authority" : "cpan:DOY", "x_contributors" : [ "Michael Reddick ", "amacleay " ] } Class-Refresh-0.07/t/0000755000175000001440000000000012303255517013061 5ustar doyusersClass-Refresh-0.07/t/lib/0000755000175000001440000000000012303255517013627 5ustar doyusersClass-Refresh-0.07/t/lib/Test/0000755000175000001440000000000012303255517014546 5ustar doyusersClass-Refresh-0.07/t/lib/Test/Class/0000755000175000001440000000000012303255517015613 5ustar doyusersClass-Refresh-0.07/t/lib/Test/Class/Refresh.pm0000644000175000001440000000255212303255517017553 0ustar doyuserspackage Test::Class::Refresh; use strict; use warnings; use File::Copy; use File::Find; use File::Temp; use Exporter 'import'; our @EXPORT = qw(prepare_temp_dir_for update_temp_dir_for); sub rcopy { my ($from_dir, $to_dir) = @_; find( { no_chdir => 1, wanted => sub { my $from = $File::Find::name; (my $base = $from) =~ s/^$from_dir//; return unless length $base; my $to = $to_dir . $base; if (-d) { if (!-d $to) { mkdir $to or die "Couldn't create dir $to: $!"; } } else { copy($from, $to) or die "Couldn't copy $from to $to: $!"; utime(undef, undef, $to) or die "Couldn't set modification time for $to: $!"; } }, }, $from_dir ); } sub prepare_temp_dir_for { my ($test_id, $subdir) = @_; $subdir ||= 'before'; my $from_dir = 't/data/' . $test_id . "/$subdir"; my $to_dir = File::Temp->newdir; rcopy($from_dir, $to_dir); return $to_dir; } sub update_temp_dir_for { my ($test_id, $to_dir, $subdir) = @_; $subdir ||= 'after'; my $from_dir = 't/data/' . $test_id . "/$subdir"; rcopy($from_dir, $to_dir); } 1; Class-Refresh-0.07/t/data/0000755000175000001440000000000012303255517013772 5ustar doyusersClass-Refresh-0.07/t/data/moose-metaclasses/0000755000175000001440000000000012303255517017416 5ustar doyusersClass-Refresh-0.07/t/data/moose-metaclasses/after/0000755000175000001440000000000012303255517020517 5ustar doyusersClass-Refresh-0.07/t/data/moose-metaclasses/after/Foo/0000755000175000001440000000000012303255517021242 5ustar doyusersClass-Refresh-0.07/t/data/moose-metaclasses/after/Foo/Meta/0000755000175000001440000000000012303255517022130 5ustar doyusersClass-Refresh-0.07/t/data/moose-metaclasses/after/Foo/Meta/Class.pm0000644000175000001440000000023312303255517023531 0ustar doyuserspackage Foo::Meta::Class; use Moose::Role; $::reloaded{foo_meta_class}++; has meta_attr2 => ( is => 'ro', isa => 'Str', ); no Moose::Role; 1; Class-Refresh-0.07/t/data/moose-metaclasses/before/0000755000175000001440000000000012303255517020660 5ustar doyusersClass-Refresh-0.07/t/data/moose-metaclasses/before/Foo/0000755000175000001440000000000012303255517021403 5ustar doyusersClass-Refresh-0.07/t/data/moose-metaclasses/before/Foo/Meta/0000755000175000001440000000000012303255517022271 5ustar doyusersClass-Refresh-0.07/t/data/moose-metaclasses/before/Foo/Meta/Class.pm0000644000175000001440000000023212303255517023671 0ustar doyuserspackage Foo::Meta::Class; use Moose::Role; $::reloaded{foo_meta_class}++; has meta_attr => ( is => 'ro', isa => 'Str', ); no Moose::Role; 1; Class-Refresh-0.07/t/data/moose-metaclasses/before/Foo.pm0000644000175000001440000000035112303255517021740 0ustar doyuserspackage Foo; use Moose; $::reloaded{foo}++; Moose::Util::MetaRole::apply_metaroles( for => __PACKAGE__, class_metaroles => { class => ['Foo::Meta::Class'] }, ); __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-metaclasses/before/Bar.pm0000644000175000001440000000014012303255517021715 0ustar doyuserspackage Bar; use Moose; $::reloaded{bar}++; __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-subclasses/0000755000175000001440000000000012303255517017261 5ustar doyusersClass-Refresh-0.07/t/data/moose-subclasses/before/0000755000175000001440000000000012303255517020523 5ustar doyusersClass-Refresh-0.07/t/data/moose-subclasses/before/Foo/0000755000175000001440000000000012303255517021246 5ustar doyusersClass-Refresh-0.07/t/data/moose-subclasses/before/Foo/Sub.pm0000644000175000001440000000023712303255517022337 0ustar doyuserspackage Foo::Sub; use Moose; $::subclass_reloads++; extends 'Foo'; has baz => (is => 'ro'); sub meth { } __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-subclasses/before/Foo.pm0000644000175000001440000000021412303255517021601 0ustar doyuserspackage Foo; use Moose; $::superclass_reloads++; has foo => (is => 'ro'); sub meth { } __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-subclasses/after/0000755000175000001440000000000012303255517020362 5ustar doyusersClass-Refresh-0.07/t/data/moose-subclasses/after/Foo.pm0000644000175000001440000000022212303255517021437 0ustar doyuserspackage Foo; use Moose; $::superclass_reloads++; has bar => (is => 'ro'); sub other_meth { } __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-late-load/0000755000175000001440000000000012303255517016754 5ustar doyusersClass-Refresh-0.07/t/data/moose-late-load/middle/0000755000175000001440000000000012303255517020212 5ustar doyusersClass-Refresh-0.07/t/data/moose-late-load/middle/Foo/0000755000175000001440000000000012303255517020735 5ustar doyusersClass-Refresh-0.07/t/data/moose-late-load/middle/Foo/Immutable.pm0000644000175000001440000000020312303255517023205 0ustar doyuserspackage Foo::Immutable; use Moose; has bar => (is => 'ro'); sub other_meth { } __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-late-load/middle/Foo.pm0000644000175000001440000000012512303255517021271 0ustar doyuserspackage Foo; use Moose; has bar => (is => 'ro'); sub other_meth { } no Moose; 1; Class-Refresh-0.07/t/data/moose-late-load/before/0000755000175000001440000000000012303255517020216 5ustar doyusersClass-Refresh-0.07/t/data/moose-late-load/before/Foo/0000755000175000001440000000000012303255517020741 5ustar doyusersClass-Refresh-0.07/t/data/moose-late-load/before/Foo/Immutable.pm0000644000175000001440000000017512303255517023221 0ustar doyuserspackage Foo::Immutable; use Moose; has foo => (is => 'ro'); sub meth { } __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-late-load/before/Foo.pm0000644000175000001440000000011712303255517021276 0ustar doyuserspackage Foo; use Moose; has foo => (is => 'ro'); sub meth { } no Moose; 1; Class-Refresh-0.07/t/data/moose-late-load/after/0000755000175000001440000000000012303255517020055 5ustar doyusersClass-Refresh-0.07/t/data/moose-late-load/after/Foo/0000755000175000001440000000000012303255517020600 5ustar doyusersClass-Refresh-0.07/t/data/moose-late-load/after/Foo/Immutable.pm0000644000175000001440000000021112303255517023047 0ustar doyuserspackage Foo::Immutable; use Moose; has baz => (is => 'ro'); sub other_other_meth { } __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-late-load/after/Foo.pm0000644000175000001440000000013312303255517021133 0ustar doyuserspackage Foo; use Moose; has baz => (is => 'ro'); sub other_other_meth { } no Moose; 1; Class-Refresh-0.07/t/data/compile-error/0000755000175000001440000000000012303255517016551 5ustar doyusersClass-Refresh-0.07/t/data/compile-error/middle/0000755000175000001440000000000012303255517020007 5ustar doyusersClass-Refresh-0.07/t/data/compile-error/middle/Foo.pm0000644000175000001440000000013112303255517021063 0ustar doyuserspackage Foo; use Moose; has bar => (is => 'ro'); sub meth { $error; 2 } no Moose; 1; Class-Refresh-0.07/t/data/compile-error/before/0000755000175000001440000000000012303255517020013 5ustar doyusersClass-Refresh-0.07/t/data/compile-error/before/Foo.pm0000644000175000001440000000012112303255517021066 0ustar doyuserspackage Foo; use Moose; has foo => (is => 'ro'); sub meth { 1 } no Moose; 1; Class-Refresh-0.07/t/data/compile-error/after/0000755000175000001440000000000012303255517017652 5ustar doyusersClass-Refresh-0.07/t/data/compile-error/after/Foo.pm0000644000175000001440000000013412303255517020731 0ustar doyuserspackage Foo; use Moose; has bar => (is => 'ro'); sub meth { my $error; 3 } no Moose; 1; Class-Refresh-0.07/t/data/moose-roles/0000755000175000001440000000000012303255517016236 5ustar doyusersClass-Refresh-0.07/t/data/moose-roles/after/0000755000175000001440000000000012303255517017337 5ustar doyusersClass-Refresh-0.07/t/data/moose-roles/after/Foo/0000755000175000001440000000000012303255517020062 5ustar doyusersClass-Refresh-0.07/t/data/moose-roles/after/Foo/Role.pm0000644000175000001440000000021412303255517021316 0ustar doyuserspackage Foo::Role; use Moose::Role; $::reloads{foo_role}++; has foo_role2 => ( is => 'ro', isa => 'Str', ); no Moose::Role; 1; Class-Refresh-0.07/t/data/moose-roles/before/0000755000175000001440000000000012303255517017500 5ustar doyusersClass-Refresh-0.07/t/data/moose-roles/before/Foo/0000755000175000001440000000000012303255517020223 5ustar doyusersClass-Refresh-0.07/t/data/moose-roles/before/Foo/Role.pm0000644000175000001440000000021412303255517021457 0ustar doyuserspackage Foo::Role; use Moose::Role; $::reloads{foo_role}++; has foo_role1 => ( is => 'ro', isa => 'Str', ); no Moose::Role; 1; Class-Refresh-0.07/t/data/moose-roles/before/Bar/0000755000175000001440000000000012303255517020204 5ustar doyusersClass-Refresh-0.07/t/data/moose-roles/before/Bar/Role.pm0000644000175000001440000000023612303255517021444 0ustar doyuserspackage Bar::Role; use Moose::Role; $::reloads{bar_role}++; with 'Foo::Role'; has bar_role => ( is => 'ro', isa => 'Str', ); no Moose::Role; 1; Class-Refresh-0.07/t/data/moose-roles/before/Baz/0000755000175000001440000000000012303255517020214 5ustar doyusersClass-Refresh-0.07/t/data/moose-roles/before/Baz/Role.pm0000644000175000001440000000021312303255517021447 0ustar doyuserspackage Baz::Role; use Moose::Role; $::reloads{baz_role}++; has baz_role => ( is => 'ro', isa => 'Str', ); no Moose::Role; 1; Class-Refresh-0.07/t/data/moose-roles/before/Foo.pm0000644000175000001440000000024512303255517020562 0ustar doyuserspackage Foo; use Moose; $::reloads{foo}++; with 'Foo::Role'; has foo => ( is => 'ro', isa => 'Str', ); __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-roles/before/Baz.pm0000644000175000001440000000026212303255517020552 0ustar doyuserspackage Baz; use Moose; $::reloads{baz}++; with 'Bar::Role', 'Baz::Role'; has baz => ( is => 'ro', isa => 'Str', ); __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-roles/before/Bar.pm0000644000175000001440000000024512303255517020543 0ustar doyuserspackage Bar; use Moose; $::reloads{bar}++; with 'Bar::Role'; has bar => ( is => 'ro', isa => 'Str', ); __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-basic/0000755000175000001440000000000012303255517016173 5ustar doyusersClass-Refresh-0.07/t/data/moose-basic/before/0000755000175000001440000000000012303255517017435 5ustar doyusersClass-Refresh-0.07/t/data/moose-basic/before/Foo/0000755000175000001440000000000012303255517020160 5ustar doyusersClass-Refresh-0.07/t/data/moose-basic/before/Foo/Immutable.pm0000644000175000001440000000017512303255517022440 0ustar doyuserspackage Foo::Immutable; use Moose; has foo => (is => 'ro'); sub meth { } __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-basic/before/Foo.pm0000644000175000001440000000011712303255517020515 0ustar doyuserspackage Foo; use Moose; has foo => (is => 'ro'); sub meth { } no Moose; 1; Class-Refresh-0.07/t/data/moose-basic/after/0000755000175000001440000000000012303255517017274 5ustar doyusersClass-Refresh-0.07/t/data/moose-basic/after/Foo/0000755000175000001440000000000012303255517020017 5ustar doyusersClass-Refresh-0.07/t/data/moose-basic/after/Foo/Immutable.pm0000644000175000001440000000020312303255517022267 0ustar doyuserspackage Foo::Immutable; use Moose; has bar => (is => 'ro'); sub other_meth { } __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/moose-basic/after/Foo.pm0000644000175000001440000000012512303255517020353 0ustar doyuserspackage Foo; use Moose; has bar => (is => 'ro'); sub other_meth { } no Moose; 1; Class-Refresh-0.07/t/data/new-modules/0000755000175000001440000000000012303255517016231 5ustar doyusersClass-Refresh-0.07/t/data/new-modules/middle/0000755000175000001440000000000012303255517017467 5ustar doyusersClass-Refresh-0.07/t/data/new-modules/middle/Foo.pm0000644000175000001440000000007212303255517020547 0ustar doyuserspackage Foo; use strict; use warnings; sub bar { 2 } 1; Class-Refresh-0.07/t/data/new-modules/before/0000755000175000001440000000000012303255517017473 5ustar doyusersClass-Refresh-0.07/t/data/new-modules/before/Foo.pm0000644000175000001440000000007212303255517020553 0ustar doyuserspackage Foo; use strict; use warnings; sub bar { 1 } 1; Class-Refresh-0.07/t/data/new-modules/after/0000755000175000001440000000000012303255517017332 5ustar doyusersClass-Refresh-0.07/t/data/new-modules/after/Foo.pm0000644000175000001440000000007212303255517020412 0ustar doyuserspackage Foo; use strict; use warnings; sub bar { 3 } 1; Class-Refresh-0.07/t/data/other-api/0000755000175000001440000000000012303255517015662 5ustar doyusersClass-Refresh-0.07/t/data/other-api/before/0000755000175000001440000000000012303255517017124 5ustar doyusersClass-Refresh-0.07/t/data/other-api/before/Foo/0000755000175000001440000000000012303255517017647 5ustar doyusersClass-Refresh-0.07/t/data/other-api/before/Foo/Baz.pm0000644000175000001440000000007212303255517020720 0ustar doyuserspackage Foo::Baz; use Moose; sub meth { } no Moose; 1; Class-Refresh-0.07/t/data/other-api/before/Foo/Bar.pm0000644000175000001440000000007212303255517020710 0ustar doyuserspackage Foo::Bar; use Moose; sub meth { } no Moose; 1; Class-Refresh-0.07/t/data/other-api/before/Foo.pm0000644000175000001440000000006512303255517020206 0ustar doyuserspackage Foo; use Moose; sub meth { } no Moose; 1; Class-Refresh-0.07/t/data/other-api/after/0000755000175000001440000000000012303255517016763 5ustar doyusersClass-Refresh-0.07/t/data/other-api/after/Foo/0000755000175000001440000000000012303255517017506 5ustar doyusersClass-Refresh-0.07/t/data/other-api/after/Foo/Bar.pm0000644000175000001440000000014312303255517020546 0ustar doyuserspackage Foo::Bar; use Moose; sub other_meth { } __PACKAGE__->meta->make_immutable; no Moose; 1; Class-Refresh-0.07/t/data/other-api/after/Foo.pm0000644000175000001440000000007312303255517020044 0ustar doyuserspackage Foo; use Moose; sub other_meth { } no Moose; 1; Class-Refresh-0.07/t/data/basic/0000755000175000001440000000000012303255517015053 5ustar doyusersClass-Refresh-0.07/t/data/basic/before/0000755000175000001440000000000012303255517016315 5ustar doyusersClass-Refresh-0.07/t/data/basic/before/Foo.pm0000644000175000001440000000007412303255517017377 0ustar doyuserspackage Foo; our $FOO = 1; our $BAR = 2; sub meth { } 1; Class-Refresh-0.07/t/data/basic/after/0000755000175000001440000000000012303255517016154 5ustar doyusersClass-Refresh-0.07/t/data/basic/after/Foo.pm0000644000175000001440000000010412303255517017230 0ustar doyuserspackage Foo; our $FOO = 10; our $BAZ = 30; sub other_meth { } 1; Class-Refresh-0.07/t/data/basic/after/Bar.pm0000644000175000001440000000004112303255517017211 0ustar doyuserspackage Bar; use Bar::Fake; 1; Class-Refresh-0.07/t/moose-metaclasses.t0000644000175000001440000000316512303255517016677 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Requires 'Moose', 'Test::Moose'; use lib 't/lib'; use Test::Class::Refresh; use Class::Refresh; my $dir = prepare_temp_dir_for('moose-metaclasses'); push @INC, $dir->dirname; our %reloaded; require Foo; require Bar; Class::Refresh->refresh; my $metaclass = Scalar::Util::blessed(Foo->meta); does_ok(Foo->meta, 'Foo::Meta::Class'); ok(!Moose::Util::does_role(Bar->meta, 'Foo::Meta::Class'), "!Bar->meta->does('Foo::Meta::Class')"); ok(Foo->meta->meta->find_attribute_by_name('meta_attr'), "has meta attribute"); ok(!Foo->meta->meta->find_attribute_by_name('meta_attr2'), "doesn't have other meta attribute"); is_deeply(\%reloaded, { foo => 1, foo_meta_class => 1, bar => 1 }, "everything loaded"); sleep 2; update_temp_dir_for('moose-metaclasses', $dir); { my $warnings; local $SIG{__WARN__} = sub { $warnings .= $_[0] }; Class::Refresh->refresh; like($warnings, qr/Not reloading Moose::Meta::Class::__ANON__::SERIAL::/); } does_ok(Foo->meta, 'Foo::Meta::Class'); ok(!Moose::Util::does_role(Bar->meta, 'Foo::Meta::Class'), "!Bar->meta->does('Foo::Meta::Class')"); { local $TODO = "moose needs a way to clear out its anon class cache"; ok(!Foo->meta->meta->find_attribute_by_name('meta_attr'), "doesn't have meta attribute"); ok(Foo->meta->meta->find_attribute_by_name('meta_attr2'), "has other meta attribute"); isnt(Scalar::Util::blessed(Foo->meta), $metaclass, "Foo got a new metaclass"); } is_deeply(\%reloaded, { foo => 2, foo_meta_class => 2, bar => 1 }, "everything loaded"); done_testing; Class-Refresh-0.07/t/moose-subclasses.t0000644000175000001440000000267212303255517016544 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Requires 'Moose'; use lib 't/lib'; use Test::Class::Refresh; use Class::Refresh; my $dir = prepare_temp_dir_for('moose-subclasses'); push @INC, $dir->dirname; our ($superclass_reloads, $subclass_reloads) = (0, 0); require Foo; require Foo::Sub; Class::Refresh->refresh; is($superclass_reloads, 1, "superclass loaded"); is($subclass_reloads, 1, "subclass loaded"); is_deeply([sort map { $_->name } Foo->meta->get_all_attributes], ['foo'], "correct starting attr list"); can_ok('Foo', 'meth'); ok(!Foo->can('other_meth'), "!Foo->can('other_meth')"); is_deeply([sort map { $_->name } Foo::Sub->meta->get_all_attributes], ['baz', 'foo'], "correct starting attr list"); can_ok('Foo::Sub', 'meth'); ok(!Foo::Sub->can('other_meth'), "!Foo::Sub->can('other_meth')"); sleep 2; update_temp_dir_for('moose-subclasses', $dir); Class::Refresh->refresh; is($superclass_reloads, 2, "superclass reloaded"); is($subclass_reloads, 2, "subclass reloaded"); is_deeply([sort map { $_->name } Foo->meta->get_all_attributes], ['bar'], "correct new attr list"); ok(!Foo->can('meth'), "!Foo->can('meth')"); can_ok('Foo', 'other_meth'); is_deeply([sort map { $_->name } Foo::Sub->meta->get_all_attributes], ['bar', 'baz'], "correct new attr list"); can_ok('Foo::Sub', 'meth'); can_ok('Foo::Sub', 'other_meth'); done_testing; Class-Refresh-0.07/t/moose-late-load.t0000644000175000001440000000351012303255517016227 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use lib 't/lib'; use Test::Class::Refresh; use Class::Refresh track_require => 1; my $dir; BEGIN { $dir = prepare_temp_dir_for('moose-late-load'); push @INC, $dir->dirname; Class::Refresh->refresh; } # have to do this later use Test::Requires 'Moose'; require Foo; require Foo::Immutable; is_deeply([Foo->meta->get_attribute_list], ['foo'], "correct starting attr list"); can_ok('Foo', 'meth'); ok(!Foo->can('other_meth'), "!Foo->can('other_meth')"); is_deeply([Foo::Immutable->meta->get_attribute_list], ['foo'], "correct starting attr list"); can_ok('Foo::Immutable', 'meth'); ok(!Foo::Immutable->can('other_meth'), "!Foo::Immutable->can('other_meth')"); sleep 2; update_temp_dir_for('moose-late-load', $dir, 'middle'); Class::Refresh->refresh; is_deeply([Foo->meta->get_attribute_list], ['bar'], "correct refreshed attr list"); can_ok('Foo', 'other_meth'); ok(!Foo->can('meth'), "!Foo->can('meth')"); is_deeply([Foo::Immutable->meta->get_attribute_list], ['bar'], "correct refreshed attr list"); can_ok('Foo::Immutable', 'other_meth'); ok(!Foo::Immutable->can('meth'), "!Foo::Immutable->can('meth')"); sleep 2; update_temp_dir_for('moose-late-load', $dir, 'after'); Class::Refresh->refresh; is_deeply([Foo->meta->get_attribute_list], ['baz'], "correct refreshed attr list"); can_ok('Foo', 'other_other_meth'); ok(!Foo->can('meth'), "!Foo->can('meth')"); ok(!Foo->can('other_meth'), "!Foo->can('other_meth')"); is_deeply([Foo::Immutable->meta->get_attribute_list], ['baz'], "correct refreshed attr list"); can_ok('Foo::Immutable', 'other_other_meth'); ok(!Foo::Immutable->can('meth'), "!Foo::Immutable->can('meth')"); ok(!Foo::Immutable->can('other_meth'), "!Foo::Immutable->can('other_meth')"); done_testing; Class-Refresh-0.07/t/compile-error.t0000644000175000001440000000230012303255517016020 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Fatal; use Test::Requires 'Moose'; use lib 't/lib'; use Test::Class::Refresh; use Try::Tiny; use Class::Refresh; my $dir = prepare_temp_dir_for('compile-error'); push @INC, $dir->dirname; require Foo; is(exception { Class::Refresh->refresh }, undef, "loads successfully"); my $foo = Foo->new; my $val; is(exception { $val = $foo->meth }, undef, "\$foo->meth works"); is($val, 1, "got the right value"); sleep 2; update_temp_dir_for('compile-error', $dir, 'middle'); like( exception { Class::Refresh->refresh }, qr/^Global symbol "\$error" requires explicit package name/, "compilation error" ); like( exception { $foo->meth }, qr{^ # 5.18+ (?:Can't\ locate\ object\ method\ "meth"\ via\ package\ "Foo") | # 5.16 and earlier (?:Undefined\ subroutine\ &Foo::meth\ called) }x, "\$foo->meth doesn't work now" ); sleep 2; update_temp_dir_for('compile-error', $dir, 'after'); is(exception { Class::Refresh->refresh }, undef, "loads successfully"); is(exception { $val = $foo->meth }, undef, "\$foo->meth works again"); is($val, 3, "got the right value"); done_testing; Class-Refresh-0.07/t/new-modules.t0000644000175000001440000000104212303255517015502 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use lib 't/lib'; use Test::Class::Refresh; use Class::Refresh track_require => 1; my $dir = prepare_temp_dir_for('new-modules'); push @INC, $dir->dirname; Class::Refresh->refresh; # load Foo after the first call to refresh require Foo; is(Foo->bar, 1); sleep 2; update_temp_dir_for('new-modules', $dir, 'middle'); Class::Refresh->refresh; is(Foo->bar, 2); sleep 2; update_temp_dir_for('new-modules', $dir, 'after'); Class::Refresh->refresh; is(Foo->bar, 3); done_testing; Class-Refresh-0.07/t/moose-basic.t0000644000175000001440000000220412303255517015445 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Requires 'Moose'; use lib 't/lib'; use Test::Class::Refresh; use Class::Refresh; my $dir = prepare_temp_dir_for('moose-basic'); push @INC, $dir->dirname; require Foo; require Foo::Immutable; Class::Refresh->refresh; is_deeply([Foo->meta->get_attribute_list], ['foo'], "correct starting attr list"); can_ok('Foo', 'meth'); ok(!Foo->can('other_meth'), "!Foo->can('other_meth')"); is_deeply([Foo::Immutable->meta->get_attribute_list], ['foo'], "correct starting attr list"); can_ok('Foo::Immutable', 'meth'); ok(!Foo::Immutable->can('other_meth'), "!Foo::Immutable->can('other_meth')"); sleep 2; update_temp_dir_for('moose-basic', $dir); Class::Refresh->refresh; is_deeply([Foo->meta->get_attribute_list], ['bar'], "correct refreshed attr list"); can_ok('Foo', 'other_meth'); ok(!Foo->can('meth'), "!Foo->can('meth')"); is_deeply([Foo::Immutable->meta->get_attribute_list], ['bar'], "correct refreshed attr list"); can_ok('Foo::Immutable', 'other_meth'); ok(!Foo::Immutable->can('meth'), "!Foo::Immutable->can('meth')"); done_testing; Class-Refresh-0.07/t/moose-roles.t0000644000175000001440000000314712303255517015517 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Requires 'Moose'; use lib 't/lib'; use Test::Class::Refresh; use Class::Refresh; my $dir = prepare_temp_dir_for('moose-roles'); push @INC, $dir->dirname; our %reloads; require Foo; require Bar; require Baz; Class::Refresh->refresh; is_deeply([sort map { $_->name } Foo->meta->get_all_attributes], ['foo', 'foo_role1'], "correct starting attr list"); is_deeply([sort map { $_->name } Bar->meta->get_all_attributes], ['bar', 'bar_role', 'foo_role1'], "correct starting attr list"); is_deeply([sort map { $_->name } Baz->meta->get_all_attributes], ['bar_role', 'baz', 'baz_role', 'foo_role1'], "correct starting attr list"); is_deeply(\%reloads, { foo => 1, foo_role => 1, bar => 1, bar_role => 1, baz => 1, baz_role => 1 }, "everything loaded"); sleep 2; update_temp_dir_for('moose-roles', $dir); Class::Refresh->refresh; is_deeply([sort map { $_->name } Foo->meta->get_all_attributes], ['foo', 'foo_role2'], "correct starting attr list"); is_deeply([sort map { $_->name } Bar->meta->get_all_attributes], ['bar', 'bar_role', 'foo_role2'], "correct starting attr list"); is_deeply([sort map { $_->name } Baz->meta->get_all_attributes], ['bar_role', 'baz', 'baz_role', 'foo_role2'], "correct starting attr list"); is_deeply(\%reloads, { foo => 2, foo_role => 2, bar => 2, bar_role => 2, baz => 2, baz_role => 1 }, "everything reloaded"); done_testing; Class-Refresh-0.07/t/00-compile.t0000644000175000001440000000171212303255517015114 0ustar doyusersuse strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.037 use Test::More tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'Class/Refresh.pm' ); # no fake home requested my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; use File::Spec; use IPC::Open3; use IO::Handle; my @warnings; for my $lib (@module_files) { # see L open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING}; Class-Refresh-0.07/t/other-api.t0000644000175000001440000000310512303255517015135 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Requires 'Moose'; use lib 't/lib'; use Test::Class::Refresh; use Class::Refresh; my $dir = prepare_temp_dir_for('other-api'); push @INC, $dir->dirname; require Foo; require Foo::Bar; Class::Refresh->refresh; is_deeply([Class::Refresh->modified_modules], [], "got the right list of modified modules"); sleep 2; update_temp_dir_for('other-api', $dir); is_deeply([sort Class::Refresh->modified_modules], ['Foo', 'Foo::Bar'], "got the right list of modified modules"); Class::Refresh->refresh; ok(Class::Load::is_class_loaded('Foo'), "Foo is loaded"); Class::Refresh->unload_module('Foo'); ok(!Class::Load::is_class_loaded('Foo'), "Foo is not loaded"); ok(!Class::MOP::class_of('Foo'), "Foo no longer has a metaclass"); ok(!exists $INC{'Foo.pm'}, "Foo isn't in \%INC"); is_deeply([Class::Refresh->modified_modules], [], "got the right list of modified modules"); Class::Refresh->load_module('Foo'); ok(Class::Load::is_class_loaded('Foo'), "Foo is loaded"); ok(Class::MOP::class_of('Foo'), "Foo has a metaclass"); ok(exists $INC{'Foo.pm'}, "Foo is in \%INC"); is_deeply([Class::Refresh->modified_modules], [], "got the right list of modified modules"); my $meta = Class::MOP::class_of('Foo'); Class::Refresh->refresh_module('Foo'); ok(Class::Load::is_class_loaded('Foo'), "Foo is loaded"); ok(Class::MOP::class_of('Foo'), "Foo has a metaclass"); ok(exists $INC{'Foo.pm'}, "Foo is in \%INC"); isnt($meta, Class::MOP::class_of('Foo'), "metaclass was reinitialized"); done_testing; Class-Refresh-0.07/t/basic.t0000644000175000001440000000330212303255517014325 0ustar doyusers#!/usr/bin/env perl use strict; use warnings; use Test::More; use Test::Fatal; use lib 't/lib'; use Test::Class::Refresh; use Try::Tiny; use Class::Refresh; my $dir = prepare_temp_dir_for('basic'); push @INC, $dir->dirname; require Foo; Class::Refresh->refresh; can_ok('Foo', 'meth'); ok(!Foo->can('other_meth'), "!Foo->can('other_meth')"); is($Foo::FOO, 1, "package global exists"); is($Foo::BAR, 2, "other package global exists"); ok(!defined($Foo::BAZ), "third package global doesn't exist"); sleep 2; update_temp_dir_for('basic', $dir); Class::Refresh->refresh; can_ok('Foo', 'other_meth'); ok(!Foo->can('meth'), "!Foo->can('meth')"); { local $TODO = "hrm, global access like this is resolved at compile time"; is($Foo::FOO, 10, "package global exists with new value"); ok(!defined($Foo::BAR), "other package global doesn't exist"); is($Foo::BAZ, 30, "third package global exists"); } is(eval '$Foo::FOO', 10, "package global exists with new value"); ok(!defined(eval '$Foo::BAR'), "other package global doesn't exist"); is(eval '$Foo::BAZ', 30, "third package global exists"); try { require Bar } catch { "We expect this to fail, that's alright and happens sometimes" }; Class::Refresh->refresh; ok(exists $INC{'Bar.pm'}, "Failed package \$INC value exists"); ok(!defined $INC{'Bar.pm'}, "Failed package \$INC value is not defined after failed load"); # Now do the same thing to validate that there's no error in repopulating %CACHE isnt(exception{ Class::Refresh->refresh }, "Second refresh is not an error"); ok(exists $INC{'Bar.pm'}, "Failed package \$INC value exists: second attempt"); ok(!defined $INC{'Bar.pm'}, "Failed package \$INC value is not defined after failed load: second attempt"); done_testing; Class-Refresh-0.07/MANIFEST0000644000175000001440000000347012303255517013753 0ustar doyusers# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.008. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/Class/Refresh.pm t/00-compile.t t/basic.t t/compile-error.t t/data/basic/after/Bar.pm t/data/basic/after/Foo.pm t/data/basic/before/Foo.pm t/data/compile-error/after/Foo.pm t/data/compile-error/before/Foo.pm t/data/compile-error/middle/Foo.pm t/data/moose-basic/after/Foo.pm t/data/moose-basic/after/Foo/Immutable.pm t/data/moose-basic/before/Foo.pm t/data/moose-basic/before/Foo/Immutable.pm t/data/moose-late-load/after/Foo.pm t/data/moose-late-load/after/Foo/Immutable.pm t/data/moose-late-load/before/Foo.pm t/data/moose-late-load/before/Foo/Immutable.pm t/data/moose-late-load/middle/Foo.pm t/data/moose-late-load/middle/Foo/Immutable.pm t/data/moose-metaclasses/after/Foo/Meta/Class.pm t/data/moose-metaclasses/before/Bar.pm t/data/moose-metaclasses/before/Foo.pm t/data/moose-metaclasses/before/Foo/Meta/Class.pm t/data/moose-roles/after/Foo/Role.pm t/data/moose-roles/before/Bar.pm t/data/moose-roles/before/Bar/Role.pm t/data/moose-roles/before/Baz.pm t/data/moose-roles/before/Baz/Role.pm t/data/moose-roles/before/Foo.pm t/data/moose-roles/before/Foo/Role.pm t/data/moose-subclasses/after/Foo.pm t/data/moose-subclasses/before/Foo.pm t/data/moose-subclasses/before/Foo/Sub.pm t/data/new-modules/after/Foo.pm t/data/new-modules/before/Foo.pm t/data/new-modules/middle/Foo.pm t/data/other-api/after/Foo.pm t/data/other-api/after/Foo/Bar.pm t/data/other-api/before/Foo.pm t/data/other-api/before/Foo/Bar.pm t/data/other-api/before/Foo/Baz.pm t/lib/Test/Class/Refresh.pm t/moose-basic.t t/moose-late-load.t t/moose-metaclasses.t t/moose-roles.t t/moose-subclasses.t t/new-modules.t t/other-api.t xt/release/eol.t xt/release/no-tabs.t xt/release/pod-coverage.t xt/release/pod-syntax.t Class-Refresh-0.07/META.yml0000644000175000001440000001467412303255517014103 0ustar doyusers--- abstract: 'refresh your classes during runtime' author: - 'Jesse Luehrs ' build_requires: Exporter: 0 File::Copy: 0 File::Find: 0 File::Spec: 0 File::Temp: 0 IO::Handle: 0 IPC::Open3: 0 Test::Fatal: 0 Test::More: 0.88 Test::Requires: 0 lib: 0 configure_requires: ExtUtils::MakeMaker: 6.30 dynamic_config: 0 generated_by: 'Dist::Zilla version 5.008, CPAN::Meta::Converter version 2.132830' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Class-Refresh provides: Class::Refresh: file: lib/Class/Refresh.pm version: 0.07 requires: B: 0 Carp: 0 Class::Load: 0 Class::Unload: 0 Devel::OverrideGlobalRequire: 0 Try::Tiny: 0 strict: 0 warnings: 0 resources: bugtracker: https://github.com/doy/class-refresh/issues homepage: http://metacpan.org/release/Class-Refresh repository: git://github.com/doy/class-refresh.git version: 0.07 x_Dist_Zilla: perl: version: 5.018001 plugins: - class: Dist::Zilla::Plugin::Prereqs config: Dist::Zilla::Plugin::Prereqs: phase: test type: requires name: '@DOY/TestMoreDoneTesting' version: 5.008 - class: Dist::Zilla::Plugin::GatherDir name: '@DOY/GatherDir' version: 5.008 - class: Dist::Zilla::Plugin::PruneCruft name: '@DOY/PruneCruft' version: 5.008 - class: Dist::Zilla::Plugin::ManifestSkip name: '@DOY/ManifestSkip' version: 5.008 - class: Dist::Zilla::Plugin::MetaYAML name: '@DOY/MetaYAML' version: 5.008 - class: Dist::Zilla::Plugin::License name: '@DOY/License' version: 5.008 - class: Dist::Zilla::Plugin::Readme name: '@DOY/Readme' version: 5.008 - class: Dist::Zilla::Plugin::RunExtraTests name: '@DOY/RunExtraTests' version: 0.013 - class: Dist::Zilla::Plugin::ExecDir name: '@DOY/ExecDir' version: 5.008 - class: Dist::Zilla::Plugin::ShareDir name: '@DOY/ShareDir' version: 5.008 - class: Dist::Zilla::Plugin::MakeMaker name: '@DOY/MakeMaker' version: 5.008 - class: Dist::Zilla::Plugin::Manifest name: '@DOY/Manifest' version: 5.008 - class: Dist::Zilla::Plugin::TestRelease name: '@DOY/TestRelease' version: 5.008 - class: Dist::Zilla::Plugin::ConfirmRelease name: '@DOY/ConfirmRelease' version: 5.008 - class: Dist::Zilla::Plugin::MetaConfig name: '@DOY/MetaConfig' version: 5.008 - class: Dist::Zilla::Plugin::MetaJSON name: '@DOY/MetaJSON' version: 5.008 - class: Dist::Zilla::Plugin::NextRelease name: '@DOY/NextRelease' version: 5.008 - class: Dist::Zilla::Plugin::CheckChangesHasContent name: '@DOY/CheckChangesHasContent' version: 0.006 - class: Dist::Zilla::Plugin::PkgVersion name: '@DOY/PkgVersion' version: 5.008 - class: Dist::Zilla::Plugin::Authority name: '@DOY/Authority' version: 1.006 - class: Dist::Zilla::Plugin::PodCoverageTests name: '@DOY/PodCoverageTests' version: 5.008 - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@DOY/PodSyntaxTests' version: 5.008 - class: Dist::Zilla::Plugin::NoTabsTests config: Dist::Zilla::Plugin::Test::NoTabs: module_finder: - ':InstallModules' script_finder: - ':ExecFiles' name: '@DOY/NoTabsTests' version: 0.05 - class: Dist::Zilla::Plugin::EOLTests name: '@DOY/EOLTests' version: 0.02 - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: filename: t/00-compile.t module_finder: - ':InstallModules' script_finder: - ':ExecFiles' name: '@DOY/Test::Compile' version: 2.037 - class: Dist::Zilla::Plugin::Metadata name: '@DOY/Metadata' version: 3.03 - class: Dist::Zilla::Plugin::MetaResources name: '@DOY/MetaResources' version: 5.008 - class: Dist::Zilla::Plugin::Git::Check name: '@DOY/Git::Check' version: 2.016 - class: Dist::Zilla::Plugin::Git::Commit name: '@DOY/Git::Commit' version: 2.016 - class: Dist::Zilla::Plugin::Git::Tag name: '@DOY/Git::Tag' version: 2.016 - class: Dist::Zilla::Plugin::Git::NextVersion name: '@DOY/Git::NextVersion' version: 2.016 - class: Dist::Zilla::Plugin::ContributorsFromGit name: '@DOY/ContributorsFromGit' version: 0.006 - class: Dist::Zilla::Plugin::FinderCode name: '@DOY/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: 5.008 - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: {} Dist::Zilla::Role::MetaProvider::Provider: inherit_missing: 1 inherit_version: 1 meta_noindex: 1 name: '@DOY/MetaProvides::Package' version: 1.15000000 - class: Dist::Zilla::Plugin::PodWeaver name: '@DOY/PodWeaver' version: 3.101641 - class: Dist::Zilla::Plugin::UploadToCPAN name: '@DOY/UploadToCPAN' version: 5.008 - class: Dist::Zilla::Plugin::AutoPrereqs name: AutoPrereqs version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: 5.008 - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: 5.008 zilla: class: Dist::Zilla::Dist::Builder config: is_trial: 0 version: 5.008 x_authority: cpan:DOY x_contributors: - 'Michael Reddick ' - 'amacleay ' Class-Refresh-0.07/dist.ini0000644000175000001440000000036412303255517014265 0ustar doyusersname = Class-Refresh author = Jesse Luehrs license = Perl_5 copyright_holder = Jesse Luehrs [@DOY] :version = 0.14 dist = Class-Refresh repository = github [AutoPrereqs] skip = ^(?:Foo|Bar|Baz)(?:$|::) skip = Moose(?:$|::Role) Class-Refresh-0.07/LICENSE0000644000175000001440000004365312303255517013636 0ustar doyusersThis software is copyright (c) 2014 by Jesse Luehrs. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2014 by Jesse Luehrs. This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program 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 1, or (at your option) any later version. This program 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 program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2014 by Jesse Luehrs. This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Class-Refresh-0.07/Changes0000644000175000001440000000134012303255517014107 0ustar doyusersRevision history for Class-Refresh 0.07 2014-02-25 - fix for newer moose (reported by kentfredric, #3) 0.06 2014-01-22 - refreshing doesn't die if a package wasn't able to be loaded in the past (amacleay, #2) 0.05 2013-06-25 - revert the previous fix, since it causes issues - add 'track_require' import arg, as a better fix 0.04 2013-06-21 - fix refreshing a module for the first time when it was first loaded after the first call to refresh 0.03 2013-06-21 - fix the case where reloading after a compilation error wouldn't work properly (Michael Reddick) 0.02 2011-04-10 - whoops, can't use Sub::Exporter in tests 0.01 2011-04-06 - Initial release Class-Refresh-0.07/README0000644000175000001440000000056412303255517013503 0ustar doyusers This archive contains the distribution Class-Refresh, version 0.07: refresh your classes during runtime This software is copyright (c) 2014 by Jesse Luehrs. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. This README file was generated by Dist::Zilla::Plugin::Readme v5.008.