Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 67 lines (48 sloc) 1.578 kB
74abb15 @rafl initial import of Devel::Cycle 1.00 from CPAN
rafl authored
1 Devel-Cycle version 1.00
2 ========================
3
4 This module can be used to find memory cycles in objects and other
5 references. Here is the synopsis:
6
7 #!/usr/bin/perl
8 use Devel::Cycle;
9
10 # create an object that has four cycles
11 my $test = {fred => [qw(a b c d e)],
12 ethel => [qw(1 2 3 4 5)],
13 george => {martha => 23,
14 agnes => 19}
15 };
16 # cycle 1
17 $test->{george}{phyllis} = $test;
18 # cycle 2
19 $test->{fred}[3] = $test->{george};
20 # cycles 3 and 4
21 $test->{george}{mary} = $test->{fred};
22 find_cycle($test);
23 exit 0;
24
25 # output of the script:
26
27 Cycle (1):
28 HASH(0x8171d30)->{george} => HASH(0x8171d00)
29 HASH(0x8171d00)->{phyllis} => HASH(0x8171d30)
30
31 Cycle (2):
32 HASH(0x8171d30)->{george} => HASH(0x8171d00)
33 HASH(0x8171d00)->{mary} => ARRAY(0x814be60)
34 ARRAY(0x814be60)->[3] => HASH(0x8171d00)
35
36 Cycle (3):
37 HASH(0x8171d30)->{fred} => ARRAY(0x814be60)
38 ARRAY(0x814be60)->[3] => HASH(0x8171d00)
39 HASH(0x8171d00)->{phyllis} => HASH(0x8171d30)
40
41 Cycle (4):
42 HASH(0x8171d30)->{fred} => ARRAY(0x814be60)
43 ARRAY(0x814be60)->[3] => HASH(0x8171d00)
44 HASH(0x8171d00)->{mary} => ARRAY(0x814be60)
45
46
47 INSTALLATION
48
49 To install this module type the following:
50
51 perl Makefile.PL
52 make
53 make test
54 make install
55
56 COPYRIGHT AND LICENCE
57
58 Put the correct copyright and licence information here.
59
60 Copyright (C) 2003 by Lincoln Stein
61
62 This library is free software; you can redistribute it and/or modify
63 it under the same terms as Perl itself, either Perl version 5.8.2 or,
64 at your option, any later version of Perl 5 you may have available.
65
66
Something went wrong with that request. Please try again.