WeakRef man page on OpenSuSE

Man page or keyword search:  
man Server   25941 pages
apropos Keyword Search (all sections)
Output format
OpenSuSE logo
[printable version]

WeakRef(3)	      User Contributed Perl Documentation	    WeakRef(3)

NAME
       WeakRef -- an API to the Perl weak references

SYNOPSIS
	       use WeakRef;

	       for($i=0; $i<100000; $i++) {
		       my $x = {};
		       my $y = {};
		       $x->{Y} = $y;
		       $y->{X} = $y;
		       weaken($x->{Y});
	       } # no memory leak

	       if(isweak($ref)) {
	       }

DESCRIPTION
       A patch to Perl 5.005_55 by the author implements a core API for weak
       references. This module is a Perl-level interface to that API, allowing
       weak references to be created in Perl.

       A weak reference is just like an ordinary Perl reference except that it
       isn't included in the reference count of the thing referred to.	This
       means that once all references to a particular piece of data are weak,
       the piece of data is freed and all the weak references are set to
       undef. This is particularly useful for implementing circular data
       structures without memory leaks or caches of objects.

       The command

	       use WeakRef;

       exports two symbols to the user's namespace by default: "weaken" and
       "isweak". "weaken" takes a single argument, the reference to be
       weakened, and returns the same value.  The idiom

	       weaken($this->{Thing}->{Parent} = $this);

       is useful.

       The "isweak" command takes a single parameter and returns true if the
       parameter is a weak reference, undef otherwise.

BUGS
       None known.

AUTHOR
       Tuomas J. Lukka		lukka@iki.fi

       Copyright (c) 1999 Tuomas J. Lukka. All rights reserved. This program
       is free software; you can redistribute it and/or modify it under the
       same terms as perl itself.

BLATANT PLUG
       This module and the patch to the core Perl were written in connection
       with the APress book `Tuomas J. Lukka's Definitive Guide to Object-
       Oriented Programming in Perl', to avoid explaining why certain things
       would have to be done in cumbersome ways.

perl v5.18.1			  1999-02-23			    WeakRef(3)
[top]

List of man pages available for OpenSuSE

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net