Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Programming > Perl Modules

    WeakRef 0.01

    Download button

    No screenshots available
    Downloads: 479  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    Fair (2.5/5)
    4 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Tuomas J. Lukka | More programs
    Perl Artistic License / FREE
    August 11th, 2008, 13:10 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    WeakRef description

    WeakRef is an API to the Perl weak references.

    WeakRef is an API to the Perl weak references.

    SYNOPSIS

    use WeakRef;

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

    if(isweak($ref)) {
    }


    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.

    Requirements:

    · Perl



    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    weak references | Perl API | Perl module | Perl | API | weak

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM