Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • 5.00503 (Score:3, Interesting)

    by Matts (1087) on 2002.06.10 8:03 (#9395) Journal
    What keeps you restricted to 5.6.1? Is it regexp features, our() or "use base" or something else?

    There are an awful lot of people still on 5.00503.
    • Furthermost it is the need for weak references. It's exceptionally easy to create unDESTROYable data-structures with that large a module whereas it is almost impossible not to do so. Anyway, we are approaching Perl 5.8.0 with already one release-candidate out. I think it is time for module authors to start using all the new cool features from 5.6.x onward.
      • Re:5.00503 (Score:5, Insightful)

        by Matts (1087) on 2002.06.10 8:43 (#9401) Journal
        If it helps, I have a technique (I didn't invent it - it's an old technique) in XML::XPath that allows you to avoid circular references without changing your code significantly. With a small patch it could be made to use weakrefs on 5.6.1 - I've just never gotten around to it.

        It's all good and well telling people that module authors should use 5.6.1, and for sure there are some nice features (open(my $fh) being one, weakrefs being the other), but persuading sysadmins to upgrade is a whole other issue. Especially when up until now FreeBSD has shipped with 5.00503.
        • Re:5.00503 (Score:2, Interesting)

          So, what's the secret? I've encountered the need for weak refs and wondered about any clever workarounds.

          Or is is just best to read the code in the hopes of finding it?
          • Re:5.00503 (Score:3, Informative)

            It basically uses indirect objects. Instead of having two nodes - a parent and a child, you have a parent, a proxy, and a child. The parent points to the proxy, the proxy points to the child, and child points to the proxy. When the parent gets garbage collected, it informs the proxy to sever it's link to the child, thus breaking the circular reference.

            The clever thing about XML::XPath's code is that it manages to do this flexibly enough that by switching just one flag it can work in either the indirect obj
          • Re:5.00503 (Score:2, Informative)

            Why complicated work-arounds when Perl supports weak references? OK, you want portability... and miss all the other nice new features as well?
            One way to avoid need for weak references is to have all objects register/unregister themselves in a hash. Other objects refer to that object by the key in that hash. The code will be clumpsy but it will work.