Support for dbmopen/dbmclose?

Discussion in 'Perl Misc' started by Amer Neely, Mar 8, 2007.

  1. Amer Neely

    Amer Neely Guest

    I have to do some data mangling in a DBM file but would like to do my
    testing on my development system (Win2K running ActiveState Perl 5.8.8).
    I've read that this type of database is not supported by Win32, and
    according to the ActiveState docs at ASPN:
    "Functions obsoleted in perl5

    dbmclose, dbmopen
    "
    So, is is possible for me to work with a DBM file on my development machine?

    The script that resides on the Unix server runs fine, but not when I try
    to run it here. I've tried

    $DBFILE="TKL-db";
    dbmopen(%DBF,$DBFILE,0600) or die "Can't open $DBFILE: $!";
    and
    dbmopen(%DBF,$DBFILE,undef) or die "Can't open $DBFILE: $!";
    and
    dbmopen(%DBF,"TKL-db",undef) or die "Can't open 'TKL-db': $!";

    and get no data when I try to read records from it. The error log shows:
    Uncaught exception from user code:
    Can't open TKL-db: No such file or directory at test_dbm.pl line 16.


    ####################### 8X cut here 8X ###################
    #! /usr/bin/perl
    BEGIN
    {
    open (STDERR,">>$0-err.txt");
    print STDERR "\n",scalar localtime,"\n";
    }
    use strict;
    use warnings;
    use diagnostics;

    my $DBFILE="TKL-db";
    my %DBF;
    my ($key,$value,$Counter);

    $Counter=0;
    dbmopen(%DBF,$DBFILE,0600) or die "Can't open $DBFILE: $!";
    while (($key,$value) = each (%DBF))
    {
    print "$key\n";
    $Counter++;
    }
    dbmclose (%DBF);
    print "All done\n$Counter records.";
    ####################### 8X cut here 8X ###################

    --
    Amer Neely
    w: www.softouch.on.ca/
    b: www.softouch.on.ca/blog/
    Perl | MySQL programming for all data entry forms.
    "We make web sites work!"
     
    Amer Neely, Mar 8, 2007
    #1
    1. Advertising

  2. Amer Neely

    Uri Guttman Guest

    >>>>> "AN" == Amer Neely <> writes:

    AN> I have to do some data mangling in a DBM file but would like to do my
    AN> testing on my development system (Win2K running ActiveState Perl
    AN> 5.8.8). I've read that this type of database is not supported by
    AN> Win32, and according to the ActiveState docs at ASPN:
    AN> "Functions obsoleted in perl5

    AN> dbmclose, dbmopen

    those functions are deprecated for all perl versions. use tie with a
    hash instead. that works on all platforms and with many different db
    types (some have core modules and others on cpan).

    uri

    --
    Uri Guttman ------ -------- http://www.stemsystems.com
    --Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
    Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
     
    Uri Guttman, Mar 8, 2007
    #2
    1. Advertising

  3. Amer Neely

    Amer Neely Guest

    Uri Guttman wrote:
    >>>>>> "AN" == Amer Neely <> writes:

    >
    > AN> I have to do some data mangling in a DBM file but would like to do my
    > AN> testing on my development system (Win2K running ActiveState Perl
    > AN> 5.8.8). I've read that this type of database is not supported by
    > AN> Win32, and according to the ActiveState docs at ASPN:
    > AN> "Functions obsoleted in perl5
    >
    > AN> dbmclose, dbmopen
    >
    > those functions are deprecated for all perl versions. use tie with a
    > hash instead. that works on all platforms and with many different db
    > types (some have core modules and others on cpan).
    >
    > uri
    >


    OK, I'll try that. Thanks.

    --
    Amer Neely
    w: www.softouch.on.ca/
    b: www.softouch.on.ca/blog/
    Perl | MySQL programming for all data entry forms.
    "We make web sites work!"
     
    Amer Neely, Mar 8, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nick Zdunic
    Replies:
    0
    Views:
    953
    Nick Zdunic
    Nov 5, 2003
  2. dbmopen question

    , Nov 16, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    115
    Ben Morrow
    Nov 16, 2003
  3. Re dbmopen question

    , Nov 18, 2003, in forum: Perl Misc
    Replies:
    0
    Views:
    90
  4. shao

    dbmopen syntax error

    shao, Jan 4, 2006, in forum: Perl Misc
    Replies:
    1
    Views:
    89
  5. Henry Salvia
    Replies:
    2
    Views:
    120
    J. Gleixner
    Mar 19, 2007
Loading...

Share This Page