Lightning flashed, thunder crashed and Michael G Schwern <[EMAIL PROTECTED]> wh
ispered:
| On Thu, Aug 24, 2000 at 08:29:21PM -0000, Perl6 RFC Librarian wrote:
| > The C<dbmopen> and C<dbmclose> commands are legacy commands which have been
| > deprecated for at least 5 years. They should be removed from the language.
|
| Two nit picks.
|
| First, dbmopen() isn't deprecated.
|
| [This function has been largely superseded by the tie() function.]
| --perlfunc
|
| Deprecated, no. Redundant, yes. And Perl has *never* had two ways to
| do things. ;)
Deprecated, superseded, obsolete, whatever... it all comes down to the same
thing. There is a better way to do it.
This function is actually just a call to tue with the proper arguments, but
is provided for backwards compatibility with older versions of Perl.
-Camel II
Functions obsoleted in perl5
dbmclose, dbmopen
-perlfunc
| Secondly, I still use dbmopen(). I find it a much simpler interface
| than AnyDBM_File when I just need any ol' disk hash.
|
| Compare:
|
| dbmopen(%foo, 'somefile', 0644);
|
| with:
|
| use AnyDBM_File;
| use Fcntl;
|
| tie %hash, 'AnyDBM_File', 'somefile', O_RDWR|O_CREAT, 0644;
|
| dbmopen()'s interface is much shorter and its much, much easier to
| understand. Try explaining O_RDWR|O_CREAT to a newbie. People have
| enough trouble with 0644.
Don't try to explain that to a newbie. Let them learn it on their own.
There are plenty of examples that just use
tie %hash, 'AnyDBM_File', 'somefile', 1, 0
that never explain what 1, 0 are for. I also seem to remember an RFC to
make "tie %blah 'DB'" automatically do a "use DB".
| Now, this doesn't mean dbmopen() has to remain as a builtin. It could
| be written as a pure Perl wrapper around tie() and AnyDBM_File. But
| keep it somewhere. Its useful and its not bothering anyone.
Keep it in a DB.pm module, if you want. There's no need to keep it in the
core binary. I'd much rather teach people
use DB;
dbmopen ...;
-spp