1Package::Reaper(3) User Contributed Perl Documentation Package::Reaper(3)
2
3
4
6 Package::Reaper - pseudo-garbage-collection for packages
7
9 version 0.103
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 destoryed.
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 Please report any bugs or feature requests to
65 "bug-package-generator@rt.cpan.org", or through the web interface at
66 <http://rt.cpan.org>. I will be notified, and then you'll
67 automatically be notified of progress on your bug as I make changes.
68
70 Copyright 2006 Ricardo Signes, all rights reserved.
71
72 This program is free software; you can redistribute it and/or modify it
73 under the same terms as Perl itself.
74
75
76
77perl v5.16.3 2009-07-09 Package::Reaper(3)