http://qs1969.pair.com?node_id=551610

sara2005 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I have a need to use Tie::Autotie for preserving the order in which the hash is built based on a suggestion by one of you.

Unfortunately, I found that Autotie is only supported by perl 5.8.X whereas i have 5.6.1 and won't be able to upgrade perl either.

Is there a way I can still use Autotie or I have to look for other options? Looking forward to your help

#####################

Thank you. It works now!!

2006-05-25 Retitled by GrandFather, as per Monastery guidelines
Original title: 'Version Issues with Tie::Autotie'

  • Comment on Any way to use Tie::Autotie on Perl 5.6?

Replies are listed 'Best First'.
Re: tie::Autotie
by japhy (Canon) on May 25, 2006 at 14:39 UTC
    As the author, I'm pretty sure it's 5.6-compatible. The only reason it requires 5.8.3 is because I foolishly forgot to tell it to be backward-compatible. There should be an updated version later today on CPAN. For now, I give you permission to remove the 'require 5.008003' line.

    Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
    How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

      Thanks a lot of letting me know that this will work in 5.6.1.

      As you suggested, I removed "5.008003" from "Makefile.PL" and rebuilt the library. But, when I tried to execute a simple code to test this, it still gave an error as follows:-

      Perl v5.8.3 required--this is only v5.6.1, stopped at /...../..../..../Tie/Autotie.pm line 3. BEGIN failed--compilation aborted at /.../.../.../plib/Tie/Autotie.pm line 3. Compilation failed in require at test.cgi line 5. BEGIN failed--compilation aborted at test.cgi line 5. and the sample code is

      #! /path to perl use lib "path to auto tie"; use Data::Dumper; use Tie::Autotie 'Tie::IxHash'; tie %test_var, 'Tie::IxHash'; $tmp1 = 'MAIN'; $tmp2 = 'New'; $test_var{MAIN}{APP} = undef; $test_var{$tmp1}{$tmp2} = undef; $test_var{MAIN}{OP} = undef; $test_var{MAIN}{Vxit} = undef; $test_var{MAIN}{Exit} = undef; $test_var{MAIN}{OP}{PRO} = undef; $test_var{MAIN}{OP}{DEV} = undef; $test_var{MAIN}{OP}{CON} = undef; print Dumper(\%test_var);

        Then it will be having a use 5.008003 in the Autofile.pm which yu should try removing.

        /J\