Package::Checkpoint::Guard - Checkpoint the scalar, array and hash values in a package for automatic restoration
version 0.01
package Foo::Bar { our $foo = 1; our @bar = (1,2,3); our %baz = ( a => 1 ); } { my $guard = Package::Checkpoint::Guard->new('Foo::Bar'); # modify Foo::Bar $Foo::Bar::foo++; push @Foo::Bar::bar, 4; $Foo::Bar::baz{b} = 2; } # $guard falls out of scope... # [$@%]Foo::Bar::{foo,bar,baz} are now back to their original values
This class works exactly like Package::Checkpoint, except that it will automatically restore when it falls out of scope.
Doesn't checkpoint or even consider a whole host of values that might be of interest, like subroutines or file handles.
Graham Ollis <plicease@cpan.org>
This software is copyright (c) 2021 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.