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

While writing the following code => Re: inventory.pl
I read in the dbmopen documentation that it is superceeded by tie. I guess Im having a little trouble digesting the tie documentation and seeing why I should use tie rather than dbmopen.

Thanks
Ted
--
"That which we persist in doing becomes easier, not that the task itself has become easier, but that our ability to perform it has improved."
  --Ralph Waldo Emerson

Replies are listed 'Best First'.
Re: trouble replacing dbmopen with tie
by jkeenan1 (Deacon) on Dec 28, 2005 at 18:30 UTC
    Im having a little trouble digesting the tie documentation and seeing why I should use tie rather than dbmopen.
    A valid point. The dbmopen documentation ought to explain why it has been superceded by tie.

    I don't claim to have a definitive answer. My hunch is that tie is much more flexible and Perl-ish function. So learning how to use it gives you a tool you can apply to many other types of situations.

    But if dbmopen and its siblings are working for you, why change? I don't think a tie call is intended to be a drop-in replacement for a dbmopen call.

    What do others think?

    Jim Keenan

      I don't claim to have a definitive answer. My hunch is that tie is much more flexible and Perl-ish function.
      That's a good hunch, which seems to be already documented. Note the argument list:
      'perldoc -f dbmopen'
      dbmopen HASH,DBNAME,MASK
      'perldoc -f tie'
      tie VARIABLE,CLASSNAME,LIST

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.