Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
Hash::NoRef(3) User Contributed Perl Documentation Hash::NoRef(3)

Hash::NoRef - A HASH that store values without increase the reference count (weak references).

This HASH will store it's values without increase the reference count. This can be used to store objects but without interfere in the DESTROY mechanism, since the reference in this HASH won't count.

  use Hash::NoRef ;
  my %hash ;
  tie(%hash , 'Hash::NoRef') ;
  ## Or getting a HASH ref tied:
  my $hash = new Hash::NoRef() ;
    my $obj = new FOO() ;
    $hash->{obj} = $obj ;
    ## When we exit this block $obj will be destroied,
    ## even with it stored in $hash->{obj}
  $hash->{obj} ## is undef now!

Return the reference count of a reference. If a reference is not paste it will return -1. Dead references will return 0.

Increase the reference count.

Decrease the reference count.

  my $var = 123 ;
  $refcnt = Hash::NoRef::SvREFCNT( \$var ) ; ## returns 1
  Hash::NoRef::SvREFCNT_inc(\$var) ; ## adda fake reference, so, it will never die.
  Hash::NoRef::SvREFCNT_dec(\$var) ; ## get back to the normal reference count.

Spy, Devel::Peek, Scalar::Util, Safe::World.

Graciliano M. P. <>
I will appreciate any type of feedback (include your opinions and/or suggestions). ;-P

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2004-05-10 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.