[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Problem with tie and DB_FILE



At 10:22 PM -0800 on 12/12/96, Keith D. Fetterman wrote:


}Folks,
}
}I am trying to get the tie function to work in MacPerl 5.1.0r2, but I am
}not having any success.  Your assistance will be appreciated.  Here is my
}script:
}
}======
}
}#!/usr/local/bin/perl5 -w
}
}use DB_File;
}
}use strict;
}
}
}my %myFile;
}
}tie (%myFile, 'DB_FILE', 'testDBFile', 'O_RDWR|O_CREAT', 0755, $DB_HASH)
}               || die "Error creating/opening testDBFile: $!\n";

Three things wrong.  You've misspelled DB_File (it's not DB_FILE).  MacPerl
has know way of knowing what O_RDWR or O_CREAT are unless you tell it.
You need a use Fcntl; after use DB_File;.  Perl has no way of telling that
something is not a string when you insist that it is.  Get rid of the
quotes around O_RDWR|O_CREAT. Then your script works.

This was very easy to figure out just by looking at the example in the
built in pod docs in :lib:DB_File.pm.  Start up Shuck and open :MacPerl
Ä:lib:DB_File.pm.

}
}======
}
}When I run it, I get the following error and the AutoLoader.pm file is opened.
}
}# Can't locate object method "TIEHASH" via package "DB_FILE".
}File 'KDF:Projects:RetailSource Perl Scripts:New Site:testCatDB.pl'; Line 10
}
}
}I am running the standard version of MacPerl on my 540c PowerBook (68040).
}I tried running the same script using the big version of MacPerl, but it
}aborts and returns either an Error Type 1 or Error Type 3.  Or it complains
}of running out of memory.  I have 20MB of RAM.

On a Mac under MacOS, that isn't really the issue.  What size memory
partition do you have MacPerl set for?   My BigMacPerl is set for 6 Mb,
which is adequate for the types of things I do.

}
}Any suggestions please send them my way.  Thanks,
}Keith
}
}
}
}
}
}___________________________________________________________________
}   "Providing Interactive Solutions for Business and Education"
}Keith D. Fetterman                           Phone:  (206) 842-7164
}Good Northwest Corporation                   FAX:    (206) 842-7291
}321 High School Rd. N.E.; Suite 325          e-mail: kdf@gnw.com
}Bainbridge Island, WA 98110                  http://www.gnw.com/


--------
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693
Greenbelt, MD 20770
schinder@pjstoaster.pg.md.us