Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Re: DB_File, not saving

by jsprat (Curate)
on Jul 17, 2003 at 19:20 UTC ( #275349=note: print w/replies, xml ) Need Help??

in reply to Re: DB_File, not saving
in thread DB_File, not saving

Commenting out unlink "chat"; would probably help too...

Update: I meant in addition to sauoq's comment, not instead of.

Replies are listed 'Best First'.
Re: Re: Re: DB_File, not saving
by sauoq (Abbot) on Jul 17, 2003 at 19:34 UTC

    He's just doing that once at the beginning of the script to remove his old file before writing a new one. That shouldn't matter (as long as he wants to start fresh each time the script runs.)

    Update: jsprat is correct. The file should not be unlinked. (It is obvious, on closer inspection, that the script is useless without it.)

    "My two cents aren't worth a dime.";
      I don't think he wants to start fresh each time. He wants to save the data so he can display more than one line.

      It looks like a CGI script that wants to accept a line of chat, then display the previous 10 lines. What it actually does is this:

      1. deletes all previous messages
      2. creates the db file, ties %chat
      3. unties %chat, thereby not storing any messages
      4. accepts a new message
      5. displays the last 10 messages (which were just deleted!)

      Not only is the %chat untied from the the DB_File when it's tied to TIE::IxHash (as you pointed out), the script is deleting the DB_File every time it is hit.

        You are right; he shouldn't delete it.

        "My two cents aren't worth a dime.";
        You're right. This is a chat script (much like the chatterbox). It takes the latest 10 messages and prints to screen and it stores the rest for logs later on. I removed the unlink (no idea what it does/did but it was in the example I used) and the problem is still here (you probably knew that). I must be able to tie %chat to both objects otherwise it's useless, I'll look into using it as an array.

        Thank you for your help!

        "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://275349]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2018-06-22 06:11 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (121 votes). Check out past polls.