Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hello!

I have faced rather strange issue when working with DB_File module.

Please see the two sample scripts below:

writedb.pl

readdb.pl

. The situation is the following:

- writedb.pl script creates a DB file tied to perl array (not hash) with fixed length records.

- than it puts there two records

- after that readdb.pl opens test.db file with the same parameters as writedb.pl and ties it also to an array

- readdb.pl reports the number of records existing in queue

This works fine on debian linux amd64 (perl 5.14.2). But fails on NetBSD amd64 (perl 5.14.2 too), OpenBSD amd64 (perl 5.12.2), FreeBSD amd64 (perl 5.12.4). On *BSDs it reports doubled DB size, for scripts attached it should be 2, but readdb.pl reports 4. I checked it under debugger and it seems that perl treats DB as tied to hash, not array (e.g. array with pairs of key and value). It creates array of doubled size, where each first value is data from file and each second value is empty.

Could you please advise whether I am doing anything wrong (maybe I am missing some important parameters) or it is bug in BSD implementation.

Thanks in advance.

--

Victor


In reply to DB_File recno treats array like a hash by vleschuk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-23 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found