1Package::Reaper(3) User Contributed Perl Documentation Package::Reaper(3)
2
3
4
6 Package::Reaper - pseudo-garbage-collection for packages
7
9 version 1.106
10
12 use Package::Generator;
13 use Package::Reaper;
14
15 {
16 my $package = Package::Generator->new_package;
17 my $reaper = Package::Reaper->new($package);
18 ...
19 }
20
21 # at this point, $package stash has been deleted
22
24 This module allows you to create simple objects which, when destroyed,
25 delete a given package. This lets you approximate lexically scoped
26 packages.
27
29 new
30 my $reaper = Package::Reaper->new($package);
31
32 This returns the newly generated package reaper. When the reaper goes
33 out of scope and is garbage collected, it will delete the symbol table
34 entry for the package.
35
36 package
37 my $package = $reaper->package;
38
39 This method returns the package which will be reaped.
40
41 is_armed
42 if ($reaper->is_armed) { ... }
43
44 This method returns true if the reaper is armed and false otherwise.
45 Reapers always start out armed. A disarmed reaper will not actually
46 reap when destroyed.
47
48 disarm
49 $reaper->disarm;
50
51 This method disarms the reaper, so that it will not reap the package
52 when it is destroyed.
53
54 arm
55 $reaper->arm;
56
57 This method arms the reaper, so that it will reap its package when it
58 is destroyed. By default, new reapers are armed.
59
61 Ricardo SIGNES <rjbs@cpan.org>
62
64 This software is copyright (c) 2005 by Ricardo SIGNES.
65
66 This is free software; you can redistribute it and/or modify it under
67 the same terms as the Perl 5 programming language system itself.
68
69
70
71perl v5.38.0 2023-07-21 Package::Reaper(3)