目录

Perl Module Devel::Cycle

This module can be used to find memory cycles in objects and other references. Here is the synopsis:

!/usr/bin/perl

use Devel::Cycle;

create an object that has four cycles

my $test = {fred => [qw(a b c d e)], ethel => [qw(1 2 3 4 5)], george => {martha => 23, agnes => 19} };

cycle 1

test>georgephyllis=test->{george}{phyllis} =test;

cycle 2

test>fred[3]=test->{fred}[3] =test->{george};

cycles 3 and 4

test>georgemary=test->{george}{mary} =test->{fred}; find_cycle($test); exit 0;

output of the script:

Cycle (1): HASH(0x8171d30)->{george} => HASH(0x8171d00) HASH(0x8171d00)->{phyllis} => HASH(0x8171d30)

Cycle (2): HASH(0x8171d30)->{george} => HASH(0x8171d00) HASH(0x8171d00)->{mary} => ARRAY(0x814be60) ARRAY(0x814be60)->[3] => HASH(0x8171d00)

Cycle (3): HASH(0x8171d30)->{fred} => ARRAY(0x814be60) ARRAY(0x814be60)->[3] => HASH(0x8171d00) HASH(0x8171d00)->{phyllis} => HASH(0x8171d30)

Cycle (4): HASH(0x8171d30)->{fred} => ARRAY(0x814be60) ARRAY(0x814be60)->[3] => HASH(0x8171d00) HASH(0x8171d00)->{mary} => ARRAY(0x814be60)

INSTALLATION

To install this module type the following:

perl Makefile.PL make make test make install

DEVELOPING

The master repository for Devel::Cycle is kept on GitHub at https://github.com/lstein/Devel-Cycle. Please contribute by sending pull requests.

COPYRIGHT AND LICENCE

Copyright (C) 2003-2014 by Lincoln Stein lincoln.stein@gmail.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.2 or, at your option, any later version of Perl 5 you may have available.

关于

用于检测Perl数据结构中循环引用的开发工具

53.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802047560号