Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problem with tie and GDBM

Posted on 1997-05-21
3
Medium Priority
?
563 Views
Last Modified: 2012-06-27
I need to use gdbm databases with Perl but get the error:

"Can't locate object method "TIEHASH" via package "GDBM_FILE" " at
my_first_db.pl line 5."


when using this code:


#! /bin/perl -w
use GDBM_File;
use POSIX;
use Fcntl;
tie(%db, "GDBM_FILE", "my_db", &GDBM_WRCREAT, 0644);


Is it a bug in Perl5.003, or is there a workaround?

I am using Perl5.003 with the gdbm-1.7.3 library statically linked, both
compiled with gcc-2.7.2.2 on a Sun ULTRA running Solaris2.5.
0
Comment
Question by:moan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Expert Comment

by:mkornell
ID: 1204086
try:

tie(%db, GDBM_File, "my_db", &GDBM_WRCREAT, 0644);

i.e. change "GDBM_FILE" to "GDBM_File".  You also don't need the quotes.
       
0
 
LVL 2

Accepted Solution

by:
mkornell earned 200 total points
ID: 1204087
Was that the answer?

--mark;
0
 

Author Comment

by:moan
ID: 1204088
mkornell's answer solved my problem.
The code I tried was directly copied/pasted from an online manual
that had the syntax wrong!


0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question